summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/test_chunk.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
commit5313d2d78ca150515f7f5eb39801c100690b6b29 (patch)
treec78e420367283bb1b16f14210b12687cdfbd26eb /src/libstrongswan/tests/test_chunk.c
parent6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff)
downloadvyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz
vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libstrongswan/tests/test_chunk.c')
-rw-r--r--src/libstrongswan/tests/test_chunk.c21
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);