test.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. *******************************************************************************
  3. \file test.c
  4. \brief Bee2 testing
  5. \project bee2/test
  6. \created 2014.04.02
  7. \version 2022.07.07
  8. \license This program is released under the GNU General Public License
  9. version 3. See Copyright Notices in bee2/info.h.
  10. *******************************************************************************
  11. */
  12. #include <stdio.h>
  13. #include <bee2/defs.h>
  14. /*
  15. *******************************************************************************
  16. Тестирование модулей core
  17. *******************************************************************************
  18. */
  19. extern bool_t b64Test();
  20. extern bool_t decTest();
  21. extern bool_t derTest();
  22. extern bool_t hexTest();
  23. extern bool_t memTest();
  24. extern bool_t mtTest();
  25. extern bool_t objTest();
  26. extern bool_t oidTest();
  27. extern bool_t prngTest();
  28. extern bool_t rngTest();
  29. extern bool_t strTest();
  30. extern bool_t tmTest();
  31. extern bool_t u16Test();
  32. extern bool_t u32Test();
  33. extern bool_t u64Test();
  34. extern bool_t utilTest();
  35. int testCore()
  36. {
  37. bool_t code;
  38. int ret = 0;
  39. printf("b64Test: %s\n", (code = b64Test()) ? "OK" : "Err"), ret |= !code;
  40. printf("decTest: %s\n", (code = decTest()) ? "OK" : "Err"), ret |= !code;
  41. printf("derTest: %s\n", (code = derTest()) ? "OK" : "Err"), ret |= !code;
  42. printf("hexTest: %s\n", (code = hexTest()) ? "OK" : "Err"), ret |= !code;
  43. printf("memTest: %s\n", (code = memTest()) ? "OK" : "Err"), ret |= !code;
  44. printf("mtTest: %s\n", (code = mtTest()) ? "OK" : "Err"), ret |= !code;
  45. printf("objTest: %s\n", (code = objTest()) ? "OK" : "Err"), ret |= !code;
  46. printf("oidTest: %s\n", (code = oidTest()) ? "OK" : "Err"), ret |= !code;
  47. printf("genTest: %s\n", (code = prngTest()) ? "OK" : "Err"), ret |= !code;
  48. printf("rngTest: %s\n", (code = rngTest()) ? "OK" : "Err"), ret |= !code;
  49. printf("strTest: %s\n", (code = strTest()) ? "OK" : "Err"), ret |= !code;
  50. printf("tmTest: %s\n", (code = tmTest()) ? "OK" : "Err"), ret |= !code;
  51. printf("u16Test: %s\n", (code = u16Test()) ? "OK" : "Err"), ret |= !code;
  52. printf("u32Test: %s\n", (code = u32Test()) ? "OK" : "Err"), ret |= !code;
  53. printf("u64Test: %s\n", (code = u64Test()) ? "OK" : "Err"), ret |= !code;
  54. printf("utilTest: %s\n", (code = utilTest()) ? "OK" : "Err"), ret |= !code;
  55. return ret;
  56. }
  57. /*
  58. *******************************************************************************
  59. Тестирование модулей math
  60. *******************************************************************************
  61. */
  62. extern bool_t priTest();
  63. extern bool_t zzTest();
  64. extern bool_t wordTest();
  65. extern bool_t ecpTest();
  66. extern bool_t ecpBench();
  67. int testMath()
  68. {
  69. bool_t code;
  70. int ret = 0;
  71. printf("priTest: %s\n", (code = priTest()) ? "OK" : "Err"), ret |= !code;
  72. printf("zzTest: %s\n", (code = zzTest()) ? "OK" : "Err"), ret |= !code;
  73. printf("wordTest: %s\n", (code = wordTest()) ? "OK" : "Err"), ret |= !code;
  74. printf("ecpTest: %s\n", (code = ecpTest()) ? "OK" : "Err"), ret |= !code;
  75. code = ecpBench(), ret |= !code;
  76. return ret;
  77. }
  78. /*
  79. *******************************************************************************
  80. Тестирование модулей crypto
  81. *******************************************************************************
  82. */
  83. extern bool_t beltTest();
  84. extern bool_t beltBench();
  85. extern bool_t bignTest();
  86. extern bool_t brngTest();
  87. extern bool_t belsTest();
  88. extern bool_t bakeTest();
  89. extern bool_t bakeDemo();
  90. extern bool_t bashTest();
  91. extern bool_t bashBench();
  92. extern bool_t botpTest();
  93. extern bool_t bpkiTest();
  94. extern bool_t btokTest();
  95. extern bool_t dstuTest();
  96. extern bool_t g12sTest();
  97. extern bool_t pfokTest();
  98. extern bool_t pfokTestStdParams();
  99. int testCrypto()
  100. {
  101. bool_t code;
  102. int ret = 0;
  103. printf("beltTest: %s\n", (code = beltTest()) ? "OK" : "Err"), ret |= !code;
  104. printf("bashTest: %s\n", (code = bashTest()) ? "OK" : "Err"), ret |= !code;
  105. code = beltBench(), ret |= !code;
  106. code = bashBench(), ret |= !code;
  107. printf("bignTest: %s\n", (code = bignTest()) ? "OK" : "Err"), ret |= !code;
  108. printf("botpTest: %s\n", (code = botpTest()) ? "OK" : "Err"), ret |= !code;
  109. printf("brngTest: %s\n", (code = brngTest()) ? "OK" : "Err"), ret |= !code;
  110. printf("belsTest: %s\n", (code = belsTest()) ? "OK" : "Err"), ret |= !code;
  111. printf("bakeTest: %s\n", (code = bakeTest()) ? "OK" : "Err"), ret |= !code;
  112. printf("bpkiTest: %s\n", (code = bpkiTest()) ? "OK" : "Err"), ret |= !code;
  113. printf("btokTest: %s\n", (code = btokTest()) ? "OK" : "Err"), ret |= !code;
  114. printf("dstuTest: %s\n", (code = dstuTest()) ? "OK" : "Err"), ret |= !code;
  115. printf("g12sTest: %s\n", (code = g12sTest()) ? "OK" : "Err"), ret |= !code;
  116. printf("pfokTest: %s\n", (code = pfokTest()) ? "OK" : "Err"), ret |= !code;
  117. return ret;
  118. }
  119. /*
  120. *******************************************************************************
  121. main
  122. *******************************************************************************
  123. */
  124. int main()
  125. {
  126. int ret = 0;
  127. ret |= testCore();
  128. ret |= testMath();
  129. ret |= testCrypto();
  130. return ret;
  131. }