aboutsummaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/math/test_subgroups.c7
-rw-r--r--test/src/test/utils.c14
-rw-r--r--test/src/test/utils.h12
3 files changed, 28 insertions, 5 deletions
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