From 161c3f0d10e4b93697267ed04b28e7285611a7eb Mon Sep 17 00:00:00 2001
From: shmibs <shmibs@gmail.com>
Date: Tue, 22 Dec 2015 13:38:17 -0700
Subject: handle NULL in str / wstr

---
 src/simple-test.h | 181 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 107 insertions(+), 74 deletions(-)

(limited to 'src')

diff --git a/src/simple-test.h b/src/simple-test.h
index 4480ac8..cb24bc6 100644
--- a/src/simple-test.h
+++ b/src/simple-test.h
@@ -132,7 +132,7 @@ void simple_test_get_escape_wide(wchar_t c, wchar_t *buf)
 do { \
 	{ \
 		printf("\e[1m    :: "); \
-		printf(file); \
+		printf("%s", file); \
 		printf(":%i: \e[31;1mfail:\e[m ", line); \
 		printf(summary); \
 		printf("\e[m\n"); \
@@ -142,23 +142,26 @@ do { \
 	} \
 } while(0)
 
-#define SIMPLE_TEST_FAIL(summary, file, line, fmt, sarg1, sarg2, arg1, arg2) \
+#define SIMPLE_TEST_FAIL(summary, file, line, fmt1, fmt2, sarg1, sarg2, arg1, arg2) \
 do { \
 	{ \
 		int simple_test_i, simple_test_diff = SIMPLE_TEST_LEN_DIFF(sarg1, sarg2); \
 		printf("\e[1m    :: "); \
-		printf(file); \
+		printf("%s", file); \
 		printf(":%i: \e[31;1mfail:\e[m ", line); \
 		printf(summary); \
 		printf("\e[m\n"); \
 		printf("\e[1m    :: "); \
 		for(simple_test_i = 0; simple_test_i < -simple_test_diff; simple_test_i++) \
 			printf(" "); \
-		printf("%s == \e[m" fmt "\n", sarg1, arg1); \
-		printf("\e[1m    :: "); \
+		printf("%s == \e[m", sarg1); \
+		printf(fmt1, arg1); \
+		printf("\n\e[1m    :: "); \
 		for(simple_test_i = 0; simple_test_i < simple_test_diff; simple_test_i++) \
 			printf(" "); \
-		printf("%s == \e[m" fmt "\n", sarg2, arg2); \
+		printf("%s == \e[m", sarg2); \
+		printf(fmt2, arg2); \
+		printf("\n"); \
 		exit(1); \
 	} \
 } while(0)
@@ -184,13 +187,13 @@ void simple_test_assert_bool(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("bool values do not match", file, line,
-						"%s", sarg1, sarg2,
+						"%s", "%s", sarg1, sarg2,
 						arg1 ? "true" : "false", arg2 ? "true" : "false");
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("bool values match", file, line,
-						"%s", sarg1, sarg2,
+						"%s", "%s", sarg1, sarg2,
 						arg1 ? "true" : "false", arg2 ? "true" : "false");
 			break;
 		default:
@@ -211,32 +214,32 @@ void simple_test_assert_int(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("int values do not match", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("int values match", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"%" PRIiMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIiMAX, "%" PRIiMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -256,32 +259,32 @@ void simple_test_assert_uint(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("uint values do not match", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("uint values match", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"%" PRIuMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIuMAX, "%" PRIuMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -301,32 +304,32 @@ void simple_test_assert_hex(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("uint values do not match", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("uint values match", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"%" PRIxMAX, sarg1, sarg2, arg1, arg2);
+						"%" PRIxMAX, "%" PRIxMAX, sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -346,32 +349,32 @@ void simple_test_assert_float(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("float values do not match", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("float values match", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"%Lg", sarg1, sarg2, arg1, arg2);
+						"%Lg", "%Lg", sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -391,32 +394,32 @@ void simple_test_assert_ptr(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("pointer values do not match", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("pointer values match", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"%p", sarg1, sarg2, arg1, arg2);
+						"%p", "%p", sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -440,32 +443,32 @@ void simple_test_assert_char(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("char values do not match", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("char values match", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"‘%s’", sarg1, sarg2, buf1, buf2);
+						"‘%s’", "‘%s’", sarg1, sarg2, buf1, buf2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -476,41 +479,58 @@ void simple_test_assert_str(char *sarg1, char *sarg2,
 		char *arg1, char *arg2,
 		const char *file, const int line, simple_test_cond_t cond)
 {
+	bool barg1 = (arg1 == NULL ? true : false);
+	bool barg2 = (arg2 == NULL ? true : false);
+	arg1 = (arg1 == NULL ? "(nil)" : arg1);
+	arg2 = (arg2 == NULL ? "(nil)" : arg2);
+
 	switch(cond) {
 		case SIMPLE_TEST_TRUE:
-			if(arg2 == NULL)
+			if(!strcmp(arg2, "(nil)"))
 				SIMPLE_TEST_FAIL_ONE("unexpected NULL string", file, line,
-						"‘%s’", sarg2, arg2);
+						"%s", sarg2, arg2);
 			break;
 		case SIMPLE_TEST_EQ:
 			if( strcmp(arg1, arg2) )
 				SIMPLE_TEST_FAIL("strings do not match", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if( !strcmp(arg1, arg2) )
 				SIMPLE_TEST_FAIL("strings match", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if( strcmp(arg1, arg2) <= 0)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if( strcmp(arg1, arg2) < 0)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if( strcmp(arg1, arg2) >= 0)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if( strcmp(arg1, arg2) > 0)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"‘%s’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%s" : "‘%s’"),
+						(barg2 ? "%s" : "‘%s’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -534,32 +554,32 @@ void simple_test_assert_wchar(char *sarg1, char *sarg2,
 		case SIMPLE_TEST_EQ:
 			if(arg1 != arg2)
 				SIMPLE_TEST_FAIL("char values do not match", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if(arg1 == arg2)
 				SIMPLE_TEST_FAIL("char values match", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_G:
 			if(arg1 <= arg2)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if(arg1 < arg2)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_L:
 			if(arg1 >= arg2)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if(arg1 > arg2)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"‘%ls’", sarg1, sarg2, buf1, buf2);
+						"‘%ls’", "‘%ls’", sarg1, sarg2, buf1, buf2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
@@ -570,59 +590,76 @@ void simple_test_assert_wstr(char *sarg1, char *sarg2,
 		wchar_t *arg1, wchar_t *arg2,
 		const char *file, const int line, simple_test_cond_t cond)
 {
+	bool barg1 = (arg1 == NULL ? true : false);
+	bool barg2 = (arg2 == NULL ? true : false);
+	arg1 = (arg1 == NULL ? L"(nil)" : arg1);
+	arg2 = (arg2 == NULL ? L"(nil)" : arg2);
+
 	switch(cond) {
 		case SIMPLE_TEST_TRUE:
-			if(arg2 == NULL)
+			if(!wcscmp(arg2, L"(nil)"))
 				SIMPLE_TEST_FAIL_ONE("unexpected NULL string", file, line,
-						"‘%ls’", sarg2, arg2);
+						"%ls", sarg2, arg2);
 			break;
 		case SIMPLE_TEST_EQ:
 			if( wcscmp(arg1, arg2) )
 				SIMPLE_TEST_FAIL("strings do not match", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_NEQ:
 			if( !wcscmp(arg1, arg2) )
 				SIMPLE_TEST_FAIL("strings match", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_G:
 			if( wcscmp(arg1, arg2) <= 0)
 				SIMPLE_TEST_FAIL("arg1 <= arg2", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_GEQ:
 			if( wcscmp(arg1, arg2) < 0)
 				SIMPLE_TEST_FAIL("arg1 < arg2", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_L:
 			if( wcscmp(arg1, arg2) >= 0)
 				SIMPLE_TEST_FAIL("arg1 >= arg2", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		case SIMPLE_TEST_LEQ:
 			if( wcscmp(arg1, arg2) > 0)
 				SIMPLE_TEST_FAIL("arg1 > arg2", file, line,
-						"‘%ls’", sarg1, sarg2, arg1, arg2);
+						(barg1 ? "%ls" : "‘%ls’"),
+						(barg2 ? "%ls" : "‘%ls’"),
+						sarg1, sarg2, arg1, arg2);
 			break;
 		default:
 			SIMPLE_TEST_INTERN_ERR(file, line);
 	}
 }
 
+/* reporting bool as SIMPLE_TEST_INT because that's how the compiler
+ * sees true / false constants */
 #define SIMPLE_TEST_TYPE_ENUM_VAL(arg) \
 	_Generic((arg), \
-			bool: SIMPLE_TEST_BOOL, \
+			bool: SIMPLE_TEST_INT, \
 			int8_t: SIMPLE_TEST_INT, int16_t: SIMPLE_TEST_INT, \
 			int32_t: SIMPLE_TEST_INT, int64_t: SIMPLE_TEST_INT, \
 			uint8_t: SIMPLE_TEST_UINT, uint16_t: SIMPLE_TEST_UINT, \
 			uint32_t: SIMPLE_TEST_UINT, uint64_t: SIMPLE_TEST_UINT, \
 			float: SIMPLE_TEST_FLOAT, double: SIMPLE_TEST_FLOAT, \
 			long double: SIMPLE_TEST_FLOAT, \
-			void*: SIMPLE_TEST_PTR, \
-			char*: SIMPLE_TEST_STR, \
-			wchar_t*: SIMPLE_TEST_WSTR \
+			default: SIMPLE_TEST_DEFAULT \
 			)
 
 #define SIMPLE_TEST_TYPE_CHECK(arg1, arg2) \
@@ -637,7 +674,6 @@ do { \
 
 #define SIMPLE_TEST_GENERIC_CAST(arg) \
 	_Generic((arg), \
-			bool: (bool)(arg), \
 			int8_t: (intmax_t)(arg), int16_t: (intmax_t)(arg), int32_t: (intmax_t)(arg), \
 			int64_t: (intmax_t)(arg), \
 			uint8_t: (uintmax_t)(arg), uint16_t: (uintmax_t)(arg), uint32_t: (uintmax_t)(arg), \
@@ -648,7 +684,6 @@ do { \
 
 #define SIMPLE_TEST_GENERIC_NOT(arg) \
 	_Generic((arg), \
-			bool: false, \
 			int8_t: 0, int16_t: 0, int32_t: 0, int64_t: 0, \
 			uint8_t: 0, uint16_t: 0, uint32_t: 0, uint64_t: 0, \
 			float: 0.0, double: 0.0, \
@@ -657,7 +692,6 @@ do { \
 
 #define SIMPLE_TEST_GENERIC_NOT_STR(arg) \
 	_Generic((arg), \
-			bool: "false", \
 			int8_t: "0", int16_t: "0", int32_t: "0", int64_t: "0", \
 			uint8_t: "0", uint16_t: "0", uint32_t: "0", uint64_t: "0", \
 			float: "0.0", double: "0.0", \
@@ -666,7 +700,6 @@ do { \
 
 #define SIMPLE_TEST_GENERIC_FUNCCALL(sarg1, sarg2, arg1, arg2, cond) \
 	_Generic((arg2), \
-			bool: simple_test_assert_bool, \
 			int8_t: simple_test_assert_int, int16_t: simple_test_assert_int, \
 			int32_t: simple_test_assert_int, int64_t: simple_test_assert_int, \
 			uint8_t: simple_test_assert_uint, uint16_t: simple_test_assert_uint, \
-- 
cgit v1.2.3