diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | test/src/math/test_subgroups.c | 7 | ||||
| -rw-r--r-- | test/src/test/utils.c | 14 | ||||
| -rw-r--r-- | test/src/test/utils.h | 12 |
4 files changed, 30 insertions, 8 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3def321..066defb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,12 +4,11 @@ project(test_ecgen C) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/criterion/include) -message("${CMAKE_LIBRARY_PATH}") - find_library(criterion NAMES criterion PATHS ${CMAKE_CURRENT_SOURCE_DIR}/lib/criterion/build) file(GLOB TEST_SRC "src/math/*.c" "src/gen/*.c" "src/cm/*.c" "src/invalid/*.c" "src/io/*.c" "src/exhaustive/*.c" "src/util/*.c") -add_executable(test_ecgen ${TEST_SRC} ${SRC}) +file(GLOB TESTING_SRC "src/test/*.c") +add_executable(test_ecgen ${TEST_SRC} ${TESTING_SRC} ${SRC}) target_link_libraries(test_ecgen pthread rt pari ${parson} ${sha1} ${criterion}) diff --git a/test/src/math/test_subgroups.c b/test/src/math/test_subgroups.c index fa81788..ad42282 100644 --- a/test/src/math/test_subgroups.c +++ b/test/src/math/test_subgroups.c @@ -5,12 +5,9 @@ #include "gen/types.h" #include "math/subgroups.h" #include <criterion/criterion.h> +#include "test/utils.h" -void setup(void) { - pari_init(1000000000, 1000000); -} - -TestSuite(subgroups, .init=setup); +TestSuite(subgroups, .init=default_setup, .fini=default_teardown); Test(subgroups, test_prime_factors) { curve_t curve = {.order = stoi(12)}; diff --git a/test/src/test/utils.c b/test/src/test/utils.c new file mode 100644 index 0000000..a8a11db --- /dev/null +++ b/test/src/test/utils.c @@ -0,0 +1,14 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ +#include "utils.h" +#include <pari/pari.h> + +void default_setup(void) { + pari_init(1000000, 1000000); +} + +void default_teardown(void) { + pari_close(); +}
\ No newline at end of file diff --git a/test/src/test/utils.h b/test/src/test/utils.h new file mode 100644 index 0000000..2780bd2 --- /dev/null +++ b/test/src/test/utils.h @@ -0,0 +1,12 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ +#ifndef ECGEN_UTILS_H +#define ECGEN_UTILS_H + +void default_setup(void); + +void default_teardown(void); + +#endif //ECGEN_UTILS_H |
