blob: 72a55d4643a42e6b78ee7e3812abd4bd1408e00f [file] [log] [blame]
onqtam4984dd72016-03-20 23:32:15 +02001#define DOCTEST_DISABLE
hardlyb1e7e142014-08-06 00:43:51 +03002
onqtam4984dd72016-03-20 23:32:15 +02003#define DOCTEST_IMPLEMENT_WITH_MAIN
hardlyb1e7e142014-08-06 00:43:51 +03004#include "doctest.h"
5
6#include <cstdio>
onqtamcf9812f2016-04-19 23:54:34 +03007#include <exception>
hardlyb1e7e142014-08-06 00:43:51 +03008
onqtamaa225822016-04-20 16:23:32 +03009TESTCASE("name1") {
hardlyb1e7e142014-08-06 00:43:51 +030010 printf("Anyone there?\n");
11}
12
onqtamaa225822016-04-20 16:23:32 +030013TESTSUITE("the testsuite!");
hardlyb1e7e142014-08-06 00:43:51 +030014
onqtam39b4e452016-04-20 00:58:06 +030015// to silence GCC "-Wmissing-declarations"
16// and the attribute is to silence "-Wmissing-noreturn" on clang
17#ifdef __clang__
18void throws() __attribute__((noreturn));
19#else
20void throws();
21#endif
22
onqtamcf9812f2016-04-19 23:54:34 +030023void throws() { throw std::exception(); }
24void nothrows(); // to silence GCC "-Wmissing-declarations"
25void nothrows() {}
26
onqtamaa225822016-04-20 16:23:32 +030027TESTCASE("ops") {
hardlyb1e7e142014-08-06 00:43:51 +030028 printf("Anyone there?\n");
onqtamcf9812f2016-04-19 23:54:34 +030029
onqtamaa225822016-04-20 16:23:32 +030030 CHECK(1 == 0);
31 CHECK_FALSE(1 == 0);
onqtamcf9812f2016-04-19 23:54:34 +030032
onqtamaa225822016-04-20 16:23:32 +030033 CHECK(1 == 1);
34 REQUIRE(1 == 1);
onqtamcf9812f2016-04-19 23:54:34 +030035
onqtamaa225822016-04-20 16:23:32 +030036 CHECK_FALSE(0);
37 REQUIRE_FALSE(0);
onqtamcf9812f2016-04-19 23:54:34 +030038
onqtamaa225822016-04-20 16:23:32 +030039 CHECK_THROWS(throws());
40 REQUIRE_THROWS(throws());
onqtamcf9812f2016-04-19 23:54:34 +030041
onqtamaa225822016-04-20 16:23:32 +030042 CHECK_THROWS_AS(throws(), std::exception);
43 REQUIRE_THROWS_AS(throws(), std::exception);
44
45 CHECK_NOTHROW(nothrows());
46 REQUIRE_NOTHROW(nothrows());
47
48 SUBCASE("") {}
hardlyb1e7e142014-08-06 00:43:51 +030049}
50
onqtamaa225822016-04-20 16:23:32 +030051TESTSUITE_END;
hardlyb1e7e142014-08-06 00:43:51 +030052
onqtam44cde122016-03-19 14:32:12 +020053#if defined(__GNUC__) && !defined(__clang__)
54#pragma GCC diagnostic ignored "-Weffc++"
55#endif
56
onqtam6b7eb052016-03-18 12:43:55 +020057struct Empty
58{};
hardlyb1e7e142014-08-06 00:43:51 +030059
onqtamaa225822016-04-20 16:23:32 +030060TESTCASE_FIXTURE(Empty, "name") {
hardlyb1e7e142014-08-06 00:43:51 +030061 printf("Help?\n");
62}
63
onqtamaa225822016-04-20 16:23:32 +030064TESTCASE_FIXTURE(Empty, "ops") {
hardlyb1e7e142014-08-06 00:43:51 +030065 printf("Help?\n");
66}