diff test/test_compare.h @ 9:6ff0b7a44bb6

generic: add initial support for 256-bit and 512-bit types eventually this could be expanded to add floating point stuff as well
author Paper <paper@tflc.us>
date Mon, 18 Nov 2024 13:52:09 -0500
parents 75ab77f874e2
children d1d5d767004c
line wrap: on
line diff
--- a/test/test_compare.h	Wed Oct 23 19:05:34 2024 -0400
+++ b/test/test_compare.h	Mon Nov 18 13:52:09 2024 -0500
@@ -23,21 +23,31 @@
 		return 0; \
 	}
 
-#define CREATE_TESTS(sign, psign, bits, size) \
+#define CREATE_TESTS_SIGN(sign, psign, bits, size) \
 	CREATE_TEST(sign, psign, bits, size, cmplt, orig_a[i] < orig_b[i]) \
 	CREATE_TEST(sign, psign, bits, size, cmpgt, orig_a[i] > orig_b[i]) \
 	CREATE_TEST(sign, psign, bits, size, cmpeq, orig_a[i] == orig_b[i]) \
 	CREATE_TEST(sign, psign, bits, size, cmple, orig_a[i] <= orig_b[i]) \
 	CREATE_TEST(sign, psign, bits, size, cmpge, orig_a[i] >= orig_b[i])
 
-#define CREATE_TESTS_2(bits, size) CREATE_TESTS(, d, bits, size) CREATE_TESTS(u, u, bits, size)
+#define CREATE_TESTS(bits, size) CREATE_TESTS_SIGN(, d, bits, size) CREATE_TESTS_SIGN(u, u, bits, size)
+
+CREATE_TESTS(8, 16)
+CREATE_TESTS(16, 8)
+CREATE_TESTS(32, 4)
+CREATE_TESTS(64, 2)
 
-CREATE_TESTS_2(8, 16)
-CREATE_TESTS_2(16, 8)
-CREATE_TESTS_2(32, 4)
-CREATE_TESTS_2(64, 2)
+CREATE_TESTS(8, 32)
+CREATE_TESTS(16, 16)
+CREATE_TESTS(32, 8)
+CREATE_TESTS(64, 4)
 
-#undef CREATE_TESTS_2
+CREATE_TESTS(8, 64)
+CREATE_TESTS(16, 32)
+CREATE_TESTS(32, 16)
+CREATE_TESTS(64, 8)
+
+#undef CREATE_TESTS_SIGN
 #undef CREATE_TESTS
 #undef CREATE_TEST
 
@@ -45,7 +55,7 @@
 {
 	int ret = 0;
 
-#define RUN_TESTS(sign, bits, size) \
+#define RUN_TESTS_SIGN(sign, bits, size) \
 	for (size_t i = 0U; i < ARRAY_SIZE(testval##sign##bits); i++) { \
 		const v##sign##int##bits##x##size a = vtest##sign##bits##x##size(i); \
 		for (size_t j = 0U; j < ARRAY_SIZE(testval##sign##bits); j++) { \
@@ -58,16 +68,26 @@
 		} \
 	}
 
-#define RUN_TESTS_2(bits, size) \
-	RUN_TESTS( , bits, size) \
-	RUN_TESTS(u, bits, size)
+#define RUN_TESTS(bits, size) \
+	RUN_TESTS_SIGN( , bits, size) \
+	RUN_TESTS_SIGN(u, bits, size)
+
+	RUN_TESTS(8, 16)
+	RUN_TESTS(16, 8)
+	RUN_TESTS(32, 4)
+	RUN_TESTS(64, 2)
 
-	RUN_TESTS_2(8, 16)
-	RUN_TESTS_2(16, 8)
-	RUN_TESTS_2(32, 4)
-	RUN_TESTS_2(64, 2)
+	RUN_TESTS(8, 32)
+	RUN_TESTS(16, 16)
+	RUN_TESTS(32, 8)
+	RUN_TESTS(64, 4)
 
-#undef RUN_TESTS_2
+	RUN_TESTS(8, 64)
+	RUN_TESTS(16, 32)
+	RUN_TESTS(32, 16)
+	RUN_TESTS(64, 8)
+
+#undef RUN_TESTS_SIGN
 #undef RUN_TESTS
 
 	return ret;