aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJ08nY2018-07-02 18:49:54 +0200
committerJ08nY2018-07-02 18:49:54 +0200
commite751fe4351bbbf8f4fb0932ed9f01c9ecfae22f4 (patch)
tree4ebd829b3ec6bdc62bc40a4126cb7529684dd0d4 /test
parent26d89788658df8a65eebc64eff021882efc1e819 (diff)
downloadecgen-e751fe4351bbbf8f4fb0932ed9f01c9ecfae22f4.tar.gz
ecgen-e751fe4351bbbf8f4fb0932ed9f01c9ecfae22f4.tar.zst
ecgen-e751fe4351bbbf8f4fb0932ed9f01c9ecfae22f4.zip
Diffstat (limited to 'test')
-rw-r--r--test/src/exhaustive/test_supersingular.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/src/exhaustive/test_supersingular.c b/test/src/exhaustive/test_supersingular.c
new file mode 100644
index 0000000..c93944f
--- /dev/null
+++ b/test/src/exhaustive/test_supersingular.c
@@ -0,0 +1,25 @@
+/*
+ * ecgen, tool for generating Elliptic curve domain parameters
+ * Copyright (C) 2017-2018 J08nY
+ */
+
+#include <criterion/criterion.h>
+#include "exhaustive/supersingular.h"
+#include "test/default.h"
+
+TestSuite(supersingular, .init = default_setup, .fini = default_teardown);
+
+Test(supersingular, test_supersingular_gen_eq) {
+ GEN p = strtoi("0xebc040451686221f");
+ curve_t curve = {.field = p};
+
+ int ret = supersingular_gen_equation(&curve, NULL, OFFSET_B);
+ cr_assert_eq(ret, 1, );
+ cr_assert_not_null(curve.a, );
+ cr_assert_not_null(curve.b, );
+
+ GEN e = ellinit(mkvec2(curve.a, curve.b), p, -1);
+ cr_assert_neq(glength(e), 0, );
+ GEN c = ellcard(e, NULL);
+ cr_assert(equalii(addis(p, 1), c), );
+}