예제 #1
0
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!");
}
예제 #2
0
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);
}
예제 #3
0
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);
}
예제 #4
0
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!");
}
예제 #5
0
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);
}