blob: 8db48b65e56d35eb357c14cb8adc6ee849ca07cc [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) {
onqtamcfce1882017-04-02 17:31:55 +03005 doctest::Context context;
6
7 // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
onqtam7d5c0d52016-06-02 17:50:59 +03008
9 // defaults
10 context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in their name
11 context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
12
13 context.applyCommandLine(argc, argv);
onqtam4a655632016-05-26 14:20:52 +030014
15 // overrides
onqtamcfce1882017-04-02 17:31:55 +030016 context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
onqtambef26de2017-04-03 18:15:58 +030017 context.setOption("order-by", "name"); // sort the test cases by their name
onqtam4a655632016-05-26 14:20:52 +030018
19 int res = context.run(); // run
20
onqtamf720d432016-05-31 17:51:10 +030021 if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this
onqtam4a655632016-05-26 14:20:52 +030022 return res; // propagate the result of the tests
23
24 int client_stuff_return_code = 0;
25 // your program - if the testing framework is integrated in your production code
26
onqtam96bdf712016-09-13 16:45:52 +030027 return res + client_stuff_return_code; // the result from doctest is propagated here as well
onqtam4a655632016-05-26 14:20:52 +030028}