security/nss/lib/freebl/mpi/test-info.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/freebl/mpi/test-info.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,161 @@
     1.4 +/*
     1.5 + *  test-info.c
     1.6 + *
     1.7 + *  Arbitrary precision integer arithmetic library
     1.8 + *
     1.9 + * This Source Code Form is subject to the terms of the Mozilla Public
    1.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    1.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.12 +
    1.13 +/* Table mapping test suite names to index numbers */
    1.14 +const int   g_count = 42;
    1.15 +const char *g_names[] = {
    1.16 +   "list",              /* print out a list of the available test suites */
    1.17 +   "copy",              /* test assignment of mp-int structures          */
    1.18 +   "exchange",          /* test exchange of mp-int structures            */
    1.19 +   "zero",              /* test zeroing of an mp-int                     */
    1.20 +   "set",               /* test setting an mp-int to a small constant    */
    1.21 +   "absolute-value",    /* test the absolute value function              */
    1.22 +   "negate",            /* test the arithmetic negation function         */
    1.23 +   "add-digit",         /* test digit addition                           */
    1.24 +   "add",               /* test full addition                            */
    1.25 +   "subtract-digit",    /* test digit subtraction                        */
    1.26 +   "subtract",          /* test full subtraction                         */
    1.27 +   "multiply-digit",    /* test digit multiplication                     */
    1.28 +   "multiply",          /* test full multiplication                      */
    1.29 +   "square",            /* test full squaring function                   */
    1.30 +   "divide-digit",      /* test digit division                           */
    1.31 +   "divide-2",          /* test division by two                          */
    1.32 +   "divide-2d",         /* test division & remainder by 2^d              */
    1.33 +   "divide",            /* test full division                            */
    1.34 +   "expt-digit",        /* test digit exponentiation                     */
    1.35 +   "expt",              /* test full exponentiation                      */
    1.36 +   "expt-2",            /* test power-of-two exponentiation              */
    1.37 +   "square-root",       /* test integer square root function             */
    1.38 +   "modulo-digit",      /* test digit modular reduction                  */
    1.39 +   "modulo",            /* test full modular reduction                   */
    1.40 +   "mod-add",           /* test modular addition                         */
    1.41 +   "mod-subtract",      /* test modular subtraction                      */
    1.42 +   "mod-multiply",      /* test modular multiplication                   */
    1.43 +   "mod-square",        /* test modular squaring function                */
    1.44 +   "mod-expt",          /* test full modular exponentiation              */
    1.45 +   "mod-expt-digit",    /* test digit modular exponentiation             */
    1.46 +   "mod-inverse",       /* test modular inverse function                 */
    1.47 +   "compare-digit",     /* test digit comparison function                */
    1.48 +   "compare-zero",      /* test zero comparison function                 */
    1.49 +   "compare",           /* test general signed comparison                */
    1.50 +   "compare-magnitude", /* test general magnitude comparison             */
    1.51 +   "parity",            /* test parity comparison functions              */
    1.52 +   "gcd",               /* test greatest common divisor functions        */
    1.53 +   "lcm",               /* test least common multiple function           */
    1.54 +   "conversion",        /* test general radix conversion facilities      */
    1.55 +   "binary",            /* test raw output format                        */
    1.56 +   "pprime",            /* test probabilistic primality tester           */
    1.57 +   "fermat"             /* test Fermat pseudoprimality tester            */
    1.58 +};
    1.59 +
    1.60 +/* Test function prototypes */
    1.61 +int  test_list(void);
    1.62 +int  test_copy(void);
    1.63 +int  test_exch(void);
    1.64 +int  test_zero(void);
    1.65 +int  test_set(void);
    1.66 +int  test_abs(void);
    1.67 +int  test_neg(void);
    1.68 +int  test_add_d(void);
    1.69 +int  test_add(void);
    1.70 +int  test_sub_d(void);
    1.71 +int  test_sub(void);
    1.72 +int  test_mul_d(void);
    1.73 +int  test_mul(void);
    1.74 +int  test_sqr(void);
    1.75 +int  test_div_d(void);
    1.76 +int  test_div_2(void);
    1.77 +int  test_div_2d(void);
    1.78 +int  test_div(void);
    1.79 +int  test_expt_d(void);
    1.80 +int  test_expt(void);
    1.81 +int  test_2expt(void);
    1.82 +int  test_sqrt(void);
    1.83 +int  test_mod_d(void);
    1.84 +int  test_mod(void);
    1.85 +int  test_addmod(void);
    1.86 +int  test_submod(void);
    1.87 +int  test_mulmod(void);
    1.88 +int  test_sqrmod(void);
    1.89 +int  test_exptmod(void);
    1.90 +int  test_exptmod_d(void);
    1.91 +int  test_invmod(void);
    1.92 +int  test_cmp_d(void);
    1.93 +int  test_cmp_z(void);
    1.94 +int  test_cmp(void);
    1.95 +int  test_cmp_mag(void);
    1.96 +int  test_parity(void);
    1.97 +int  test_gcd(void);
    1.98 +int  test_lcm(void);
    1.99 +int  test_convert(void);
   1.100 +int  test_raw(void);
   1.101 +int  test_pprime(void);
   1.102 +int  test_fermat(void);
   1.103 +
   1.104 +/* Table mapping index numbers to functions */
   1.105 +int (*g_tests[])(void)  = {
   1.106 +   test_list,     test_copy,     test_exch,     test_zero,     
   1.107 +   test_set,      test_abs,      test_neg,      test_add_d,    
   1.108 +   test_add,      test_sub_d,    test_sub,      test_mul_d,    
   1.109 +   test_mul,      test_sqr,      test_div_d,    test_div_2,    
   1.110 +   test_div_2d,   test_div,      test_expt_d,   test_expt,     
   1.111 +   test_2expt,    test_sqrt,     test_mod_d,    test_mod,      
   1.112 +   test_addmod,   test_submod,   test_mulmod,   test_sqrmod,   
   1.113 +   test_exptmod,  test_exptmod_d, test_invmod,   test_cmp_d,    
   1.114 +   test_cmp_z,    test_cmp,      test_cmp_mag,  test_parity,   
   1.115 +   test_gcd,      test_lcm,      test_convert,  test_raw,      
   1.116 +   test_pprime,   test_fermat
   1.117 +};
   1.118 +
   1.119 +/* Table mapping index numbers to descriptions */
   1.120 +const char *g_descs[] = {
   1.121 +   "print out a list of the available test suites",
   1.122 +   "test assignment of mp-int structures",
   1.123 +   "test exchange of mp-int structures",
   1.124 +   "test zeroing of an mp-int",
   1.125 +   "test setting an mp-int to a small constant",
   1.126 +   "test the absolute value function",
   1.127 +   "test the arithmetic negation function",
   1.128 +   "test digit addition",
   1.129 +   "test full addition",
   1.130 +   "test digit subtraction",
   1.131 +   "test full subtraction",
   1.132 +   "test digit multiplication",
   1.133 +   "test full multiplication",
   1.134 +   "test full squaring function",
   1.135 +   "test digit division",
   1.136 +   "test division by two",
   1.137 +   "test division & remainder by 2^d",
   1.138 +   "test full division",
   1.139 +   "test digit exponentiation",
   1.140 +   "test full exponentiation",
   1.141 +   "test power-of-two exponentiation",
   1.142 +   "test integer square root function",
   1.143 +   "test digit modular reduction",
   1.144 +   "test full modular reduction",
   1.145 +   "test modular addition",
   1.146 +   "test modular subtraction",
   1.147 +   "test modular multiplication",
   1.148 +   "test modular squaring function",
   1.149 +   "test full modular exponentiation",
   1.150 +   "test digit modular exponentiation",
   1.151 +   "test modular inverse function",
   1.152 +   "test digit comparison function",
   1.153 +   "test zero comparison function",
   1.154 +   "test general signed comparison",
   1.155 +   "test general magnitude comparison",
   1.156 +   "test parity comparison functions",
   1.157 +   "test greatest common divisor functions",
   1.158 +   "test least common multiple function",
   1.159 +   "test general radix conversion facilities",
   1.160 +   "test raw output format",
   1.161 +   "test probabilistic primality tester",
   1.162 +   "test Fermat pseudoprimality tester"
   1.163 +};
   1.164 +

mercurial