diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-08-28 17:45:34 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-08-28 17:45:34 -0700 |
commit | cd2f77d39251be4326f9d75ba10ab8ac5686475e (patch) | |
tree | 8cd9500c39752a50b22e9a7f92966fb09eb4f48c /tests/tests.c | |
parent | 22dd1980f6750d96cb574fcbefd9a40bafb73f1c (diff) |
Incremental improvements to cbparser, and a test.
Diffstat (limited to 'tests/tests.c')
-rw-r--r-- | tests/tests.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tests.c b/tests/tests.c index e625f8a..7f6f6a4 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -227,6 +227,26 @@ static void test_upb_context() { upb_context_unref(c); } + +static upb_field_type_t tag_cb(void *udata, struct upb_tag *tag, + void **user_field_desc) +{ + (void)udata; + (void)tag; + (void)user_field_desc; + return 0; +} + +static void test_cbparser() +{ + struct upb_cbparser *p = upb_cbparser_new(); + ASSERT(p); + upb_cbparser_reset(p, NULL, tag_cb, NULL, NULL, NULL, NULL); + size_t read; + ASSERT(upb_cbparser_parse(p, NULL, 0, &read) == UPB_STATUS_OK); + ASSERT(read == 0); +} + int main() { #define TEST(func) do { \ @@ -241,6 +261,7 @@ int main() TEST(test_skip_v_uint64_t); TEST(test_get_f_uint32_t); TEST(test_upb_context); + TEST(test_cbparser); printf("All tests passed (%d assertions).\n", num_assertions); return 0; } |