You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
3.1KB

  1. /**
  2. * Unit test entry point
  3. */
  4. #include <stdio.h>
  5. #include <assert.h>
  6. #include <string>
  7. extern void testBiquad();
  8. extern void testTestSignal();
  9. extern void testSaw();
  10. extern void testLookupTable();
  11. extern void testSinOscillator();
  12. extern void testHilbert();
  13. extern void testAudioMath();
  14. extern void perfTest();
  15. extern void testFrequencyShifter();
  16. extern void testStateVariable();
  17. extern void testVocalAnimator();
  18. extern void testObjectCache();
  19. extern void testThread(bool exended);
  20. extern void testFFT();
  21. extern void testRingBuffer();
  22. extern void testManagedPool();
  23. extern void testColoredNoise();
  24. extern void testFFTCrossFader();
  25. extern void testFinalLeaks();
  26. extern void testClockMult();
  27. extern void testTremolo();
  28. extern void testGateTrigger();
  29. extern void testAnalyzer();
  30. extern void testFilter();
  31. extern void testStochasticGrammar();
  32. extern void testGMR();
  33. extern void testLowpassFilter();
  34. extern void testPoly();
  35. extern void testVCO();
  36. extern void testFilterDesign();
  37. extern void testVCOAlias();
  38. extern void testSin();
  39. extern void testMinBLEPVCO();
  40. extern void testRateConversion();
  41. extern void testDelay();
  42. extern void testSpline(bool emit);
  43. extern void testButterLookup();
  44. int main(int argc, char ** argv)
  45. {
  46. bool runPerf = false;
  47. bool extended = false;
  48. bool runShaperGen = false;
  49. if (argc > 1) {
  50. std::string arg = argv[1];
  51. if (arg == "--ext") {
  52. extended = true;
  53. } else if (arg == "--perf") {
  54. runPerf = true;
  55. } else if (arg == "--shaper") {
  56. runShaperGen = true;
  57. } else {
  58. printf("%s is not a valid command line argument\n", arg.c_str());
  59. }
  60. }
  61. #ifdef _PERF
  62. runPerf = true;
  63. #ifndef NDEBUG
  64. #error asserts should be off for perf test
  65. #endif
  66. #endif
  67. // While this code may work in 32 bit applications, it's not tested for that.
  68. // Want to be sure we are testing the case we care about.
  69. assert(sizeof(size_t) == 8);
  70. if (runShaperGen) {
  71. testSpline(true);
  72. return 0;
  73. }
  74. testAudioMath();
  75. testRingBuffer();
  76. testGateTrigger();
  77. testManagedPool();
  78. testLookupTable();
  79. testObjectCache();
  80. testTestSignal();
  81. testBiquad();
  82. testSaw();
  83. testClockMult();
  84. testDelay();
  85. testPoly();
  86. testSinOscillator();
  87. testMinBLEPVCO();
  88. testHilbert();
  89. testButterLookup();
  90. testSpline(false);
  91. testVCO();
  92. // testSin();
  93. testFFT();
  94. testAnalyzer();
  95. testRateConversion();
  96. // printf("skipping lots of tests\n");
  97. #if 1
  98. testStateVariable();
  99. testFFTCrossFader();
  100. if (extended) {
  101. testThread(extended);
  102. }
  103. testLowpassFilter();
  104. testFilter();
  105. testStochasticGrammar();
  106. testGMR();
  107. // after testing all the components, test composites.
  108. testTremolo();
  109. testColoredNoise();
  110. testFrequencyShifter();
  111. testVocalAnimator();
  112. #endif
  113. if (runPerf) {
  114. perfTest();
  115. }
  116. testFilterDesign();
  117. testFinalLeaks();
  118. // When we run inside Visual Studio, don't exit debugger immediately
  119. #if defined(_MSC_VER)
  120. printf("Test passed. Press any key to continue...\n"); fflush(stdout);
  121. getchar();
  122. #else
  123. printf("Tests passed.\n");
  124. #endif
  125. }