blob: 14b9e04fabca862df60c553643b764775cc2d2f7 [file] [log] [blame]
onqtam862a3bb2016-04-27 18:19:00 +03001//#define DOCTEST_CONFIG_DISABLE
onqtamf921d3f2016-03-18 11:34:18 +02002
hardlyb1e7e142014-08-06 00:43:51 +03003#include "doctest.h"
4
onqtamb57e0c42016-03-18 11:37:04 +02005#include <cstdio>
6
onqtamcf9812f2016-04-19 23:54:34 +03007#include <exception>
onqtamf921d3f2016-03-18 11:34:18 +02008#include <string>
onqtamcf9812f2016-04-19 23:54:34 +03009
onqtamf921d3f2016-03-18 11:34:18 +020010namespace doctest
hardlyb1e7e142014-08-06 00:43:51 +030011{
onqtamff2a7802016-03-22 16:03:22 +020012namespace detail
13{
onqtam0cea9bc2016-04-27 12:59:08 +030014 template <>
15 String stringify(const std::string& in) {
16 return String("\"") + in.c_str() + "\"";
17 }
onqtamff2a7802016-03-22 16:03:22 +020018} // namespace detail
onqtamf921d3f2016-03-18 11:34:18 +020019} // namespace doctest
hardlyb1e7e142014-08-06 00:43:51 +030020
onqtamaa225822016-04-20 16:23:32 +030021TESTSUITE("MAIN");
22TESTCASE("zzz") {
onqtamaa225822016-04-20 16:23:32 +030023 CHECK(std::string("OMG2") == std::string("OMG"));
onqtamf921d3f2016-03-18 11:34:18 +020024
onqtam0cea9bc2016-04-27 12:59:08 +030025
26 //REQUIRE(true == false);
27 //
28 //printf("main\n");
29 //SUBCASE("") {
30 // printf("1\n");
31 // SUBCASE("") { printf("1-1\n"); }
32 // SUBCASE("") { printf("1-2\n"); }
33 //}
34 //SUBCASE("") { printf("2\n"); }
hardlyb1e7e142014-08-06 00:43:51 +030035}
onqtamaa225822016-04-20 16:23:32 +030036TESTSUITE_END;
hardlyb1e7e142014-08-06 00:43:51 +030037
onqtam44cde122016-03-19 14:32:12 +020038#if defined(__GNUC__) && !defined(__clang__)
39#pragma GCC diagnostic ignored "-Weffc++"
40#endif
41
onqtamf921d3f2016-03-18 11:34:18 +020042struct Empty
onqtam6b7eb052016-03-18 12:43:55 +020043{};
hardlyb1e7e142014-08-06 00:43:51 +030044
onqtamaa225822016-04-20 16:23:32 +030045TESTCASE_FIXTURE(Empty, "trololo") { printf("Help?\n"); }
onqtamf921d3f2016-03-18 11:34:18 +020046
47// test("") { printf("TEST %d\n", __LINE__); }
48// test("") { printf("TEST %d\n", __LINE__); }
49// test("") { printf("TEST %d\n", __LINE__); }
50// test("") { printf("TEST %d\n", __LINE__); }
51// test("") { printf("TEST %d\n", __LINE__); }
52// test("") { printf("TEST %d\n", __LINE__); }
53// test("") { printf("TEST %d\n", __LINE__); }
54// test("") { printf("TEST %d\n", __LINE__); }
55// test("") { printf("TEST %d\n", __LINE__); }
56// test("") { printf("TEST %d\n", __LINE__); }
57// test("") { printf("TEST %d\n", __LINE__); }
onqtam1cda0962016-04-19 17:40:43 +030058
onqtam39b4e452016-04-20 00:58:06 +030059// to silence GCC "-Wmissing-declarations"
60// and the attribute is to silence "-Wmissing-noreturn" on clang
61#ifdef __clang__
62void throws() __attribute__((noreturn));
63#else
64void throws();
65#endif
66
onqtamcf9812f2016-04-19 23:54:34 +030067void throws() { throw std::exception(); }
68void nothrows(); // to silence GCC "-Wmissing-declarations"
69void nothrows() {}
onqtam1cda0962016-04-19 17:40:43 +030070
onqtamaa225822016-04-20 16:23:32 +030071TESTCASE("zzz") {
onqtamcf9812f2016-04-19 23:54:34 +030072
onqtam6e23bef2016-04-26 14:06:11 +030073 int a = 5;
74 int b = 5;
75 CHECK(&a == &b);
76
onqtamaa225822016-04-20 16:23:32 +030077 CHECK(1 == 1);
78 REQUIRE(1 == 1);
onqtamcf9812f2016-04-19 23:54:34 +030079
onqtamaa225822016-04-20 16:23:32 +030080 CHECK_FALSE(0);
81 REQUIRE_FALSE(0);
onqtamcf9812f2016-04-19 23:54:34 +030082
onqtamaa225822016-04-20 16:23:32 +030083 CHECK_THROWS(throws());
84 REQUIRE_THROWS(throws());
onqtamcf9812f2016-04-19 23:54:34 +030085
onqtamaa225822016-04-20 16:23:32 +030086 CHECK_THROWS_AS(throws(), std::exception);
87 REQUIRE_THROWS_AS(throws(), std::exception);
onqtamcf9812f2016-04-19 23:54:34 +030088
onqtamaa225822016-04-20 16:23:32 +030089 CHECK_NOTHROW(nothrows());
90 REQUIRE_NOTHROW(nothrows());
onqtam1cda0962016-04-19 17:40:43 +030091}