Add testcase for lowercase hex
This commit is contained in:
@@ -164,6 +164,18 @@ START_TEST (test_uc_hex_encode_delim_zero_len)
|
|||||||
END_TEST
|
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 *hex_suite(void)
|
||||||
{
|
{
|
||||||
Suite *s = suite_create("hex");
|
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_invalid);
|
||||||
tcase_add_test(tc, test_uc_hex_decode_empty_string);
|
tcase_add_test(tc, test_uc_hex_decode_empty_string);
|
||||||
|
|
||||||
|
tcase_add_test(tc, test_uc_hex_decode_lowercase);
|
||||||
|
|
||||||
|
|
||||||
suite_add_tcase(s, tc);
|
suite_add_tcase(s, tc);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user