From 77906205b5f75077c3a4f9426fd6d14f32696a9d Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 6 Oct 2019 21:20:39 +0200 Subject: [PATCH] test/check: Add check_failed func --- src/test/test/check.c | 6 ++++++ src/test/test/check.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/test/test/check.c b/src/test/test/check.c index 9f40063..8d6e9aa 100644 --- a/src/test/test/check.c +++ b/src/test/test/check.c @@ -139,4 +139,10 @@ void _Noreturn check_null_failed(const char *file, int line, const char *func, "\tValue is not null: %s\n" "\tExpected null value\n\n", expr); +} + +void _Noreturn check_failed(const char *file, int line, + const char *func, char *expr) +{ + fail(file, line, func, "\t%s\n", expr); } \ No newline at end of file diff --git a/src/test/test/check.h b/src/test/test/check.h index 7bb8b59..ac88a92 100644 --- a/src/test/test/check.h +++ b/src/test/test/check.h @@ -109,6 +109,16 @@ } \ } \ +#define check_fail() \ + { \ + check_failed(__FILE__, __LINE__, __func__, ""); \ + } \ + +#define check_fail_msg(expr) \ + { \ + check_failed(__FILE__, __LINE__, __func__, expr); \ + } \ + void _Noreturn check_char_eq_failed(const char *file, int line, const char *func, char *expr, char result, char expected); void _Noreturn check_char_neq_failed(const char *file, int line, @@ -132,5 +142,7 @@ void _Noreturn check_non_null_failed(const char *file, int line, const char *fun char *expr); void _Noreturn check_null_failed(const char *file, int line, const char *func, char *expr); +void _Noreturn check_failed(const char *file, int line, + const char *func, char *expr); #endif \ No newline at end of file