Back to index

lightning-sunbird  0.9+nobinonly
test-info.c
Go to the documentation of this file.
00001 /*
00002  *  test-info.c
00003  *
00004  *  Arbitrary precision integer arithmetic library
00005  *
00006  * ***** BEGIN LICENSE BLOCK *****
00007  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00008  *
00009  * The contents of this file are subject to the Mozilla Public License Version
00010  * 1.1 (the "License"); you may not use this file except in compliance with
00011  * the License. You may obtain a copy of the License at
00012  * http://www.mozilla.org/MPL/
00013  *
00014  * Software distributed under the License is distributed on an "AS IS" basis,
00015  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  * for the specific language governing rights and limitations under the
00017  * License.
00018  *
00019  * The Original Code is the MPI Arbitrary Precision Integer Arithmetic library.
00020  *
00021  * The Initial Developer of the Original Code is
00022  * Michael J. Fromberger.
00023  * Portions created by the Initial Developer are Copyright (C) 1998
00024  * the Initial Developer. All Rights Reserved.
00025  *
00026  * Contributor(s):
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either the GNU General Public License Version 2 or later (the "GPL"), or
00030  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the MPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the MPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 /* $Id: test-info.c,v 1.3 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
00042 
00043 /* Table mapping test suite names to index numbers */
00044 const int   g_count = 42;
00045 const char *g_names[] = {
00046    "list",              /* print out a list of the available test suites */
00047    "copy",              /* test assignment of mp-int structures          */
00048    "exchange",          /* test exchange of mp-int structures            */
00049    "zero",              /* test zeroing of an mp-int                     */
00050    "set",               /* test setting an mp-int to a small constant    */
00051    "absolute-value",    /* test the absolute value function              */
00052    "negate",            /* test the arithmetic negation function         */
00053    "add-digit",         /* test digit addition                           */
00054    "add",               /* test full addition                            */
00055    "subtract-digit",    /* test digit subtraction                        */
00056    "subtract",          /* test full subtraction                         */
00057    "multiply-digit",    /* test digit multiplication                     */
00058    "multiply",          /* test full multiplication                      */
00059    "square",            /* test full squaring function                   */
00060    "divide-digit",      /* test digit division                           */
00061    "divide-2",          /* test division by two                          */
00062    "divide-2d",         /* test division & remainder by 2^d              */
00063    "divide",            /* test full division                            */
00064    "expt-digit",        /* test digit exponentiation                     */
00065    "expt",              /* test full exponentiation                      */
00066    "expt-2",            /* test power-of-two exponentiation              */
00067    "square-root",       /* test integer square root function             */
00068    "modulo-digit",      /* test digit modular reduction                  */
00069    "modulo",            /* test full modular reduction                   */
00070    "mod-add",           /* test modular addition                         */
00071    "mod-subtract",      /* test modular subtraction                      */
00072    "mod-multiply",      /* test modular multiplication                   */
00073    "mod-square",        /* test modular squaring function                */
00074    "mod-expt",          /* test full modular exponentiation              */
00075    "mod-expt-digit",    /* test digit modular exponentiation             */
00076    "mod-inverse",       /* test modular inverse function                 */
00077    "compare-digit",     /* test digit comparison function                */
00078    "compare-zero",      /* test zero comparison function                 */
00079    "compare",           /* test general signed comparison                */
00080    "compare-magnitude", /* test general magnitude comparison             */
00081    "parity",            /* test parity comparison functions              */
00082    "gcd",               /* test greatest common divisor functions        */
00083    "lcm",               /* test least common multiple function           */
00084    "conversion",        /* test general radix conversion facilities      */
00085    "binary",            /* test raw output format                        */
00086    "pprime",            /* test probabilistic primality tester           */
00087    "fermat"             /* test Fermat pseudoprimality tester            */
00088 };
00089 
00090 /* Test function prototypes */
00091 int  test_list(void);
00092 int  test_copy(void);
00093 int  test_exch(void);
00094 int  test_zero(void);
00095 int  test_set(void);
00096 int  test_abs(void);
00097 int  test_neg(void);
00098 int  test_add_d(void);
00099 int  test_add(void);
00100 int  test_sub_d(void);
00101 int  test_sub(void);
00102 int  test_mul_d(void);
00103 int  test_mul(void);
00104 int  test_sqr(void);
00105 int  test_div_d(void);
00106 int  test_div_2(void);
00107 int  test_div_2d(void);
00108 int  test_div(void);
00109 int  test_expt_d(void);
00110 int  test_expt(void);
00111 int  test_2expt(void);
00112 int  test_sqrt(void);
00113 int  test_mod_d(void);
00114 int  test_mod(void);
00115 int  test_addmod(void);
00116 int  test_submod(void);
00117 int  test_mulmod(void);
00118 int  test_sqrmod(void);
00119 int  test_exptmod(void);
00120 int  test_exptmod_d(void);
00121 int  test_invmod(void);
00122 int  test_cmp_d(void);
00123 int  test_cmp_z(void);
00124 int  test_cmp(void);
00125 int  test_cmp_mag(void);
00126 int  test_parity(void);
00127 int  test_gcd(void);
00128 int  test_lcm(void);
00129 int  test_convert(void);
00130 int  test_raw(void);
00131 int  test_pprime(void);
00132 int  test_fermat(void);
00133 
00134 /* Table mapping index numbers to functions */
00135 int (*g_tests[])(void)  = {
00136    test_list,     test_copy,     test_exch,     test_zero,     
00137    test_set,      test_abs,      test_neg,      test_add_d,    
00138    test_add,      test_sub_d,    test_sub,      test_mul_d,    
00139    test_mul,      test_sqr,      test_div_d,    test_div_2,    
00140    test_div_2d,   test_div,      test_expt_d,   test_expt,     
00141    test_2expt,    test_sqrt,     test_mod_d,    test_mod,      
00142    test_addmod,   test_submod,   test_mulmod,   test_sqrmod,   
00143    test_exptmod,  test_exptmod_d, test_invmod,   test_cmp_d,    
00144    test_cmp_z,    test_cmp,      test_cmp_mag,  test_parity,   
00145    test_gcd,      test_lcm,      test_convert,  test_raw,      
00146    test_pprime,   test_fermat
00147 };
00148 
00149 /* Table mapping index numbers to descriptions */
00150 const char *g_descs[] = {
00151    "print out a list of the available test suites",
00152    "test assignment of mp-int structures",
00153    "test exchange of mp-int structures",
00154    "test zeroing of an mp-int",
00155    "test setting an mp-int to a small constant",
00156    "test the absolute value function",
00157    "test the arithmetic negation function",
00158    "test digit addition",
00159    "test full addition",
00160    "test digit subtraction",
00161    "test full subtraction",
00162    "test digit multiplication",
00163    "test full multiplication",
00164    "test full squaring function",
00165    "test digit division",
00166    "test division by two",
00167    "test division & remainder by 2^d",
00168    "test full division",
00169    "test digit exponentiation",
00170    "test full exponentiation",
00171    "test power-of-two exponentiation",
00172    "test integer square root function",
00173    "test digit modular reduction",
00174    "test full modular reduction",
00175    "test modular addition",
00176    "test modular subtraction",
00177    "test modular multiplication",
00178    "test modular squaring function",
00179    "test full modular exponentiation",
00180    "test digit modular exponentiation",
00181    "test modular inverse function",
00182    "test digit comparison function",
00183    "test zero comparison function",
00184    "test general signed comparison",
00185    "test general magnitude comparison",
00186    "test parity comparison functions",
00187    "test greatest common divisor functions",
00188    "test least common multiple function",
00189    "test general radix conversion facilities",
00190    "test raw output format",
00191    "test probabilistic primality tester",
00192    "test Fermat pseudoprimality tester"
00193 };
00194