Function Macro

GLibassert_cmpstr

Declaration [src]

#define g_assert_cmpstr (
  s1,
  cmp,
  s2
)

Description [src]

Debugging macro to compare two strings. If the comparison fails, an error message is logged and the application is either terminated or the testcase marked as failed. The strings are compared using g_strcmp0().

The effect of g_assert_cmpstr (s1, op, s2) is the same as g_assert_true (g_strcmp0 (s1, s2) op 0). The advantage of this macro is that it can produce a message that includes the actual values of s1 and s2.

  g_assert_cmpstr (mystring, ==, "fubar");
Available since:2.16

Parameters

s1 -
 

A string (may be NULL)

cmp -
 

The comparison operator to use. One of ==, !=, <, >, <=, >=.

s2 -
 

Another string (may be NULL)