summaryrefslogtreecommitdiffstats
path: root/tests/encode_unittests/encode_unittests.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-09-07 19:49:26 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-09-07 20:30:17 +0300
commit38613acdb42731cc4bc80e93cfbc3cd126976c24 (patch)
treeef7a77a1f6af2ae72eb08ebbcc316f6ac34dc279 /tests/encode_unittests/encode_unittests.c
parentcdbf51db08d86ea024605078f21e8c61fe0e5fd3 (diff)
Add a few missing unit tests
Diffstat (limited to 'tests/encode_unittests/encode_unittests.c')
-rw-r--r--tests/encode_unittests/encode_unittests.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/encode_unittests/encode_unittests.c b/tests/encode_unittests/encode_unittests.c
index 78fbb8b1..583af5c6 100644
--- a/tests/encode_unittests/encode_unittests.c
+++ b/tests/encode_unittests/encode_unittests.c
@@ -331,6 +331,23 @@ int main()
TEST(s.bytes_written == StringMessage_size);
}
+ {
+ uint8_t buffer[128];
+ pb_ostream_t s;
+ StringPointerContainer msg = StringPointerContainer_init_zero;
+ char *strs[1] = {NULL};
+ char zstr[] = "Z";
+
+ COMMENT("Test string pointer encoding.");
+
+ msg.rep_str = strs;
+ msg.rep_str_count = 1;
+ TEST(WRITES(pb_encode(&s, StringPointerContainer_fields, &msg), "\x0a\x00"))
+
+ strs[0] = zstr;
+ TEST(WRITES(pb_encode(&s, StringPointerContainer_fields, &msg), "\x0a\x01Z"))
+ }
+
if (status != 0)
fprintf(stdout, "\n\nSome tests FAILED!\n");