diff options
| author | J08nY | 2018-01-18 22:07:34 +0100 |
|---|---|---|
| committer | J08nY | 2018-01-18 23:38:40 +0100 |
| commit | 77a4a7c2af7aad72e699018fcda8e4cb52d377e6 (patch) | |
| tree | 8755e6b3d1c0e856252dfc8fe37b1c727606a812 /test/src/util/test_random.c | |
| parent | b03007db7612a6d9ab70cd0e698de565a9687ddf (diff) | |
| download | ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.tar.gz ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.tar.zst ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.zip | |
Add some more basic tests for coverage.
Diffstat (limited to 'test/src/util/test_random.c')
| -rw-r--r-- | test/src/util/test_random.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/util/test_random.c b/test/src/util/test_random.c index bb632a6..be45f95 100644 --- a/test/src/util/test_random.c +++ b/test/src/util/test_random.c @@ -4,6 +4,7 @@ */ #include <criterion/criterion.h> +#include "math/poly.h" #include "test/default.h" #include "util/random.h" @@ -30,3 +31,20 @@ Test(random, test_random_int) { cr_assert_geq(cmpii(j, int2n(9)), 0, ); } } + +Test(random, test_random_field_element_fp) { + GEN fp = random_int(25); + for (size_t i = 0; i < 100; ++i) { + GEN j = random_field_element(fp); + cr_assert_geq(cmpii(j, gen_0), 0, ); + cr_assert_lt(cmpii(j, fp), 0, ); + } +} + +Test(random, test_random_field_element_f2m) { + GEN f2m = poly_find_gen(23); + for (size_t i = 0; i < 100; ++i) { + GEN j = random_field_element(f2m); + cr_assert_not_null(j, ); + } +}
\ No newline at end of file |
