#include "test_extras.h" #include #include #include // Global constants extern const digit_t p[NWORDS_FIELD]; // Benchmark and test parameters static int BENCH_LOOPS = 100000; // Number of iterations per bench static int TEST_LOOPS = 100000; // Number of iterations per test bool fp2_test() { // Tests for the GF(p^2) arithmetic bool OK = true; int n, passed; fp2_t a, b, c, d, e, f, ma, mb, mc, md, me, mf; printf("\n--------------------------------------------------------------------------------------------------------\n\n"); printf("Testing arithmetic over GF(p^2): \n\n"); // Addition in GF(p^2) passed = 1; for (n=0; n\n"); exit(1); } if (!strcmp(argv[1], "test")) { TEST_LOOPS = atoi(argv[2]); return !fp2_test(); } else if (!strcmp(argv[1], "bench")) { BENCH_LOOPS = atoi(argv[2]); return !fp2_run(); } else { exit(1); } }