From 3c5688ad54100c4314631b6895c360c6e2cb5825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Sun, 7 Jul 2013 19:44:51 +0200 Subject: [PATCH] Add testcase for lowercase hex --- test/test_hex.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test_hex.c b/test/test_hex.c index 87ca984..39250c9 100644 --- a/test/test_hex.c +++ b/test/test_hex.c @@ -164,6 +164,18 @@ START_TEST (test_uc_hex_encode_delim_zero_len) END_TEST +START_TEST (test_uc_hex_decode_lowercase) + char hex[] = "1f"; + uint8_t binary[2] = {0x11,0x22}; + uint8_t *res; + + res = uc_hex_decode(hex, 2, binary); + + fail_if(binary[0] != 0x1f); + fail_if(binary[1] != 0x22); + fail_if(res != binary + 1, "binary %p, res %p", &binary[0], res); + +END_TEST Suite *hex_suite(void) { Suite *s = suite_create("hex"); @@ -185,6 +197,8 @@ Suite *hex_suite(void) tcase_add_test(tc, test_uc_hex_decode_invalid); tcase_add_test(tc, test_uc_hex_decode_empty_string); + tcase_add_test(tc, test_uc_hex_decode_lowercase); + suite_add_tcase(s, tc);