diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 15:57:47 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 15:57:47 +0000 |
commit | 9966a8c9b680ada47b6bd5fe96405c0abaf773e4 (patch) | |
tree | 27cb83a34cc722c1414dc531c36b4104b601aa63 /tests/decode_unittests.c | |
parent | 7780da38e88027370009afda5a9b6dc93a4168d4 (diff) |
more unittests
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@964 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'tests/decode_unittests.c')
-rw-r--r-- | tests/decode_unittests.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/decode_unittests.c b/tests/decode_unittests.c index 85dd8d58..6f2b77e5 100644 --- a/tests/decode_unittests.c +++ b/tests/decode_unittests.c @@ -282,6 +282,18 @@ int main() TEST((s = S("\x08\x55"), !pb_decode(&s, CallbackArray_fields, &dest))) } + { + pb_istream_t s; + IntegerArray dest; + + COMMENT("Testing pb_decode message termination") + TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest))) + TEST((s = S("\x00"), pb_decode(&s, IntegerArray_fields, &dest))) + TEST((s = S("\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest))) + TEST((s = S("\x08\x01\x00"), pb_decode(&s, IntegerArray_fields, &dest))) + TEST((s = S("\x08"), !pb_decode(&s, IntegerArray_fields, &dest))) + } + if (status != 0) fprintf(stdout, "\n\nSome tests FAILED!\n"); |