-#define STREQ(expect, actual) do { \
- if (strcmp (expect, actual) != 0) { \
- printf ("not ok %i - %s incorrect: expected \"%s\", got \"%s\"\n", \
- ++check_count__, #actual, expect, actual); \
- return (-1); \
- } \
- printf ("ok %i - %s evaluates to \"%s\"\n", ++check_count__, #actual, expect); \
-} while (0)
-
-#define EXPECT_EQ(expect, actual, format) do { \
- if ((expect) != (actual)) {\
- printf ("not ok %i - %s incorrect: expected " format ", got " format "\n", \
- ++check_count__, #actual, expect, actual); \
+#define EXPECT_EQ_STR(expect, actual) do { \
+ /* Evaluate 'actual' only once. */ \
+ const char *got__ = actual; \
+ if (strcmp (expect, got__) != 0) { \
+ printf ("not ok %i - %s = \"%s\", want \"%s\"\n", \
+ ++check_count__, #actual, got__, expect); \