PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

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

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