diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-14 20:11:05 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-14 20:11:05 +0000 |
commit | 842d52633d650286ce62490362f8dfa356e17800 (patch) | |
tree | 6597bc4dc16ac13d129901fd42e76fb776e86a7d /tests/decode_unittests.c | |
parent | 6dfba365b00175eae7e8b83aaf5d29ce190fd9eb (diff) |
More documentation, small improvements
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@955 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'tests/decode_unittests.c')
-rw-r--r-- | tests/decode_unittests.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/tests/decode_unittests.c b/tests/decode_unittests.c index ff4c6b46..ac51d491 100644 --- a/tests/decode_unittests.c +++ b/tests/decode_unittests.c @@ -50,32 +50,19 @@ int main() { pb_istream_t s; - uint32_t u; - int32_t i; - - COMMENT("Test pb_decode_varint32"); - TEST((s = S("\x00"), pb_decode_varint32(&s, &u) && u == 0)); - TEST((s = S("\x01"), pb_decode_varint32(&s, &u) && u == 1)); - TEST((s = S("\xAC\x02"), pb_decode_varint32(&s, &u) && u == 300)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint32(&s, &u) && u == UINT32_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint32(&s, (uint32_t*)&i) && i == -1)); - } - - { - pb_istream_t s; uint64_t u; int64_t i; - COMMENT("Test pb_decode_varint64"); - TEST((s = S("\x00"), pb_decode_varint64(&s, &u) && u == 0)); - TEST((s = S("\x01"), pb_decode_varint64(&s, &u) && u == 1)); - TEST((s = S("\xAC\x02"), pb_decode_varint64(&s, &u) && u == 300)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint64(&s, &u) && u == UINT32_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint64(&s, (uint64_t*)&i) && i == UINT32_MAX)); + COMMENT("Test pb_decode_varint"); + TEST((s = S("\x00"), pb_decode_varint(&s, &u) && u == 0)); + TEST((s = S("\x01"), pb_decode_varint(&s, &u) && u == 1)); + TEST((s = S("\xAC\x02"), pb_decode_varint(&s, &u) && u == 300)); + TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, &u) && u == UINT32_MAX)); + TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, (uint64_t*)&i) && i == UINT32_MAX)); TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), - pb_decode_varint64(&s, (uint64_t*)&i) && i == -1)); + pb_decode_varint(&s, (uint64_t*)&i) && i == -1)); TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), - pb_decode_varint64(&s, &u) && u == UINT64_MAX)); + pb_decode_varint(&s, &u) && u == UINT64_MAX)); } { |