forked from mirror/doctest
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
944 B
C++
27 lines
944 B
C++
#include "doctest.cpp"
|
|
|
|
int main(int argc, char** argv) {
|
|
doctest::Context context;
|
|
|
|
// !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
|
|
|
|
// defaults
|
|
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name
|
|
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
|
|
|
context.applyCommandLine(argc, argv);
|
|
|
|
// overrides
|
|
context.setOption("order-by", "file"); // sort the test cases by their name
|
|
|
|
int res = context.run(); // run
|
|
|
|
if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this
|
|
return res; // propagate the result of the tests
|
|
|
|
int client_stuff_return_code = 0;
|
|
// your program - if the testing framework is integrated in your production code
|
|
|
|
return res + client_stuff_return_code; // the result from doctest is propagated here as well
|
|
}
|