summaryrefslogtreecommitdiff
path: root/examples/all_features/assertion_macros.cpp
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2017-04-16 22:35:27 +0300
committeronqtam <vik.kirilov@gmail.com>2017-05-16 00:22:20 +0300
commit12d5598f5ae6f1b86ccf89a19122e3db83d477f6 (patch)
tree55d1cb2c19d55ba16e315bb1b4c24efc63cf4412 /examples/all_features/assertion_macros.cpp
parent98e12afbf11d69bb4507ebb32ccc946a96b8310b (diff)
everything compiles!
Diffstat (limited to 'examples/all_features/assertion_macros.cpp')
-rw-r--r--examples/all_features/assertion_macros.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/all_features/assertion_macros.cpp b/examples/all_features/assertion_macros.cpp
index 9e44a0e..9d339af 100644
--- a/examples/all_features/assertion_macros.cpp
+++ b/examples/all_features/assertion_macros.cpp
@@ -1,11 +1,13 @@
#include "doctest.h"
-template<typename T>
+#include <stdexcept>
+
+template <typename T>
static int conditional_throw(bool in, const T& ex) {
if(in)
#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
throw ex;
-#else // DOCTEST_CONFIG_NO_EXCEPTIONS
+#else // DOCTEST_CONFIG_NO_EXCEPTIONS
((void)ex);
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
return 42;
@@ -15,13 +17,17 @@ using doctest::Approx;
TEST_SUITE("meaningless macros") {
TEST_CASE("an empty test that will succeed") {}
-
- TEST_CASE("an empty test that will fail because of an exception") { conditional_throw(true, 0); }
+
+ TEST_CASE("an empty test that will fail because of an exception") {
+ conditional_throw(true, 0);
+ }
}
TEST_SUITE_BEGIN("meaningless macros");
-TEST_CASE("an empty test that will fail because of a std::exception") { conditional_throw(true, std::runtime_error("whops!")); }
+TEST_CASE("an empty test that will fail because of a std::exception") {
+ conditional_throw(true, std::runtime_error("whops!"));
+}
TEST_SUITE_END();