Skip to content
Snippets Groups Projects
Commit 8ba37244 authored by Niels Möller's avatar Niels Möller
Browse files

(test_main): New test with tokens

in the format string.

Rev: src/nettle/testsuite/sexp-format-test.c:1.5
parent 889b9bc9
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,24 @@ test_main(void) ...@@ -73,7 +73,24 @@ test_main(void)
ASSERT(MEMEQ(buffer.size, buffer.contents, e)); ASSERT(MEMEQ(buffer.size, buffer.contents, e));
} }
/* Try literals */
{
const uint8_t e[] = "(3:foo(3:bar17:xxxxxxxxxxxxxxxxx))";
nettle_buffer_init(&buffer);
ASSERT(sexp_format(&buffer, "(%0s(bar%0s))",
"foo", "xxxxxxxxxxxxxxxxx")
== strlen(e));
ASSERT(sexp_format(NULL, "(%0s(%0s%0s))",
"foo", "bar", "xxxxxxxxxxxxxxxxx")
== strlen(e));
ASSERT(buffer.size == strlen(e));
ASSERT(MEMEQ(buffer.size, buffer.contents, e));
}
#if HAVE_LIBGMP #if HAVE_LIBGMP
{ {
mpz_t x; mpz_t x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment