diff options
| author | J08nY | 2018-01-18 18:37:44 +0100 |
|---|---|---|
| committer | J08nY | 2018-01-18 18:40:06 +0100 |
| commit | cf074191532caef918fb9f502b37697094da317a (patch) | |
| tree | 9826a5f436aba9fcbfbba8dfd5e615267213123f /test | |
| parent | f940f80a2cb69ffcd1f0d608cbb1b0f06e0854d6 (diff) | |
| download | ecgen-cf074191532caef918fb9f502b37697094da317a.tar.gz ecgen-cf074191532caef918fb9f502b37697094da317a.tar.zst ecgen-cf074191532caef918fb9f502b37697094da317a.zip | |
Diffstat (limited to 'test')
| -rwxr-xr-x | test/ecgen.sh | 8 | ||||
| -rw-r--r-- | test/src/math/test_twists.c | 19 |
2 files changed, 18 insertions, 9 deletions
diff --git a/test/ecgen.sh b/test/ecgen.sh index 0621c48..006025e 100755 --- a/test/ecgen.sh +++ b/test/ecgen.sh @@ -87,6 +87,7 @@ function brainpool() { assert_raises "${ecgen} --fp -r --brainpool-rfc 10" assert_raises "${ecgen} --f2m -r --brainpool-rfc 10" 1 } + function anomalous() { start_test assert_raises "${ecgen} --fp --anomalous -r 20" @@ -106,6 +107,12 @@ function invalid() { assert_raises "${ecgen} --f2m --threads=auto -r -i -u 10" } +function twist() { + start_test + assert_raises "${ecgen} --fp --twist -r 10" + assert_raises "${ecgen} --f2m --twist -r 10" +} + function cli() { start_test assert_raises "${ecgen} --threads=a" 1 @@ -132,6 +139,7 @@ ansix962 brainpool anomalous invalid +twist cli hex end_suite ecgen
\ No newline at end of file diff --git a/test/src/math/test_twists.c b/test/src/math/test_twists.c index 30bc958..8a869bf 100644 --- a/test/src/math/test_twists.c +++ b/test/src/math/test_twists.c @@ -3,8 +3,8 @@ * Copyright (C) 2017 J08nY */ #include <criterion/criterion.h> -#include "gen/point.h" #include "gen/field.h" +#include "gen/point.h" #include "math/poly.h" #include "math/twists.h" #include "test/default.h" @@ -12,7 +12,7 @@ TestSuite(twists, .init = default_setup, .fini = default_teardown); -Test(twists, test_twist_rand_fp) { +Test(twists, test_twist_rand_to_fp) { random_init(); GEN a = mkintmodu(3, 23); GEN b = mkintmodu(4, 23); @@ -22,25 +22,26 @@ Test(twists, test_twist_rand_fp) { .curve = ellinit(mkvec2(a, b), stoi(23), -1)}; curve_t to = {0}; - curve_twist_rand(&to, &curve); + twist_rand_to(&to, &curve); cr_assert_not_null(to.a, ); cr_assert_not_null(to.b, ); cr_assert_not_null(to.field, ); cr_assert_not_null(to.curve, ); } -Test(twists, test_twist_rand_f2m) { +Test(twists, test_twist_rand_to_f2m) { random_init(); GEN field = poly_find_gen(13); GEN a = field_ielement(field, stoi(2)); GEN b = field_ielement(field, stoi(3)); - curve_t curve = {.a = a, - .b = b, - .field = field, - .curve = ellinit(mkvecn(5, gen_1, a, gen_0, gen_0, b), NULL, -1)}; + curve_t curve = { + .a = a, + .b = b, + .field = field, + .curve = ellinit(mkvecn(5, gen_1, a, gen_0, gen_0, b), NULL, -1)}; curve_t to = {0}; - curve_twist_rand(&to, &curve); + twist_rand_to(&to, &curve); cr_assert_not_null(to.a, ); cr_assert_not_null(to.b, ); cr_assert_not_null(to.field, ); |
