diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 16:16:33 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 16:16:33 +0000 |
commit | 64ac18c8848d3071a16065c84fca3b5e7210ce95 (patch) | |
tree | af3f7a5d759e51ac6ada8d95ea6e946709fb6bab /tests/encode_unittests.c | |
parent | 9966a8c9b680ada47b6bd5fe96405c0abaf773e4 (diff) |
Changed autogenerated file naming from foo.c to foo.pb.c
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@965 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'tests/encode_unittests.c')
-rw-r--r-- | tests/encode_unittests.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/encode_unittests.c b/tests/encode_unittests.c index ee7f7a34..5578a0ab 100644 --- a/tests/encode_unittests.c +++ b/tests/encode_unittests.c @@ -2,6 +2,7 @@ #include <string.h> #include "pb_encode.h" #include "unittests.h" +#include "unittestproto.pb.h" bool streamcallback(pb_ostream_t *stream, const uint8_t *buf, size_t count) { @@ -163,6 +164,27 @@ int main() TEST(WRITES(pb_enc_string(&s, NULL, &value), "\x00")) } + { + uint8_t buffer[10]; + pb_ostream_t s; + IntegerArray msg = {5, {1, 2, 3, 4, 5}}; + + COMMENT("Test pb_encode with int32 array") + + TEST(WRITES(pb_encode(&s, IntegerArray_fields, &msg), "\x0A\x05\x01\x02\x03\x04\x05")) + + msg.data_count = 0; + TEST(WRITES(pb_encode(&s, IntegerArray_fields, &msg), "")) + + msg.data_count = 10; + TEST(!pb_encode(&s, IntegerArray_fields, &msg)) + } + + { + + + } + if (status != 0) fprintf(stdout, "\n\nSome tests FAILED!\n"); |