Commit 974514e1 authored by Niels Möller's avatar Niels Möller

Fix pointer sign warnings for test_armor.

parent 21457417
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
* testsuite/yarrow-test.c (test_main): Fix pointer * testsuite/yarrow-test.c (test_main): Fix pointer
signednesss warning. signednesss warning.
* testsuite/testutils.c (test_armor): Change ascii argument to
const char *.
* testsuite/base16-test.c (test_main): Use LDATA for the non-ascii
argument to test_armor.
* testsuite/base64-test.c (test_main): Likewise.
2016-08-29 Niels Möller <nisse@lysator.liu.se> 2016-08-29 Niels Möller <nisse@lysator.liu.se>
* sexp-format.c (strlen_u8): New helper function. * sexp-format.c (strlen_u8): New helper function.
......
...@@ -14,12 +14,12 @@ test_main(void) ...@@ -14,12 +14,12 @@ test_main(void)
ASSERT(BASE16_DECODE_LENGTH(3) == 2); ASSERT(BASE16_DECODE_LENGTH(3) == 2);
ASSERT(BASE16_DECODE_LENGTH(4) == 2); ASSERT(BASE16_DECODE_LENGTH(4) == 2);
test_armor(&nettle_base16, 0, "", ""); test_armor(&nettle_base16, LDATA(""), "");
test_armor(&nettle_base16, 1, "H", "48"); test_armor(&nettle_base16, LDATA("H"), "48");
test_armor(&nettle_base16, 2, "He", "4865"); test_armor(&nettle_base16, LDATA("He"), "4865");
test_armor(&nettle_base16, 3, "Hel", "48656c"); test_armor(&nettle_base16, LDATA("Hel"), "48656c");
test_armor(&nettle_base16, 4, "Hell", "48656c6c"); test_armor(&nettle_base16, LDATA("Hell"), "48656c6c");
test_armor(&nettle_base16, 5, "Hello", "48656c6c6f"); test_armor(&nettle_base16, LDATA("Hello"), "48656c6c6f");
test_armor(&nettle_base16, 6, "Hello", "48656c6c6f00"); test_armor(&nettle_base16, LDATA("Hello\0"), "48656c6c6f00");
} }
...@@ -84,25 +84,25 @@ test_main(void) ...@@ -84,25 +84,25 @@ test_main(void)
ASSERT(BASE64_DECODE_LENGTH(3) == 3); /* At most 24 bits */ ASSERT(BASE64_DECODE_LENGTH(3) == 3); /* At most 24 bits */
ASSERT(BASE64_DECODE_LENGTH(4) == 3); /* At most 30 bits */ ASSERT(BASE64_DECODE_LENGTH(4) == 3); /* At most 30 bits */
test_armor(&nettle_base64, 0, "", ""); test_armor(&nettle_base64, LDATA(""), "");
test_armor(&nettle_base64, 1, "H", "SA=="); test_armor(&nettle_base64, LDATA("H"), "SA==");
test_armor(&nettle_base64, 2, "He", "SGU="); test_armor(&nettle_base64, LDATA("He"), "SGU=");
test_armor(&nettle_base64, 3, "Hel", "SGVs"); test_armor(&nettle_base64, LDATA("Hel"), "SGVs");
test_armor(&nettle_base64, 4, "Hell", "SGVsbA=="); test_armor(&nettle_base64, LDATA("Hell"), "SGVsbA==");
test_armor(&nettle_base64, 5, "Hello", "SGVsbG8="); test_armor(&nettle_base64, LDATA("Hello"), "SGVsbG8=");
test_armor(&nettle_base64, 6, "Hello", "SGVsbG8A"); test_armor(&nettle_base64, LDATA("Hello\0"), "SGVsbG8A");
test_armor(&nettle_base64, 9, "Hello?>>>", "SGVsbG8/Pj4+"); test_armor(&nettle_base64, LDATA("Hello?>>>"), "SGVsbG8/Pj4+");
test_armor(&nettle_base64, 4, "\xff\xff\xff\xff", "/////w=="); test_armor(&nettle_base64, LDATA("\xff\xff\xff\xff"), "/////w==");
test_armor(&nettle_base64url, 0, "", ""); test_armor(&nettle_base64url, LDATA(""), "");
test_armor(&nettle_base64url, 1, "H", "SA=="); test_armor(&nettle_base64url, LDATA("H"), "SA==");
test_armor(&nettle_base64url, 2, "He", "SGU="); test_armor(&nettle_base64url, LDATA("He"), "SGU=");
test_armor(&nettle_base64url, 3, "Hel", "SGVs"); test_armor(&nettle_base64url, LDATA("Hel"), "SGVs");
test_armor(&nettle_base64url, 4, "Hell", "SGVsbA=="); test_armor(&nettle_base64url, LDATA("Hell"), "SGVsbA==");
test_armor(&nettle_base64url, 5, "Hello", "SGVsbG8="); test_armor(&nettle_base64url, LDATA("Hello"), "SGVsbG8=");
test_armor(&nettle_base64url, 6, "Hello", "SGVsbG8A"); test_armor(&nettle_base64url, LDATA("Hello\0"), "SGVsbG8A");
test_armor(&nettle_base64url, 9, "Hello?>>>", "SGVsbG8_Pj4-"); test_armor(&nettle_base64url, LDATA("Hello?>>>"), "SGVsbG8_Pj4-");
test_armor(&nettle_base64url, 4, "\xff\xff\xff\xff", "_____w=="); test_armor(&nettle_base64url, LDATA("\xff\xff\xff\xff"), "_____w==");
{ {
/* Test overlapping areas */ /* Test overlapping areas */
......
...@@ -563,7 +563,7 @@ void ...@@ -563,7 +563,7 @@ void
test_armor(const struct nettle_armor *armor, test_armor(const struct nettle_armor *armor,
size_t data_length, size_t data_length,
const uint8_t *data, const uint8_t *data,
const uint8_t *ascii) const char *ascii)
{ {
size_t ascii_length = strlen(ascii); size_t ascii_length = strlen(ascii);
uint8_t *buffer = xalloc(1 + ascii_length); uint8_t *buffer = xalloc(1 + ascii_length);
......
...@@ -160,7 +160,7 @@ void ...@@ -160,7 +160,7 @@ void
test_armor(const struct nettle_armor *armor, test_armor(const struct nettle_armor *armor,
size_t data_length, size_t data_length,
const uint8_t *data, const uint8_t *data,
const uint8_t *ascii); const char *ascii);
#if WITH_HOGWEED #if WITH_HOGWEED
#ifndef mpn_zero_p #ifndef mpn_zero_p
......
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