From be48aad4ec594efd36c345f2a0055e6b4dc85e0d Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 29 Aug 2022 09:47:58 +0200 Subject: [PATCH] refactor(test): use simpler ASSERT wrapper --- README.md | 4 ++-- tests/t-assert.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bb5d11a..f5afb5b 100644 --- a/README.md +++ b/README.md @@ -314,9 +314,9 @@ The `CLUTHFUNC` macro allows to wrap any function within the current logger. For instance, this can be useful if you want to (de)clutch calls to `assert`s. To do that, just declare your own macro: ```cpp -#define ASSERT(LEVEL, ...) { CLUTCHFUNC(LEVEL, assert, __VA_ARGS__) } +#define ASSERT(...) { CLUTCHFUNC(error, assert, __VA_ARGS__) } ``` -Thus, any call like `ASSERT(error, x > 3);` will be declutchable +Thus, any call like `ASSERT(x > 3);` will be declutchable with the same configuration than a call to `CLUTCHLOG`. diff --git a/tests/t-assert.cpp b/tests/t-assert.cpp index 28ea449..b08d238 100644 --- a/tests/t-assert.cpp +++ b/tests/t-assert.cpp @@ -4,26 +4,26 @@ #include "../clutchlog/clutchlog.h" // Make asserts (de)clutchable. -#define ASSERT(LEVEL, ...) CLUTCHFUNC(LEVEL, assert, __VA_ARGS__); +#define ASSERT(...) CLUTCHFUNC(error, assert, __VA_ARGS__); void h() { CLUTCHLOG(info, "!"); - ASSERT(info, true == true); + ASSERT(true == true); std::clog << "--" << std::endl; } void g() { CLUTCHLOG(warning, "world"); - ASSERT(warning, strcmp("life","life") == 0); + ASSERT(strcmp("life","life") == 0); h(); } void f() { CLUTCHLOG(error, "hello "); - ASSERT(error, strcmp("no more","please")!=0); + ASSERT(strcmp("no more","please")!=0); g(); }