Function Macro

GLibassert_cmpstr

since: 2.16

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 [GLib.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.

cmp

Type: -

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

s2

Type: -

Another string.