summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-12-05 19:54:38 -0800
committerJoshua Haberman <joshua@reverberate.org>2009-12-05 19:54:38 -0800
commit08b4a91204ff7174c381f887d87878d8bb1181ff (patch)
tree431f22caea40a3ccc7e78b020b5245ac9de40d21 /tests
parent651c92ab33187b34d7878ac57427bbbc062662fa (diff)
Add a test for circularly-linked descriptors.
The test currently triggers valgrind-detected memory errors.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_vs_proto2.cc4
-rw-r--r--tests/tests.c15
2 files changed, 14 insertions, 5 deletions
diff --git a/tests/test_vs_proto2.cc b/tests/test_vs_proto2.cc
index 926d731..58c8e50 100644
--- a/tests/test_vs_proto2.cc
+++ b/tests/test_vs_proto2.cc
@@ -131,8 +131,8 @@ void compare(const google::protobuf::Message& proto2_msg,
const google::protobuf::Descriptor *d = proto2_msg.GetDescriptor();
struct upb_msgdef *def = upb_msg->def;
- ASSERT((uint32_t)d->field_count() == def->num_fields);
- for(uint32_t i = 0; i < def->num_fields; i++) {
+ ASSERT((upb_field_count_t)d->field_count() == def->num_fields);
+ for(upb_field_count_t i = 0; i < def->num_fields; i++) {
struct upb_fielddef *upb_f = &def->fields[i];
const google::protobuf::FieldDescriptor *proto2_f =
d->FindFieldByNumber(upb_f->number);
diff --git a/tests/tests.c b/tests/tests.c
index 9fbfa3a..3580c2e 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -228,9 +228,18 @@ static void test_get_f_uint32_t()
}
static void test_upb_symtab() {
- struct upb_symtab *c = upb_symtab_new();
- ASSERT(c);
- upb_symtab_unref(c);
+ struct upb_symtab *s = upb_symtab_new();
+ ASSERT(s);
+ struct upb_string *descriptor = upb_strreadfile("tests/test.proto.pb");
+ if(!descriptor) {
+ fprintf(stderr, "Couldn't read input file tests/test.proto.pb\n");
+ exit(1);
+ }
+ struct upb_status status = UPB_STATUS_INIT;
+ upb_symtab_add_desc(s, descriptor, &status);
+ ASSERT(upb_ok(&status));
+ upb_string_unref(descriptor);
+ upb_symtab_unref(s);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback