summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-08-28 17:45:34 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-08-28 17:45:34 -0700
commitcd2f77d39251be4326f9d75ba10ab8ac5686475e (patch)
tree8cd9500c39752a50b22e9a7f92966fb09eb4f48c /tests
parent22dd1980f6750d96cb574fcbefd9a40bafb73f1c (diff)
Incremental improvements to cbparser, and a test.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.c21
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;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback