Function Macro

GLibassert_cmpstr

since: 2.16

Declaration

#define g_assert_cmpstr (
  s1,
  cmp,
  s2
)

Description

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

This function is not directly available to language bindings.

Parameters

s1

Type: -

A string (may be NULL)

cmp

Type: -

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

s2

Type: -

Another string (may be NULL)