onqtam | 4a65563 | 2016-05-26 14:20:52 +0300 | [diff] [blame] | 1 | #define DOCTEST_CONFIG_IMPLEMENT |
| 2 | #include "doctest.h" |
| 3 | |
| 4 | int main(int argc, char** argv) { |
| 5 | doctest::Context context(argc, argv); // initialize |
| 6 | |
| 7 | // overrides |
| 8 | context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in their name |
| 9 | context.setOption("no-breaks", true); // don't break in the debugger when assertions fail |
| 10 | context.setOption("abort-after", 5); // stop test execution after 5 failed assertions |
| 11 | context.setOption("sort", "name"); // sort the test cases by their name |
| 12 | |
| 13 | int res = context.run(); // run |
| 14 | |
onqtam | f720d43 | 2016-05-31 17:51:10 +0300 | [diff] [blame^] | 15 | if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this |
onqtam | 4a65563 | 2016-05-26 14:20:52 +0300 | [diff] [blame] | 16 | return res; // propagate the result of the tests |
| 17 | |
| 18 | int client_stuff_return_code = 0; |
| 19 | // your program - if the testing framework is integrated in your production code |
| 20 | |
| 21 | return res + client_stuff_return_code; |
| 22 | } |