|
@@ -30,14 +30,14 @@ public:
|
|
|
|
|
|
|
|
void test_optional_flatmap_can_become_empty() {
|
|
void test_optional_flatmap_can_become_empty() {
|
|
|
auto strm = stream::optional::make_stream(5);
|
|
auto strm = stream::optional::make_stream(5);
|
|
|
- auto discard_odd = [](int i) { return i%2==0? std::optional<int>(i) : nullopt; };
|
|
|
|
|
|
|
+ auto discard_odd = [](int i) { return i%2==0? std::optional<int>(i) : std::nullopt; };
|
|
|
std::optional<int> out = strm.flatmap(discard_odd);
|
|
std::optional<int> out = strm.flatmap(discard_odd);
|
|
|
TS_ASSERT(!out);
|
|
TS_ASSERT(!out);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void test_optional_flatmap_can_remain_exists() {
|
|
void test_optional_flatmap_can_remain_exists() {
|
|
|
auto strm = stream::optional::make_stream(6);
|
|
auto strm = stream::optional::make_stream(6);
|
|
|
- auto discard_odd = [](int i) { return i%2==0? std::optional<int>(i) : nullopt; };
|
|
|
|
|
|
|
+ auto discard_odd = [](int i) { return i%2==0? std::optional<int>(i) : std::nullopt; };
|
|
|
std::optional<int> out = strm.flatmap(discard_odd);
|
|
std::optional<int> out = strm.flatmap(discard_odd);
|
|
|
TS_ASSERT(out);
|
|
TS_ASSERT(out);
|
|
|
TS_ASSERT_EQUALS(*out, 6);
|
|
TS_ASSERT_EQUALS(*out, 6);
|