diff options
Diffstat (limited to 'src/libstrongswan/tests/test_chunk.c')
-rw-r--r-- | src/libstrongswan/tests/test_chunk.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/libstrongswan/tests/test_chunk.c b/src/libstrongswan/tests/test_chunk.c index 7f07d057b..8e29971c1 100644 --- a/src/libstrongswan/tests/test_chunk.c +++ b/src/libstrongswan/tests/test_chunk.c @@ -756,11 +756,12 @@ END_TEST static struct { chunk_t in; char *out; + char *out_plus; } printf_hook_data[] = { - {chunk_from_chars(), ""}, - {chunk_from_chars(0x00), "00"}, - {chunk_from_chars(0x00, 0x01), "00:01"}, - {chunk_from_chars(0x00, 0x01, 0x02), "00:01:02"}, + {chunk_from_chars(), "", ""}, + {chunk_from_chars(0x00), "00", "00"}, + {chunk_from_chars(0x00, 0x01), "00:01", "0001"}, + {chunk_from_chars(0x00, 0x01, 0x02), "00:01:02", "000102"}, }; START_TEST(test_printf_hook_hash) @@ -774,6 +775,17 @@ START_TEST(test_printf_hook_hash) } END_TEST +START_TEST(test_printf_hook_plus) +{ + char buf[16]; + int len; + + len = snprintf(buf, sizeof(buf), "%+B", &printf_hook_data[_i].in); + ck_assert(len >= 0 && len < sizeof(buf)); + ck_assert_str_eq(buf, printf_hook_data[_i].out_plus); +} +END_TEST + START_TEST(test_printf_hook) { char buf[128], mem[128]; @@ -856,6 +868,7 @@ Suite *chunk_suite_create() tc = tcase_create("printf_hook"); tcase_add_loop_test(tc, test_printf_hook_hash, 0, countof(printf_hook_data)); + tcase_add_loop_test(tc, test_printf_hook_plus, 0, countof(printf_hook_data)); tcase_add_loop_test(tc, test_printf_hook, 0, countof(printf_hook_data)); suite_add_tcase(s, tc); |