]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(test_main): Added test for lengths with
authorNiels Möller <nisse@lysator.liu.se>
Thu, 7 Nov 2002 08:09:21 +0000 (09:09 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 7 Nov 2002 08:09:21 +0000 (09:09 +0100)
more than one digit. Added tests for transport mode decoding.

Rev: src/nettle/testsuite/sexp-test.c:1.9

testsuite/sexp-test.c

index ab08be5be9ed64c8742844734b51598d7d800d12..cd18ed48942d16bfd0ed4de80728e1fd7ed2557b 100644 (file)
@@ -20,7 +20,7 @@ test_main(void)
   ASSERT(i.type == SEXP_LIST
         && !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
         && !i.display_length && !i.display
         && i.atom_length == 3 && MEMEQ(3, "foo", i.atom)
@@ -31,8 +31,28 @@ test_main(void)
 
         && sexp_iterator_next(&i) && i.type == SEXP_ATOM
         && 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" };
     struct sexp_iterator v[2];