// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef FUZZTEST_FUZZTEST_INTERNAL_SERIALIZATION_H_ #define FUZZTEST_FUZZTEST_INTERNAL_SERIALIZATION_H_ #include <cstddef> #include <cstdint> #include <cstring> #include <optional> #include <string> #include <tuple> #include <type_traits> #include <utility> #include <variant> #include <vector> #include "absl/numeric/int128.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" #include "./fuzztest/internal/meta.h" namespace fuzztest::internal { // Template predicates for special handling in serialziation. The definitions // here may be too specific to put into meta.h. is_bytevector_v; is_bytevector_v; is_bytevector_v; is_bytevector_v; struct IRObject; // Simple intermediate representation object and ParseInput/SerializeInput // functions for it. // // The serialization format follows the Text format for Protocol Buffers of the // `IRObject` message, with the following message definition: // // message IRObject { // oneof value { // uint64 i = 1; // double d = 2; // bytes s = 3; // } // repeated IRObject sub = 4; // } // // The protobuf definition does not allow putting `sub` in the oneof because it // is repeated, but the C++ type enforces the invariant that only one field is // set. struct IRObject { … }; } // namespace fuzztest::internal #endif // FUZZTEST_FUZZTEST_INTERNAL_SERIALIZATION_H_