Vitaly Buka | b5c12da | 2016-10-19 13:12:41 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #ifndef LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H |
| 16 | #define LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H |
| 17 | |
Vitaly Buka | 00b6107 | 2016-10-19 16:22:51 -0700 | [diff] [blame^] | 18 | #include <stdint.h> |
| 19 | |
Vitaly Buka | b5c12da | 2016-10-19 13:12:41 -0700 | [diff] [blame] | 20 | class Message; |
Vitaly Buka | 00b6107 | 2016-10-19 16:22:51 -0700 | [diff] [blame^] | 21 | class FieldDescriptor; |
| 22 | class EnumValueDescriptor; |
| 23 | |
Vitaly Buka | b5c12da | 2016-10-19 13:12:41 -0700 | [diff] [blame] | 24 | |
| 25 | class ProtobufMutator { |
| 26 | public: |
Vitaly Buka | 00b6107 | 2016-10-19 16:22:51 -0700 | [diff] [blame^] | 27 | ProtobufMutator(uint32_t seed); |
| 28 | virtual ~ProtobufMutator(); |
| 29 | |
Vitaly Buka | b5c12da | 2016-10-19 13:12:41 -0700 | [diff] [blame] | 30 | bool Mutate(Message* proto); |
| 31 | bool CrossOver(const Message& with, Message* proto); |
| 32 | |
Vitaly Buka | 00b6107 | 2016-10-19 16:22:51 -0700 | [diff] [blame^] | 33 | virtual bool MutateField(const FieldDescriptor& field, int32_t* value); |
| 34 | virtual bool MutateField(const FieldDescriptor& field, int64_t* value); |
| 35 | virtual bool MutateField(const FieldDescriptor& field, uint32_t* value); |
| 36 | virtual bool MutateField(const FieldDescriptor& field, uint64_t* value); |
| 37 | virtual bool MutateField(const FieldDescriptor& field, double* value); |
| 38 | virtual bool MutateField(const FieldDescriptor& field, float* value); |
| 39 | virtual bool MutateField(const FieldDescriptor& field, bool* value); |
| 40 | virtual bool MutateField(const FieldDescriptor& field, const EnumValueDescriptor** value); |
| 41 | virtual bool MutateField(const FieldDescriptor& field, Message* value); |
| 42 | |
Vitaly Buka | b5c12da | 2016-10-19 13:12:41 -0700 | [diff] [blame] | 43 | private: |
| 44 | }; |
| 45 | |
| 46 | #endif // LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H |