diff options
Diffstat (limited to 'test/src/math')
| -rw-r--r-- | test/src/math/test_koblitz.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/src/math/test_koblitz.c b/test/src/math/test_koblitz.c new file mode 100644 index 0000000..03e411c --- /dev/null +++ b/test/src/math/test_koblitz.c @@ -0,0 +1,33 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ +#include <criterion/criterion.h> +#include "gen/point.h" +#include "math/koblitz.h" +#include "test/default.h" + +TestSuite(koblitz, .init = default_setup, .fini = default_teardown); + +Test(koblitz, test_koblitz_is_curve) { + curve_t curve = { + .field = stoi(23), + .a = mkintmodu(3, 23), + .b = mkintmodu(2, 23) + }; + + cr_assert_not(koblitz_is_curve(&curve),); + curve.a = mkintmodu(1, 23); + curve.b = mkintmodu(1, 23); + cr_assert(koblitz_is_curve(&curve),); +} + +Test(koblitz, test_koblitz_find) { + const koblitz_t *koblitz = koblitz_find(107, 0); + cr_assert_not_null(koblitz, ); +} + +Test(koblitz, test_koblitz_get_order) { + GEN order = koblitz_get_order(107, 0); + cr_assert(gequal(order, strtoi("0x7ffffffffffffb57c25324737c4")), ); +}
\ No newline at end of file |
