Go to the documentation of this file.
30 #include "gmock/gmock.h"
31 #include "google/protobuf/descriptor.pb.h"
33 #include "google/protobuf/dynamic_message.h"
34 #include "google/protobuf/util/message_differencer.h"
35 #include "gtest/gtest.h"
38 #include "upb/util/def_to_proto_test.upbdefs.h"
49 upb_proto, tmp_arena.
ptr(), &
size);
51 google_proto.ParseFromArray(
buf,
size);
53 pool->BuildFile(google_proto);
60 std::unique_ptr<google::protobuf::Message>
ToProto(
66 std::unique_ptr<google::protobuf::Message> google_msg(
71 google_msg->ParseFromArray(
buf,
size);
79 negation ?
"are not equal" :
"are equal") {
88 std::unique_ptr<google::protobuf::Message> m1(
90 std::unique_ptr<google::protobuf::Message> m2(
97 *result_listener << differences;
120 upb_util_def_to_proto_test_proto_upbdefinit.descriptor;
130 TEST(DefToProto, TestRuntimeReflection) {
134 upb_util_def_to_proto_test_proto_upbdefinit.descriptor;
139 symtab.ptr(), &upb_util_def_to_proto_test_proto_upbdefinit,
true);
141 upb_util_def_to_proto_test_proto_upbdefinit.filename);
const UPB_INLINE upb_MessageDef * google_protobuf_FileDescriptorProto_getmsgdef(upb_DefPool *s)
const google::protobuf::Descriptor * AddMessageDescriptor(upb::MessageDefPtr msgdef, google::protobuf::DescriptorPool *pool)
const upb_MiniTable * upb_MessageDef_MiniTable(const upb_MessageDef *m)
virtual const Message * GetPrototype(const Descriptor *type)=0
UPB_INLINE char * google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_Arena *arena, size_t *len)
grpc_core::ScopedArenaPtr arena
#define ASSERT_THAT(value, matcher)
bool Compare(const Message &message1, const Message &message2)
void ReportDifferencesToString(std::string *output)
bool _upb_DefPool_LoadDefInitEx(upb_DefPool *s, const _upb_DefPool_Init *init, bool rebuild_minitable)
char * upb_Encode(const void *msg, const upb_MiniTable *l, int options, upb_Arena *arena, size_t *size)
std::unique_ptr< google::protobuf::Message > ToProto(const upb_Message *msg, const upb_MessageDef *msgdef, const google::protobuf::Descriptor *desc, google::protobuf::MessageFactory *factory)
UPB_INLINE google_protobuf_FileDescriptorProto * google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, upb_Arena *arena)
const upb_msgdef * msgdef
Message * New() const override=0
#define EXPECT_TRUE(condition)
InternalDescriptorPool * pool
GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto
google_protobuf_FileDescriptorProto * upb_FileDef_ToProto(const upb_FileDef *f, upb_Arena *a)
struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto
void CheckFile(const upb::FileDefPtr file, const google_protobuf_FileDescriptorProto *proto)
MATCHER_P2(EqualsUpbProto, proto, msgdef_func, negation ? "are not equal" :"are equal")
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:09