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