Skip to content

Commit

Permalink
clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anotra committed Mar 15, 2024
1 parent 811d9ea commit 1233985
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
12 changes: 6 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
project(anotest)
add_executable(${PROJECT_NAME} main.c
locks-pthread.c
ordering.c
)
add_executable(${PROJECT_NAME} main.c)
target_link_libraries(${PROJECT_NAME} PRIVATE anomap)


if (WITH_LOCKS)
add_test(locks ${PROJECT_NAME} locks)
if (CMAKE_USE_PTHREADS_INIT)
target_sources(${PROJECT_NAME} PRIVATE locks-pthread.c)
add_test(locks ${PROJECT_NAME} locks)
endif()
endif()

target_sources(${PROJECT_NAME} PRIVATE ordering.c)
add_test(ordering ${PROJECT_NAME} ordering)
20 changes: 7 additions & 13 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@
#include <stdio.h>
#include <string.h>

#define TEST_FUNC(name) \
int test_ ## name(void)


TEST_FUNC(locks);
TEST_FUNC(ordering);


#define TEST_FEATURE(name)\
do {\
if (0 == strcmp(#name, argv[1])) {\
return test_ ## name();\
}\
#define TEST_FEATURE(name) \
do { \
int test_ ## name(void); \
if (0 == strcmp(#name, argv[1])) \
return test_ ## name(); \
} while (0)

int main(int argc, char *argv[]) {
if (argc != 2)
return 1;

TEST_FEATURE(locks);
TEST_FEATURE(ordering);

return -1;
}

0 comments on commit 1233985

Please sign in to comment.