File tree 1 file changed +72
-0
lines changed
1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < catch2/catch_all.hpp>
2
+
3
+ #include < zeus/expected.hpp>
4
+
5
+ using namespace zeus ;
6
+
7
+ namespace
8
+ {
9
+
10
+ struct ConstructModeDistinction
11
+ {
12
+ enum ConstructedMode
13
+ {
14
+ kDefault ,
15
+ kCopy ,
16
+ kMove ,
17
+ kCopyAssign ,
18
+ kMoveAssign ,
19
+ };
20
+
21
+ constexpr ConstructModeDistinction () noexcept
22
+ : mode(kDefault )
23
+ {
24
+ }
25
+ constexpr ConstructModeDistinction (ConstructModeDistinction const &) noexcept
26
+ : mode(kCopy )
27
+ {
28
+ }
29
+ constexpr ConstructModeDistinction (ConstructModeDistinction&&) noexcept
30
+ : mode(kMove )
31
+ {
32
+ }
33
+ constexpr ConstructModeDistinction& operator =(ConstructModeDistinction&&) noexcept
34
+ {
35
+ mode = kMoveAssign ;
36
+ return *this ;
37
+ }
38
+ constexpr ConstructModeDistinction& operator =(ConstructModeDistinction const &) noexcept
39
+ {
40
+ mode = kCopyAssign ;
41
+ return *this ;
42
+ }
43
+
44
+ ConstructedMode mode;
45
+ };
46
+
47
+ } // namespace
48
+
49
+ SCENARIO (" Monad mo' problems" , " [LWG-3886]" )
50
+ {
51
+ using T = const ConstructModeDistinction;
52
+ using E = int ;
53
+
54
+ // FIXME LWG-3891
55
+ // SECTION("constructor")
56
+ // {
57
+ // expected<T, E> const e({});
58
+ // CHECK(e.value().mode == T::kMove);
59
+ // }
60
+ // SECTION("assignment")
61
+ // {
62
+ // expected<T, E> e {zeus::unexpect};
63
+ // e = {};
64
+ // CHECK(e.value().mode == T::kMove);
65
+ // }
66
+
67
+ SECTION (" value_or()" )
68
+ {
69
+ expected<T, E> const e {zeus::unexpect};
70
+ CHECK (e.value_or ({}).mode == T::kMove );
71
+ }
72
+ }
You can’t perform that action at this time.
0 commit comments