blob: 227ce21319a03971fef4e42047f6d0bbdbc3e178 [file] [log] [blame]
onqtam4a655632016-05-26 14:20:52 +03001#define DOCTEST_CONFIG_IMPLEMENT
2#include "doctest.h"
3
4int main(int argc, char** argv) {
onqtam7d5c0d52016-06-02 17:50:59 +03005 doctest::Context context; // initialize
6
7 // defaults
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
11 context.applyCommandLine(argc, argv);
onqtam4a655632016-05-26 14:20:52 +030012
13 // overrides
onqtam7d5c0d52016-06-02 17:50:59 +030014 context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
15 context.setOption("sort", "name"); // sort the test cases by their name
onqtam4a655632016-05-26 14:20:52 +030016
17 int res = context.run(); // run
18
onqtamf720d432016-05-31 17:51:10 +030019 if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this
onqtam4a655632016-05-26 14:20:52 +030020 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
onqtam96bdf712016-09-13 16:45:52 +030025 return res + client_stuff_return_code; // the result from doctest is propagated here as well
onqtam4a655632016-05-26 14:20:52 +030026}