mbed-os
Fork of mbed-os by
features/unsupported/tests/utest/testrunner/testrunner.cpp@1:3deb71413561, 2017-07-20 (annotated)
- Committer:
- xuaner
- Date:
- Thu Jul 20 14:26:57 2017 +0000
- Revision:
- 1:3deb71413561
- Parent:
- 0:f269e3021894
mbed_os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #include "CommandLineTestRunner.h" |
elessair | 0:f269e3021894 | 2 | #include <stdio.h> |
elessair | 0:f269e3021894 | 3 | #include "mbed.h" |
elessair | 0:f269e3021894 | 4 | #include "testrunner.h" |
elessair | 0:f269e3021894 | 5 | #include "test_env.h" |
elessair | 0:f269e3021894 | 6 | |
elessair | 0:f269e3021894 | 7 | /** |
elessair | 0:f269e3021894 | 8 | Object 'mbed_cpputest_console' is used to show prints on console. |
elessair | 0:f269e3021894 | 9 | It is declared in \cpputest\src\Platforms\armcc\UtestPlatform.cpp |
elessair | 0:f269e3021894 | 10 | */ |
elessair | 0:f269e3021894 | 11 | Serial mbed_cpputest_console(STDIO_UART_TX, STDIO_UART_RX); |
elessair | 0:f269e3021894 | 12 | |
elessair | 0:f269e3021894 | 13 | int main(int ac, char** av) { |
elessair | 0:f269e3021894 | 14 | MBED_HOSTTEST_TIMEOUT(20); |
elessair | 0:f269e3021894 | 15 | MBED_HOSTTEST_SELECT(default_auto); |
elessair | 0:f269e3021894 | 16 | MBED_HOSTTEST_DESCRIPTION(Unit test); |
elessair | 0:f269e3021894 | 17 | MBED_HOSTTEST_START("UT"); |
elessair | 0:f269e3021894 | 18 | |
elessair | 0:f269e3021894 | 19 | unsigned failureCount = 0; |
elessair | 0:f269e3021894 | 20 | { |
elessair | 0:f269e3021894 | 21 | // Some compilers may not pass ac, av so we need to supply them ourselves |
elessair | 0:f269e3021894 | 22 | int ac = 2; |
elessair | 0:f269e3021894 | 23 | char* av[] = {__FILE__, "-v"}; |
elessair | 0:f269e3021894 | 24 | failureCount = CommandLineTestRunner::RunAllTests(ac, av); |
elessair | 0:f269e3021894 | 25 | } |
elessair | 0:f269e3021894 | 26 | |
elessair | 0:f269e3021894 | 27 | MBED_HOSTTEST_RESULT(failureCount == 0); |
elessair | 0:f269e3021894 | 28 | return failureCount; |
elessair | 0:f269e3021894 | 29 | } |