all assertion macros working!
diff --git a/examples/dev_testing/main.cpp b/examples/dev_testing/main.cpp
index 495f93e..92ba056 100644
--- a/examples/dev_testing/main.cpp
+++ b/examples/dev_testing/main.cpp
@@ -1,5 +1,6 @@
//#define DOCTEST_DISABLE
+//#include "doctest.h"
#define DOCTEST_IMPLEMENT
#include "doctest.h"
@@ -10,7 +11,7 @@
try {
f();
} catch(std::exception& e) {
- printf("caught the bugger! %s\n", e.what());
+ printf("caught a std::exception! %s\n", e.what());
return 1;
}
return 0;
diff --git a/examples/dev_testing/test.cpp b/examples/dev_testing/test.cpp
index 4251112..8517cf4 100644
--- a/examples/dev_testing/test.cpp
+++ b/examples/dev_testing/test.cpp
@@ -4,7 +4,9 @@
#include <cstdio>
+#include <exception>
#include <string>
+
namespace doctest
{
namespace detail
@@ -16,7 +18,7 @@
testsuite(MAIN);
testcase(zzz) {
- check(true == false);
+ require(true == false);
check(std::string("OMG2") == std::string("OMG"));
printf("main\n");
@@ -50,8 +52,27 @@
// test("") { printf("TEST %d\n", __LINE__); }
// test("") { printf("TEST %d\n", __LINE__); }
-testcase(zzz) {
- CHECK(1 == 1);
- CHECK_FALSE(1 == 1);
+void throws(); // to silence GCC "-Wmissing-declarations"
+void throws() { throw std::exception(); }
+void nothrows(); // to silence GCC "-Wmissing-declarations"
+void nothrows() {}
+testcase(zzz) {
+ check(1 == 0);
+ check_false(1 == 0);
+
+ check(1 == 1);
+ require(1 == 1);
+
+ check_false(0);
+ require_false(0);
+
+ check_throws(throws());
+ require_throws(throws());
+
+ check_throws_as(throws(), std::exception);
+ require_throws_as(throws(), std::exception);
+
+ check_nothrow(nothrows());
+ require_nothrow(nothrows());
}