Test(test_str_format, hex_string_with_delimiter__single_byte__perfect) { gchar expected_output[3] = "40"; gchar output[3]; gchar input[1] = "@"; format_hex_string_with_delimiter(input, sizeof(input), output, sizeof(output), ' '); cr_expect_str_eq(output, expected_output, "format_hex_string_with_delimiter output does not match!"); }
void test_format_hex_string_with_delimiter__two_bytes__perfect() { gchar expected_output[6] = "40 41"; gchar output[6]; gchar input[2] = "@A"; //Act format_hex_string_with_delimiter(input, sizeof(input), output, sizeof(output), ' '); //Assert assert_nstring(output, sizeof(output), expected_output, sizeof(expected_output), "format_hex_string_with_delimiter output does not match in case of two bytes!", NULL); }
void test_format_hex_string_with_delimiter__single_byte__perfect() { gchar expected_output[3] = "40"; gchar output[3]; gchar input[1] = "@"; //Act format_hex_string_with_delimiter(input, sizeof(input), output, sizeof(output), ' '); //Assert assert_nstring(output, sizeof(output), expected_output, sizeof(expected_output), "format_hex_string_with_delimiter output does not match!", NULL); }
Test(test_str_format, hex_string_with_delimiter__two_bytes__perfect) { gchar expected_output[6] = "40 41"; gchar output[6]; gchar input[2] = "@A"; format_hex_string_with_delimiter(input, sizeof(input), output, sizeof(output), ' '); cr_expect_str_eq(output, expected_output, "format_hex_string_with_delimiter output does not match in case of two bytes!"); }
gchar * format_hex_string(gpointer data, gsize data_len, gchar *result, gsize result_len) { return format_hex_string_with_delimiter(data, data_len, result, result_len, 0); }