1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2023 Google LLC. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 #include <string> 9 10 #include "google/protobuf/descriptor.pb.h" 11 #include <gtest/gtest.h> 12 #include "testing/fuzzing/fuzztest.h" 13 #include "upb/util/def_to_proto_test.h" 14 15 namespace upb_test { 16 17 FUZZ_TEST(FuzzTest, RoundTripDescriptor) 18 .WithDomains( 19 ::fuzztest::Arbitrary<google::protobuf::FileDescriptorSet>().WithProtobufField( 20 "file", 21 ::fuzztest::Arbitrary<google::protobuf::FileDescriptorProto>() 22 // upb_FileDef_ToProto() does not attempt to preserve 23 // source_code_info. 24 .WithFieldUnset("source_code_info") 25 .WithProtobufField( 26 "service", 27 ::fuzztest::Arbitrary<google::protobuf::ServiceDescriptorProto>() 28 // streams are google3-only, and we do not currently 29 // attempt to preserve them. 30 .WithFieldUnset("stream")))); 31 32 } // namespace upb_test 33