diff options
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"); |