Add testcase for lowercase hex

This commit is contained in:
Nils O. Selåsdal
2013-07-07 19:44:51 +02:00
parent 648f963763
commit 3c5688ad54
+14
View File
@@ -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);