Commit 59ef8f68 authored by Niels Möller's avatar Niels Möller
Browse files

(test_main): Added test for lengths with

more than one digit. Added tests for transport mode decoding.

Rev: src/nettle/testsuite/sexp-test.c:1.9
parent 34ca4f8c
...@@ -20,7 +20,7 @@ test_main(void) ...@@ -20,7 +20,7 @@ test_main(void)
ASSERT(i.type == SEXP_LIST ASSERT(i.type == SEXP_LIST
&& !sexp_iterator_enter_list(&i)); && !sexp_iterator_enter_list(&i));
ASSERT(sexp_iterator_first(&i, LDATA("3:foo0:[3:bar]1:x"))); ASSERT(sexp_iterator_first(&i, LDATA("3:foo0:[3:bar]12:xxxxxxxxxxxx")));
ASSERT(i.type == SEXP_ATOM ASSERT(i.type == SEXP_ATOM
&& !i.display_length && !i.display && !i.display_length && !i.display
&& i.atom_length == 3 && MEMEQ(3, "foo", i.atom) && i.atom_length == 3 && MEMEQ(3, "foo", i.atom)
...@@ -31,8 +31,28 @@ test_main(void) ...@@ -31,8 +31,28 @@ test_main(void)
&& sexp_iterator_next(&i) && i.type == SEXP_ATOM && sexp_iterator_next(&i) && i.type == SEXP_ATOM
&& i.display_length == 3 && MEMEQ(3, "bar", i.display) && i.display_length == 3 && MEMEQ(3, "bar", i.display)
&& i.atom_length == 1 && MEMEQ(1, "x", i.atom)); && i.atom_length == 12 && MEMEQ(12, "xxxxxxxxxxxx", i.atom)
&& sexp_iterator_next(&i) && i.type == SEXP_END);
/* Same data, transport encoded. */
ASSERT(sexp_transport_iterator_first
(&i, LDUP("{Mzpmb28=} {MDo=} {WzM6YmFyXTEyOnh4eHh4eHh4eHh4eA==}")));
ASSERT(i.type == SEXP_ATOM
&& !i.display_length && !i.display
&& i.atom_length == 3 && MEMEQ(3, "foo", i.atom)
&& sexp_iterator_next(&i) && i.type == SEXP_ATOM
&& !i.display_length && !i.display
&& !i.atom_length && i.atom
&& sexp_iterator_next(&i) && i.type == SEXP_ATOM
&& i.display_length == 3 && MEMEQ(3, "bar", i.display)
&& i.atom_length == 12 && MEMEQ(12, "xxxxxxxxxxxx", i.atom)
&& sexp_iterator_next(&i) && i.type == SEXP_END);
{ {
static const uint8_t *keys[2] = { "n", "e" }; static const uint8_t *keys[2] = { "n", "e" };
struct sexp_iterator v[2]; struct sexp_iterator v[2];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment