onqtam | 4984dd7 | 2016-03-20 23:32:15 +0200 | [diff] [blame^] | 1 | //#define DOCTEST_DISABLE
|
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 2 |
|
onqtam | 4984dd7 | 2016-03-20 23:32:15 +0200 | [diff] [blame^] | 3 | #define DOCTEST_IMPLEMENT
|
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 4 | #include "doctest.h"
|
| 5 |
|
| 6 | #include <cstdio>
|
| 7 | #include <exception>
|
| 8 |
|
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 9 | static int testWrapper(void (*f)(void)) {
|
| 10 | try {
|
| 11 | f();
|
| 12 | } catch(std::exception& e) {
|
| 13 | printf("caught the bugger! %s\n", e.what());
|
| 14 | return 1;
|
| 15 | }
|
| 16 | return 0;
|
| 17 | }
|
| 18 |
|
| 19 | int main(int argc, char** argv) {
|
| 20 | // initialize
|
| 21 | doctest::Context context(argc, argv);
|
| 22 | context.setTestExecutionWrapper(testWrapper);
|
| 23 |
|
| 24 | // overrides
|
| 25 | context.setOption("dt-case-sensitive", true);
|
| 26 | context.addFilter("dt-name", "zzz");
|
| 27 |
|
| 28 | // run
|
| 29 | int res = context.runTests();
|
| 30 |
|
| 31 | #if defined(WITH_PAUSE)
|
| 32 | system("pause");
|
| 33 | #endif // _MSC_VER
|
| 34 |
|
| 35 | return res;
|
| 36 | }
|