test_success = FALSE;
}
-void test_assert_failed_strcmp(const char *code, const char *file, unsigned int line,
- const char * src, const char * dst)
+void test_assert_failed_strcmp_idx(const char *code, const char *file, unsigned int line,
+ const char * src, const char * dst, long long i)
{
- printf("%s: Assert(#%u) failed: %s\n", file, line, code);
+ printf("%s:%u: Assert", file, line);
+ if (i == LLONG_MIN)
+ printf(" failed: %s\n", code);
+ else
+ printf("(#%lld) failed: %s\n", i, code);
if (src != NULL)
printf(" \"%s\" != ", src);
else
* in strcmp().
*/
#define test_assert_strcmp(s1, s2) STMT_START { \
- if ((null_strcmp(s1,s2) != 0)) test_assert_failed_strcmp("strcmp(" #s1 "," #s2 ")", __FILE__, __LINE__, s1, s2); \
+ test_assert_strcmp_idx(s1, s2, LLONG_MIN); \
+ } STMT_END
+
+/* Same as test_assert_strcmp expect that it takes an additional i as input.
+ * When i is greater than or equals 0 it is used to identify the barrage of
+ * tests failed like in test_assert_idx.
+*/
+#define test_assert_strcmp_idx(s1, s2, i) STMT_START { \
+ if ((null_strcmp(s1,s2) != 0)) test_assert_failed_strcmp_idx("strcmp(" #s1 "," #s2 ")", __FILE__, __LINE__, s1, s2, i); \
} STMT_END
void test_assert_failed(const char *code, const char *file, unsigned int line);
void test_assert_failed_idx(const char *code, const char *file, unsigned int line, long long i);
-void test_assert_failed_strcmp(const char *code, const char *file, unsigned int line,
- const char * src, const char * dst);
+void test_assert_failed_strcmp_idx(const char *code, const char *file, unsigned int line,
+ const char * src, const char * dst, long long i);
bool test_has_failed(void);
/* If you're testing nasty cases which you want to warn, surround the noisy op with these */
void test_expect_errors(unsigned int expected);