summaryrefslogtreecommitdiffstats
path: root/tests/encode_unittests.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-03-01 13:46:52 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-03-01 13:46:52 +0200
commit9fbe9a5de30c3326bd7015e91c5ba634df49ee25 (patch)
tree16f0140e0ede0606e49057be64b0a8450c46b14c /tests/encode_unittests.c
parent0cdc623050ac8c76f3a8dbd14675a3b29f18542d (diff)
Refactoring the field encoder interface.
Replaced the confusing pb_enc_* functions with new pb_encode_* functions that have a cleaner interface. Updated documentation. Got rid of the endian_copy stuff in pb_encode.c, instead using C casts to do it automatically. This makes the code safer and also reduces binary size by about 5%. Fixes Issue 6.
Diffstat (limited to 'tests/encode_unittests.c')
-rw-r--r--tests/encode_unittests.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/encode_unittests.c b/tests/encode_unittests.c
index 166e6e83..9cdbc66e 100644
--- a/tests/encode_unittests.c
+++ b/tests/encode_unittests.c
@@ -1,3 +1,5 @@
+#define NANOPB_INTERNALS
+
#include <stdio.h>
#include <string.h>
#include "pb_encode.h"
@@ -123,7 +125,6 @@ int main()
uint8_t buffer[30];
pb_ostream_t s;
uint8_t value = 1;
- int8_t svalue = -1;
int32_t max = INT32_MAX;
int32_t min = INT32_MIN;
int64_t lmax = INT64_MAX;
@@ -132,8 +133,6 @@ int main()
COMMENT("Test pb_enc_varint and pb_enc_svarint")
TEST(WRITES(pb_enc_varint(&s, &field, &value), "\x01"));
- TEST(WRITES(pb_enc_svarint(&s, &field, &svalue), "\x01"));
- TEST(WRITES(pb_enc_svarint(&s, &field, &value), "\x02"));
field.data_size = sizeof(max);
TEST(WRITES(pb_enc_svarint(&s, &field, &max), "\xfe\xff\xff\xff\x0f"));