doctest

FORK: The fastest feature-rich C++11/14/17/20 single-header testing framework
git clone https://git.neptards.moe/neptards/doctest.git
Log | Files | Refs | README

main.cpp (944B)


      1 #include "doctest.cpp"
      2 
      3 int main(int argc, char** argv) {
      4     doctest::Context context;
      5 
      6     // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
      7 
      8     // defaults
      9     context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name
     10     context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
     11 
     12     context.applyCommandLine(argc, argv);
     13 
     14     // overrides
     15     context.setOption("order-by", "file"); // sort the test cases by their name
     16 
     17     int res = context.run(); // run
     18 
     19     if(context.shouldExit()) // important - query flags (and --exit) rely on the user doing this
     20         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 
     25     return res + client_stuff_return_code; // the result from doctest is propagated here as well
     26 }