-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathcnstr.default.cpp
More file actions
58 lines (45 loc) · 1.22 KB
/
cnstr.default.cpp
File metadata and controls
58 lines (45 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Eggs.Variant
//
// Copyright Agustin K-ballo Berge, Fusion Fenix 2014-2018
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <eggs/variant.hpp>
#include <string>
#include <eggs/variant/detail/config/prefix.hpp>
#include "catch.hpp"
#include "constexpr.hpp"
TEST_CASE("variant<Ts...>::variant()", "[variant.cnstr]")
{
eggs::variant<int, std::string> v;
CHECK(bool(v) == false);
CHECK(v.which() == eggs::variant_npos);
CHECK(v.target() == nullptr);
#if EGGS_CXX98_HAS_RTTI
CHECK(v.target_type() == typeid(void));
#endif
CHECK(noexcept(eggs::variant<int, std::string>()) == true);
#if EGGS_CXX11_HAS_CONSTEXPR
// constexpr
{
constexpr eggs::variant<Constexpr> v;
}
#endif
}
TEST_CASE("variant<>::variant()", "[variant.cnstr]")
{
eggs::variant<> v;
CHECK(bool(v) == false);
CHECK(v.which() == eggs::variant_npos);
CHECK(v.target() == nullptr);
#if EGGS_CXX98_HAS_RTTI
CHECK(v.target_type() == typeid(void));
#endif
CHECK(noexcept(eggs::variant<>()) == true);
#if EGGS_CXX11_HAS_CONSTEXPR
// constexpr
{
constexpr eggs::variant<> v;
}
#endif
}