onqtam | a985f5a | 2017-04-16 22:48:07 +0300 | [diff] [blame] | 1 | #include "parts/doctest_impl.h" |
| 2 | |
| 3 | int main(int argc, char** argv) { |
| 4 | doctest::Context context; |
| 5 | |
| 6 | // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!! |
| 7 | |
| 8 | // defaults |
| 9 | context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name |
| 10 | context.setOption("no-breaks", true); // don't break in the debugger when assertions fail |
| 11 | |
| 12 | context.applyCommandLine(argc, argv); |
| 13 | |
| 14 | // overrides |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame^] | 15 | context.setOption("order-by", "file"); // sort the test cases by their name |
onqtam | a985f5a | 2017-04-16 22:48:07 +0300 | [diff] [blame] | 16 | |
| 17 | int res = context.run(); // run |
| 18 | |
| 19 | if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this |
| 20 | return res; // propagate the result of the tests |
| 21 | |
| 22 | int client_stuff_return_code = 0; |
| 23 | // your program - if the testing framework is integrated in your production code |
| 24 | |
| 25 | #ifdef WITH_PAUSE |
| 26 | system("pause"); |
| 27 | #endif // WITH_PAUSE |
| 28 | |
| 29 | return res + client_stuff_return_code; // the result from doctest is propagated here as well |
| 30 | } |