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.

52 lines
1.2KB

  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 testSaw();
  9. extern void testLookupTable();
  10. extern void testSinOscillator();
  11. extern void testHilbert();
  12. extern void testAudioMath();
  13. extern void perfTest();
  14. extern void testFrequencyShifter();
  15. int main(int argc, char ** argv)
  16. {
  17. bool runPerf = false;
  18. if (argc > 1) {
  19. std::string arg = argv[1];
  20. if (arg == "--perf") {
  21. runPerf = true;
  22. }
  23. }
  24. // While this code may work in 32 bit applications, it's not tested for that.
  25. // Want to be sure we are testing the case we care about.
  26. assert(sizeof(size_t) == 8);
  27. testAudioMath();
  28. testBiquad();
  29. testSaw();
  30. testLookupTable();
  31. testSinOscillator();
  32. testHilbert();
  33. // after testing all the components, test composites.
  34. testFrequencyShifter();
  35. if (runPerf) {
  36. perfTest();
  37. }
  38. // When we run inside Visual Studio, don't exit debugger immediately
  39. #if defined(_MSC_VER)
  40. printf("Test passed. Press any key to continue...\n"); fflush(stdout);
  41. getchar();
  42. #else
  43. printf("Tests passed.\n");
  44. #endif
  45. }