Commit 2903889b authored by Niels Möller's avatar Niels Möller

* testsuite/sexp-test.c (test_main): Reordered sexp_iterator_assoc

tests.

Rev: src/nettle/testsuite/sexp-test.c:1.2
parent 848b37be
...@@ -38,14 +38,10 @@ test_main(void) ...@@ -38,14 +38,10 @@ test_main(void)
struct sexp_assoc_key keys[2] = struct sexp_assoc_key keys[2] =
{ { LDATA("n") }, { LDATA("e") } }; { { LDATA("n") }, { LDATA("e") } };
struct sexp_iterator v[2]; struct sexp_iterator v[2];
sexp_iterator_init(&i, LDATA("((1:n))"));
ASSERT(!sexp_iterator_assoc(&i, 2, keys, v));
sexp_iterator_init(&i, LDATA("((1:n)(1:n3:foo))"));
ASSERT(!sexp_iterator_assoc(&i, 2, keys, v));
sexp_iterator_init(&i, LDATA("((1:n2:xx3:foo)0:(1:y)(1:e))")); sexp_iterator_init(&i, LDATA("((1:n2:xx3:foo)0:(1:y)(1:e))"));
ASSERT(sexp_iterator_assoc(&i, 2, keys, v)); ASSERT(sexp_iterator_next(&i)
&& sexp_iterator_assoc(&i, 2, keys, v));
ASSERT(sexp_iterator_next(&v[0]) && v[0].type == SEXP_ATOM ASSERT(sexp_iterator_next(&v[0]) && v[0].type == SEXP_ATOM
&& !v[0].display_length && !v[0].display && !v[0].display_length && !v[0].display
...@@ -56,6 +52,18 @@ test_main(void) ...@@ -56,6 +52,18 @@ test_main(void)
&& v[0].atom_length == 3 && MEMEQ(3, "foo", v[0].atom) && v[0].atom_length == 3 && MEMEQ(3, "foo", v[0].atom)
&& sexp_iterator_next(&v[0]) && v[0].type == SEXP_END); && sexp_iterator_next(&v[0]) && v[0].type == SEXP_END);
ASSERT(sexp_iterator_next(&v[1]) && v[1].type == SEXP_END);
#if 0
sexp_iterator_init(&i, LDATA("((1:n))"));
ASSERT(sexp_iterator_next(&i)
&& !sexp_iterator_assoc(&i, 2, keys, v));
sexp_iterator_init(&i, LDATA("((1:n)(1:n3:foo))"));
ASSERT(sexp_iterator_next(&i)
&& !sexp_iterator_assoc(&i, 2, keys, v));
#endif
} }
SUCCESS(); SUCCESS();
} }
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