Function Macro

GLibassert_cmpstrv

since: 2.68

Declaration

#define g_assert_cmpstrv (
  strv1,
  strv2
)

Description

Debugging macro to check if two NULL-terminated string arrays (i.e. 2 GStrv) are equal. If they are not equal, an error message is logged and the application is either terminated or the testcase marked as failed. If both arrays are NULL, the check passes. If one array is NULL but the other is not, an error message is logged.

The effect of g_assert_cmpstrv (strv1, strv2) is the same as g_assert_true (g_strv_equal (strv1, strv2)) (if both arrays are not NULL). The advantage of this macro is that it can produce a message that includes how strv1 and strv2 are different.

  const char *expected[] = { "one", "two", "three", NULL };
  g_assert_cmpstrv (mystrv, expected);

Available since: 2.68

This function is not directly available to language bindings.

Parameters

strv1

Type: -

A string array (may be NULL)

strv2

Type: -

Another string array (may be NULL)