From 9fcb821db2f7c8e48372ee6e89fd48992d25a802 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Wed, 14 May 2025 17:27:15 -0400 Subject: tests: only define what's needed --- config.mk | 8 -------- test/pkarr.c | 2 ++ test/pkarr.cpp | 3 +++ test/pkbktarr.c | 3 +++ test/pkbktarr.cpp | 3 +++ test/pkev.c | 2 ++ test/pkev.cpp | 5 ++++- test/pkmem-types.c | 2 ++ test/pkmem.c | 5 +++++ test/pkmem.cpp | 5 ++++- test/pkstn.c | 2 ++ test/pkstn.cpp | 2 ++ test/pkstr.c | 2 ++ test/pkstr.cpp | 2 ++ test/pkuuid.c | 3 +++ test/pkuuid.cpp | 3 +++ 16 files changed, 42 insertions(+), 10 deletions(-) diff --git a/config.mk b/config.mk index 439b78d..b7a536c 100644 --- a/config.mk +++ b/config.mk @@ -16,14 +16,6 @@ LIBS = -lm \ # -pedantic SHARED_FLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \ -DVERSION=\"$(VERSION)\" -DPK_MEMORY_DEBUGGER -DPK_IMPL_ALL \ - -DPK_IMPL_MEM_TYPES \ - -DPK_IMPL_MEM \ - -DPK_IMPL_STR \ - -DPK_IMPL_EV \ - -DPK_IMPL_ARR \ - -DPK_IMPL_STN \ - -DPK_IMPL_UUID \ - -DPK_IMPL_BKTARR \ CFLAGS += -Wall -Wextra -pedantic $(INCS) $(SHARED_FLAGS) CXXFLAGS += -Wall -Wextra -pedantic $(INCS) $(SHARED_FLAGS) diff --git a/test/pkarr.c b/test/pkarr.c index c8878af..c6e09f1 100644 --- a/test/pkarr.c +++ b/test/pkarr.c @@ -2,6 +2,8 @@ // NOTE: only intended for performance testing // TODO: move flag to compiler and run tests more than once for full coverage #define PK_ARR_MOVE_IN_PLACE +#define PK_IMPL_MEM +#define PK_IMPL_ARR #include "../pkarr.h" diff --git a/test/pkarr.cpp b/test/pkarr.cpp index 9e8acf7..77cf9f4 100644 --- a/test/pkarr.cpp +++ b/test/pkarr.cpp @@ -1,4 +1,7 @@ +#define PK_IMPL_MEM +#define PK_IMPL_ARR + #include #include diff --git a/test/pkbktarr.c b/test/pkbktarr.c index 8bcb3e3..529c51b 100644 --- a/test/pkbktarr.c +++ b/test/pkbktarr.c @@ -1,4 +1,7 @@ +#include "../pkmem.h" +#define PK_IMPL_MEM +#define PK_IMPL_BKTARR #include "../pkbktarr.h" #include diff --git a/test/pkbktarr.cpp b/test/pkbktarr.cpp index e7fb5ee..8d691eb 100644 --- a/test/pkbktarr.cpp +++ b/test/pkbktarr.cpp @@ -1,4 +1,7 @@ +#include "../pkmem.h" +#define PK_IMPL_MEM +#define PK_IMPL_BKTARR #include "../pkbktarr.h" void test_spinup(struct pk_membucket **bkt_buckets, struct pk_membucket **bkt_data) diff --git a/test/pkev.c b/test/pkev.c index f28739b..e38ae9d 100644 --- a/test/pkev.c +++ b/test/pkev.c @@ -1,4 +1,6 @@ +#define PK_IMPL_EV + #include "../pkev.h" #include "../pkmacros.h" diff --git a/test/pkev.cpp b/test/pkev.cpp index ed62803..30ccbb0 100644 --- a/test/pkev.cpp +++ b/test/pkev.cpp @@ -1,10 +1,13 @@ -#include "../pkev.h" +#define PK_IMPL_EV #include "../pkmacros.h" +#include "../pkev.h" + #include #include +#include static bool expected_exit = false; static bool caught = false; diff --git a/test/pkmem-types.c b/test/pkmem-types.c index a6f0174..8ed282d 100644 --- a/test/pkmem-types.c +++ b/test/pkmem-types.c @@ -1,4 +1,6 @@ +#define PK_IMPL_MEM_TYPES + #include "../pkmem-types.h" #include "../pkmacros.h" diff --git a/test/pkmem.c b/test/pkmem.c index 024561d..78ea796 100644 --- a/test/pkmem.c +++ b/test/pkmem.c @@ -1,6 +1,11 @@ +#define PK_IMPL_MEM + #include "../pkmem.h" +#include +#include + struct mem_test { struct pk_membucket *bkt1; struct pk_membucket *bkt2; diff --git a/test/pkmem.cpp b/test/pkmem.cpp index ffc24b3..1a6dd8f 100644 --- a/test/pkmem.cpp +++ b/test/pkmem.cpp @@ -1,7 +1,10 @@ -#include +#define PK_IMPL_MEM + #include "../pkmem.h" +#include + class FreeTest { public: pk_membucket *bkt; diff --git a/test/pkstn.c b/test/pkstn.c index 032d7e2..92d982f 100644 --- a/test/pkstn.c +++ b/test/pkstn.c @@ -1,4 +1,6 @@ +#define PK_IMPL_STN + #include "../pkstn.h" #include diff --git a/test/pkstn.cpp b/test/pkstn.cpp index b6c9329..d29f216 100644 --- a/test/pkstn.cpp +++ b/test/pkstn.cpp @@ -1,4 +1,6 @@ +#define PK_IMPL_STN + #include "../pkstn.h" #include diff --git a/test/pkstr.c b/test/pkstr.c index 7b91fe7..f477e6a 100644 --- a/test/pkstr.c +++ b/test/pkstr.c @@ -1,4 +1,6 @@ +#define PK_IMPL_STR + #include "../pkstr.h" #include "../pkmacros.h" diff --git a/test/pkstr.cpp b/test/pkstr.cpp index 58b60cd..c7b55bc 100644 --- a/test/pkstr.cpp +++ b/test/pkstr.cpp @@ -1,4 +1,6 @@ +#define PK_IMPL_STR + #include "../pkstr.h" #include "../pkmacros.h" diff --git a/test/pkuuid.c b/test/pkuuid.c index 3ea66b0..8b489aa 100644 --- a/test/pkuuid.c +++ b/test/pkuuid.c @@ -1,6 +1,9 @@ // #define PK_UUID_CLOCK CLOCK_REALTIME_ALARM +#define PK_IMPL_STN +#define PK_IMPL_UUID + #include "../pkmacros.h" #include "../pkuuid.h" diff --git a/test/pkuuid.cpp b/test/pkuuid.cpp index 5755c54..b5f54e8 100644 --- a/test/pkuuid.cpp +++ b/test/pkuuid.cpp @@ -1,6 +1,9 @@ // #define PK_UUID_CLOCK CLOCK_REALTIME_ALARM +#define PK_IMPL_STN +#define PK_IMPL_UUID + #include "../pkmacros.h" #include "../pkuuid.h" -- cgit v1.2.3