Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * test-info.c |
michael@0 | 3 | * |
michael@0 | 4 | * Arbitrary precision integer arithmetic library |
michael@0 | 5 | * |
michael@0 | 6 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 9 | |
michael@0 | 10 | /* Table mapping test suite names to index numbers */ |
michael@0 | 11 | const int g_count = 42; |
michael@0 | 12 | const char *g_names[] = { |
michael@0 | 13 | "list", /* print out a list of the available test suites */ |
michael@0 | 14 | "copy", /* test assignment of mp-int structures */ |
michael@0 | 15 | "exchange", /* test exchange of mp-int structures */ |
michael@0 | 16 | "zero", /* test zeroing of an mp-int */ |
michael@0 | 17 | "set", /* test setting an mp-int to a small constant */ |
michael@0 | 18 | "absolute-value", /* test the absolute value function */ |
michael@0 | 19 | "negate", /* test the arithmetic negation function */ |
michael@0 | 20 | "add-digit", /* test digit addition */ |
michael@0 | 21 | "add", /* test full addition */ |
michael@0 | 22 | "subtract-digit", /* test digit subtraction */ |
michael@0 | 23 | "subtract", /* test full subtraction */ |
michael@0 | 24 | "multiply-digit", /* test digit multiplication */ |
michael@0 | 25 | "multiply", /* test full multiplication */ |
michael@0 | 26 | "square", /* test full squaring function */ |
michael@0 | 27 | "divide-digit", /* test digit division */ |
michael@0 | 28 | "divide-2", /* test division by two */ |
michael@0 | 29 | "divide-2d", /* test division & remainder by 2^d */ |
michael@0 | 30 | "divide", /* test full division */ |
michael@0 | 31 | "expt-digit", /* test digit exponentiation */ |
michael@0 | 32 | "expt", /* test full exponentiation */ |
michael@0 | 33 | "expt-2", /* test power-of-two exponentiation */ |
michael@0 | 34 | "square-root", /* test integer square root function */ |
michael@0 | 35 | "modulo-digit", /* test digit modular reduction */ |
michael@0 | 36 | "modulo", /* test full modular reduction */ |
michael@0 | 37 | "mod-add", /* test modular addition */ |
michael@0 | 38 | "mod-subtract", /* test modular subtraction */ |
michael@0 | 39 | "mod-multiply", /* test modular multiplication */ |
michael@0 | 40 | "mod-square", /* test modular squaring function */ |
michael@0 | 41 | "mod-expt", /* test full modular exponentiation */ |
michael@0 | 42 | "mod-expt-digit", /* test digit modular exponentiation */ |
michael@0 | 43 | "mod-inverse", /* test modular inverse function */ |
michael@0 | 44 | "compare-digit", /* test digit comparison function */ |
michael@0 | 45 | "compare-zero", /* test zero comparison function */ |
michael@0 | 46 | "compare", /* test general signed comparison */ |
michael@0 | 47 | "compare-magnitude", /* test general magnitude comparison */ |
michael@0 | 48 | "parity", /* test parity comparison functions */ |
michael@0 | 49 | "gcd", /* test greatest common divisor functions */ |
michael@0 | 50 | "lcm", /* test least common multiple function */ |
michael@0 | 51 | "conversion", /* test general radix conversion facilities */ |
michael@0 | 52 | "binary", /* test raw output format */ |
michael@0 | 53 | "pprime", /* test probabilistic primality tester */ |
michael@0 | 54 | "fermat" /* test Fermat pseudoprimality tester */ |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | /* Test function prototypes */ |
michael@0 | 58 | int test_list(void); |
michael@0 | 59 | int test_copy(void); |
michael@0 | 60 | int test_exch(void); |
michael@0 | 61 | int test_zero(void); |
michael@0 | 62 | int test_set(void); |
michael@0 | 63 | int test_abs(void); |
michael@0 | 64 | int test_neg(void); |
michael@0 | 65 | int test_add_d(void); |
michael@0 | 66 | int test_add(void); |
michael@0 | 67 | int test_sub_d(void); |
michael@0 | 68 | int test_sub(void); |
michael@0 | 69 | int test_mul_d(void); |
michael@0 | 70 | int test_mul(void); |
michael@0 | 71 | int test_sqr(void); |
michael@0 | 72 | int test_div_d(void); |
michael@0 | 73 | int test_div_2(void); |
michael@0 | 74 | int test_div_2d(void); |
michael@0 | 75 | int test_div(void); |
michael@0 | 76 | int test_expt_d(void); |
michael@0 | 77 | int test_expt(void); |
michael@0 | 78 | int test_2expt(void); |
michael@0 | 79 | int test_sqrt(void); |
michael@0 | 80 | int test_mod_d(void); |
michael@0 | 81 | int test_mod(void); |
michael@0 | 82 | int test_addmod(void); |
michael@0 | 83 | int test_submod(void); |
michael@0 | 84 | int test_mulmod(void); |
michael@0 | 85 | int test_sqrmod(void); |
michael@0 | 86 | int test_exptmod(void); |
michael@0 | 87 | int test_exptmod_d(void); |
michael@0 | 88 | int test_invmod(void); |
michael@0 | 89 | int test_cmp_d(void); |
michael@0 | 90 | int test_cmp_z(void); |
michael@0 | 91 | int test_cmp(void); |
michael@0 | 92 | int test_cmp_mag(void); |
michael@0 | 93 | int test_parity(void); |
michael@0 | 94 | int test_gcd(void); |
michael@0 | 95 | int test_lcm(void); |
michael@0 | 96 | int test_convert(void); |
michael@0 | 97 | int test_raw(void); |
michael@0 | 98 | int test_pprime(void); |
michael@0 | 99 | int test_fermat(void); |
michael@0 | 100 | |
michael@0 | 101 | /* Table mapping index numbers to functions */ |
michael@0 | 102 | int (*g_tests[])(void) = { |
michael@0 | 103 | test_list, test_copy, test_exch, test_zero, |
michael@0 | 104 | test_set, test_abs, test_neg, test_add_d, |
michael@0 | 105 | test_add, test_sub_d, test_sub, test_mul_d, |
michael@0 | 106 | test_mul, test_sqr, test_div_d, test_div_2, |
michael@0 | 107 | test_div_2d, test_div, test_expt_d, test_expt, |
michael@0 | 108 | test_2expt, test_sqrt, test_mod_d, test_mod, |
michael@0 | 109 | test_addmod, test_submod, test_mulmod, test_sqrmod, |
michael@0 | 110 | test_exptmod, test_exptmod_d, test_invmod, test_cmp_d, |
michael@0 | 111 | test_cmp_z, test_cmp, test_cmp_mag, test_parity, |
michael@0 | 112 | test_gcd, test_lcm, test_convert, test_raw, |
michael@0 | 113 | test_pprime, test_fermat |
michael@0 | 114 | }; |
michael@0 | 115 | |
michael@0 | 116 | /* Table mapping index numbers to descriptions */ |
michael@0 | 117 | const char *g_descs[] = { |
michael@0 | 118 | "print out a list of the available test suites", |
michael@0 | 119 | "test assignment of mp-int structures", |
michael@0 | 120 | "test exchange of mp-int structures", |
michael@0 | 121 | "test zeroing of an mp-int", |
michael@0 | 122 | "test setting an mp-int to a small constant", |
michael@0 | 123 | "test the absolute value function", |
michael@0 | 124 | "test the arithmetic negation function", |
michael@0 | 125 | "test digit addition", |
michael@0 | 126 | "test full addition", |
michael@0 | 127 | "test digit subtraction", |
michael@0 | 128 | "test full subtraction", |
michael@0 | 129 | "test digit multiplication", |
michael@0 | 130 | "test full multiplication", |
michael@0 | 131 | "test full squaring function", |
michael@0 | 132 | "test digit division", |
michael@0 | 133 | "test division by two", |
michael@0 | 134 | "test division & remainder by 2^d", |
michael@0 | 135 | "test full division", |
michael@0 | 136 | "test digit exponentiation", |
michael@0 | 137 | "test full exponentiation", |
michael@0 | 138 | "test power-of-two exponentiation", |
michael@0 | 139 | "test integer square root function", |
michael@0 | 140 | "test digit modular reduction", |
michael@0 | 141 | "test full modular reduction", |
michael@0 | 142 | "test modular addition", |
michael@0 | 143 | "test modular subtraction", |
michael@0 | 144 | "test modular multiplication", |
michael@0 | 145 | "test modular squaring function", |
michael@0 | 146 | "test full modular exponentiation", |
michael@0 | 147 | "test digit modular exponentiation", |
michael@0 | 148 | "test modular inverse function", |
michael@0 | 149 | "test digit comparison function", |
michael@0 | 150 | "test zero comparison function", |
michael@0 | 151 | "test general signed comparison", |
michael@0 | 152 | "test general magnitude comparison", |
michael@0 | 153 | "test parity comparison functions", |
michael@0 | 154 | "test greatest common divisor functions", |
michael@0 | 155 | "test least common multiple function", |
michael@0 | 156 | "test general radix conversion facilities", |
michael@0 | 157 | "test raw output format", |
michael@0 | 158 | "test probabilistic primality tester", |
michael@0 | 159 | "test Fermat pseudoprimality tester" |
michael@0 | 160 | }; |
michael@0 | 161 |