From 17d4ef817cdd756b3a318e37af6d4596baba8773 Mon Sep 17 00:00:00 2001 From: aleck Date: Wed, 22 May 2024 10:25:18 -0600 Subject: [PATCH] Working in something --- PKGBUILD | 4 ++-- TODO | 3 ++- include/unittest_debug.h | 12 ++++++------ include/unittest_tcase.h | 2 +- test/src/test_assert.c | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 6d5135f..e11dcc7 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -13,8 +13,8 @@ # Move to the build directory pkgname=unittest-c -pkgver=1.3.1 -pkgrel=8 +pkgver=1.3.2 +pkgrel=9 epoch= pkgdesc="unittest c is a fast and simple macro-based unit testing framework for C. It's inspired by the Python unittest module and designed to reduce boilerplate code. diff --git a/TODO b/TODO index 9db2800..e4660a2 100644 --- a/TODO +++ b/TODO @@ -68,4 +68,5 @@ ---- URGENT 2024/01/278 ---- - Solve the bug of include testcases and paths from other files [X] - Solve the bug of redefinition in recompilation time [X] - +- Solve the warning bug [X] + diff --git a/include/unittest_debug.h b/include/unittest_debug.h index 3d0bd28..fde7b78 100644 --- a/include/unittest_debug.h +++ b/include/unittest_debug.h @@ -35,14 +35,14 @@ typedef struct { #define LOG_ERR(M, ...) dprintf(UNITTEST_STD_ERR, M __VA_OPT__(, ) __VA_ARGS__) /* ABORT: Abort the program and prints the error. */ -#define ABORT(M, ...) \ - do { \ +#define ABORT(M, ...) \ + do { \ LOG_ERR("Traceback...\n"); \ LOG_ERR("\tFile \"%s\", in line %i, in func \"%s\"\n", __FILE__, \ - __LINE__, __func__); \ - LOG_ERR("[ERROR]:\t " M, __VA_ARGS__); \ - LOG_ERR("\nAborting...\n"); \ - abort(); \ + __LINE__, __func__); \ + LOG_ERR("[ERROR]:\t " M __VA_OPT__(,) __VA_ARGS__); \ + LOG_ERR("\nAborting...\n"); \ + abort(); \ } while (0) /* The file descriptor to know where to send the information. */ diff --git a/include/unittest_tcase.h b/include/unittest_tcase.h index 6021573..6720dc1 100644 --- a/include/unittest_tcase.h +++ b/include/unittest_tcase.h @@ -69,7 +69,7 @@ typedef struct { UnitTestCaseFrame unitframe; \ unitframe.state = stackjmp(&unitframe.buf); \ if (unitframe.state > 1) LOG("%c", unitcase->res); \ - if (unitframe.state > unitcase->amount) return; \ + if ((size_t) unitframe.state > unitcase->amount) return; \ unitframe.counter = 0; \ do diff --git a/test/src/test_assert.c b/test/src/test_assert.c index d44a950..36c6703 100644 --- a/test/src/test_assert.c +++ b/test/src/test_assert.c @@ -21,7 +21,7 @@ TESTCASE(Checking) int var1 = 1, var2 = 2; TEST(NormalAssertion) { ASSERT(var1 != var2, "Testing the message"); } - + TEST(ComparisonAssertion) { ASSERT_EQ(var1, 3, "This is a message"); } struct person { @@ -86,7 +86,7 @@ TESTCASE(Checking) int main(void) { MUTE_ACTIVE(true); - + RUN(Checking); /* It supouse to have an failed assertion */