Skip to content

Commit d99ad48

Browse files
committed
added tests to ensure bool combinators of optionals work
1 parent d9f9469 commit d99ad48

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/optional19.lib/optional19/Optional.test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ TEST(Optional, int) {
3838

3939
ASSERT_FALSE(constOpt && [](int v) { return v > 42; });
4040
ASSERT_TRUE(constOpt && [](int v) { return v > 0; });
41+
42+
if (optInt && constOpt) {
43+
// compiles?
44+
}
45+
if (optInt || constOpt) {
46+
// compiles?
47+
}
4148
}
4249

4350
auto optInt = OptInt{};

src/optional19.lib/optional19/PackedOptional.test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ TEST(PackedOptional, defaultOfInt) {
3838

3939
ASSERT_FALSE(constOpt && [](int v) { return v > 42; });
4040
ASSERT_TRUE(constOpt && [](int v) { return v > 0; });
41+
42+
if (optInt && constOpt) {
43+
// compiles?
44+
}
45+
if (optInt || constOpt) {
46+
// compiles?
47+
}
4148
}
4249

4350
auto optInt = OptInt{};

0 commit comments

Comments
 (0)