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.

209 lines
4.5KB

  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 perfTest2();
  16. extern void testFrequencyShifter();
  17. extern void testStateVariable();
  18. extern void testVocalAnimator();
  19. extern void testObjectCache();
  20. extern void testThread(bool exended);
  21. extern void testFFT();
  22. extern void testRingBuffer();
  23. extern void testManagedPool();
  24. extern void testColoredNoise();
  25. extern void testFFTCrossFader();
  26. extern void testFinalLeaks();
  27. extern void testClockMult();
  28. extern void testTremolo();
  29. extern void testGateTrigger();
  30. extern void testAnalyzer();
  31. extern void testFilter();
  32. extern void testStochasticGrammar();
  33. extern void testGMR();
  34. extern void testLowpassFilter();
  35. extern void testPoly();
  36. extern void testVCO();
  37. extern void testFilterDesign();
  38. extern void testVCOAlias();
  39. extern void testSin();
  40. extern void testMinBLEPVCO();
  41. extern void testRateConversion();
  42. extern void testDelay();
  43. extern void testSpline(bool emit);
  44. extern void testButterLookup();
  45. extern void testMidiDataModel();
  46. extern void testMidiSong();
  47. extern void testReplaceCommand();
  48. extern void testUndoRedo();
  49. extern void testMidiViewport();
  50. extern void testFilteredIterator();
  51. extern void testMidiEvents();
  52. extern void testMidiControllers();
  53. extern void testMidiPlayer();
  54. extern void testMultiLag();
  55. extern void testUtils();
  56. extern void testIComposite();
  57. extern void testMidiEditor();
  58. extern void testNoteScreenScale();
  59. #if 0
  60. #include <sstream>
  61. #include <iostream>
  62. static void xx()
  63. {
  64. std::stringstream s;
  65. for (int i = 0; i < 10; ++i) {
  66. s << "A" << i << "_PARAM," << std::endl;
  67. }
  68. for (int i = 0; i < 10; ++i) {
  69. s << "B" << i << "_PARAM," << std::endl;
  70. }
  71. for (int i = 0; i < 10; ++i) {
  72. for (int j = 0; j < 10; ++j) {
  73. s << "A" << i << "B" << j << "_PARAM," << std::endl;
  74. }
  75. }
  76. std::cout << s.str();
  77. }
  78. #endif
  79. int main(int argc, char ** argv)
  80. {
  81. // xx();
  82. bool runPerf = false;
  83. bool extended = false;
  84. bool runShaperGen = false;
  85. if (argc > 1) {
  86. std::string arg = argv[1];
  87. if (arg == "--ext") {
  88. extended = true;
  89. } else if (arg == "--perf") {
  90. runPerf = true;
  91. } else if (arg == "--shaper") {
  92. runShaperGen = true;
  93. } else {
  94. printf("%s is not a valid command line argument\n", arg.c_str());
  95. }
  96. }
  97. #ifdef _PERF
  98. runPerf = true;
  99. #ifndef NDEBUG
  100. #error asserts should be off for perf test
  101. #endif
  102. #endif
  103. // While this code may work in 32 bit applications, it's not tested for that.
  104. // Want to be sure we are testing the case we care about.
  105. assert(sizeof(size_t) == 8);
  106. if (runShaperGen) {
  107. testSpline(true);
  108. return 0;
  109. }
  110. testIComposite();
  111. testMidiEvents();
  112. testFilteredIterator();
  113. testMidiDataModel();
  114. testMidiSong();
  115. testMidiPlayer();
  116. testReplaceCommand();
  117. testUndoRedo();
  118. testMidiViewport();
  119. testMidiControllers();
  120. testMidiEditor();
  121. testNoteScreenScale();
  122. testAudioMath();
  123. testRingBuffer();
  124. testGateTrigger();
  125. testManagedPool();
  126. testLookupTable();
  127. testObjectCache();
  128. //#ifndef _MSC_VER
  129. #if !defined(_MSC_VER) || !defined(_MIDIONLY)
  130. testTestSignal();
  131. testBiquad();
  132. testSaw();
  133. testClockMult();
  134. testDelay();
  135. testPoly();
  136. testSinOscillator();
  137. testMinBLEPVCO();
  138. testHilbert();
  139. testButterLookup();
  140. testVCO();
  141. // testSin();
  142. testFFT();
  143. testAnalyzer();
  144. testRateConversion();
  145. testUtils();
  146. #if 0
  147. printf("skipping lots of tests\n");
  148. #else
  149. testSpline(false);
  150. testStateVariable();
  151. testFFTCrossFader();
  152. if (extended) {
  153. testThread(extended);
  154. }
  155. testLowpassFilter();
  156. testFilter();
  157. testMultiLag();
  158. testStochasticGrammar();
  159. testGMR();
  160. // after testing all the components, test composites.
  161. testTremolo();
  162. testColoredNoise();
  163. testFrequencyShifter();
  164. testVocalAnimator();
  165. #endif
  166. if (runPerf) {
  167. perfTest();
  168. perfTest2();
  169. }
  170. testFilterDesign();
  171. #else
  172. printf("disabled lots of tests for MS\n");
  173. #endif
  174. testFinalLeaks();
  175. // When we run inside Visual Studio, don't exit debugger immediately
  176. #if defined(_MSC_VER_not)
  177. printf("Test passed. Press any key to continue...\n"); fflush(stdout);
  178. getchar();
  179. #else
  180. printf("Tests passed.\n");
  181. #endif
  182. }