From 91264d96e42fe8b79e6f7d342fc832c656f5c632 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 5 Feb 2026 05:16:11 +0000 Subject: [PATCH] test: Added definition to make default testing less verbose TEST_VERBOSE is a preprocesser directive which TEST is dependent on. By default it is 0, in which case TEST simply fails if the condition is not true. Otherwise, a full log (as done previously) is made. --- test/test.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test.h b/test/test.h index 3fe2556..ebc7d6d 100644 --- a/test/test.h +++ b/test/test.h @@ -10,7 +10,12 @@ #include +#ifndef TEST_VERBOSE +#define TEST_VERBOSE 0 +#endif + #define TEST_PASSED() printf("\t[%s]: Passed\n", __func__) +#if TEST_VERBOSE #define TEST(COND, ...) \ do \ { \ @@ -30,6 +35,16 @@ assert(0); \ } \ } while (0) +#else +#define TEST(COND, ...) \ + do \ + { \ + if (!(COND)) \ + { \ + assert(0); \ + } \ + } while (0) +#endif typedef struct TestFn {