aboutsummaryrefslogtreecommitdiff
path: root/tests/test.h
diff options
context:
space:
mode:
authorDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-12 14:19:24 +0100
committerDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-12 14:19:24 +0100
commit616ff505f666d4d162e5d2d8c0238f8af6f79c40 (patch)
treebd475af1d3c7b200d38e6769d33c1bed77384d15 /tests/test.h
parent83eee4d23f9da9e72238dd01d43b350ed5bc04f1 (diff)
downloadunja-616ff505f666d4d162e5d2d8c0238f8af6f79c40.tar.gz
unja-616ff505f666d4d162e5d2d8c0238f8af6f79c40.zip
add first template tests
Diffstat (limited to 'tests/test.h')
-rw-r--r--tests/test.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test.h b/tests/test.h
index 05c35b9..d0c0e0a 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -6,11 +6,12 @@
#define START_TESTS int main() {
#define END_TESTS }
#define TEST(name) strcpy(current_test, #name);
+#define assert_str(actual, expected) _assert(strcmp(actual, expected) == 0, __FILE__, __LINE__, "invalid string: expected %s, got %s", expected, actual)
+#define assert(assertion, format, ...) _assert(assertion, __FILE__, __LINE__, format, ##__VA_ARGS__)
/* used to store the running test name */
char current_test[256] = {'\0'};
-#define assert(assertion, format, ...) _assert(assertion, __FILE__, __LINE__, format, ##__VA_ARGS__)
static void _assert(int assertion, const char filename[64], const int line, char *format, ...)
{
if (assertion)