#define testsuite_add_test(func) __testsuite_add_test(#func, func)
+static inline size_t testsuite_array_length(char* array[]) {
+ size_t length = 0;
+
+ for (char** line = array; *line; line++)
+ length++;
+
+ return length;
+}
+
+static inline int testsuite_compare_string_arrays(char* array1[], char* array2[]) {
+ const size_t length1 = testsuite_array_length(array1);
+ const size_t length2 = testsuite_array_length(array2);
+
+ // Check if length matches
+ if (length1 != length2) {
+ LOG_ERROR("Arrays differ in length (%zu != %zu)\n", length1, length2);
+ goto ERROR;
+ }
+
+ char** line1 = array1;
+ char** line2 = array2;
+ size_t num = 0;
+
+ // Check if all lines match
+ for (; *line1 && *line2; line1++, line2++, num++) {
+ if (strcmp(*line1, *line2) != 0) {
+ LOG_ERROR("Line %zu does not match\n", num);
+ goto ERROR;
+ }
+ }
+
+ // Success
+ return 0;
+
+ERROR:
+ // Dump both arrays
+ for (line1 = array1, line2 = array2, num = 0; *line1 && *line2; line1++, line2++, num++) {
+ printf("Line %zu:\n");
+ printf(" 1: %s", *line1);
+ printf(" 2: %s", *line2);
+ }
+
+ return 1;
+}
+
#define ASSERT(expr) \
do { \
if ((!(expr))) { \
} \
} while (0)
+#define ASSERT_STRING_ARRAY_EQUALS(array1, array2) \
+ do { \
+ if (testsuite_compare_string_arrays(array1, array2)) { \
+ LOG_ERROR("Failed assertion: " #array1 " != " #array2 " %s:%d %s\n", \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ goto FAIL; \
+ } \
+ } while(0)
+
#define ASSERT_STRING_NOT_EQUALS(value1, value2) \
do { \
if (strcmp(value1, value2) == 0) { \