testrunner.cpp 818 B

1234567891011121314151617181920212223242526272829
  1. #include "CommandLineTestRunner.h"
  2. #include <stdio.h>
  3. #include "mbed.h"
  4. #include "testrunner.h"
  5. #include "test_env.h"
  6. /**
  7. Object 'mbed_cpputest_console' is used to show prints on console.
  8. It is declared in \cpputest\src\Platforms\armcc\UtestPlatform.cpp
  9. */
  10. Serial mbed_cpputest_console(STDIO_UART_TX, STDIO_UART_RX);
  11. int main(int ac, char** av) {
  12. MBED_HOSTTEST_TIMEOUT(20);
  13. MBED_HOSTTEST_SELECT(default_auto);
  14. MBED_HOSTTEST_DESCRIPTION(Unit test);
  15. MBED_HOSTTEST_START("UT");
  16. unsigned failureCount = 0;
  17. {
  18. // Some compilers may not pass ac, av so we need to supply them ourselves
  19. int ac = 2;
  20. char* av[] = {__FILE__, "-v"};
  21. failureCount = CommandLineTestRunner::RunAllTests(ac, av);
  22. }
  23. MBED_HOSTTEST_RESULT(failureCount == 0);
  24. return failureCount;
  25. }