From 648860d11f921c045cbb9d89c7a5329cb83b81cf Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Sat, 30 Sep 2023 13:58:03 +0200 Subject: [PATCH] Painting the shelve with test specifications (#60) [skip-ci] --- README.md | 20 ++++++++++---------- test/expected.t.cpp | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index cec6718..541594e 100644 --- a/README.md +++ b/README.md @@ -455,11 +455,11 @@ expected: Allows to query if it contains an exception of a specific base type expected: Allows to observe its value if available, or obtain a specified value otherwise expected: Allows to move its value if available, or obtain a specified value otherwise expected: Throws bad_expected_access on value access when disengaged -expected: Allows to observe its unexpected value, or fallback to the specified value with error_or -expected: Allows to map value with and_then -expected: Handling unexpected with or_else -expected: transform values -expected: Mapping errors with transform_error +expected: Allows to observe its unexpected value, or fallback to the specified value with error_or [monadic p2505r4] +expected: Allows to map value with and_then [monadic p2505r3] +expected: Allows to map unexpected with or_else [monadic p2505r3] +expected: Allows to transform value [monadic p2505r3] +expected: Allows to map errors with transform_error [monadic p2505r3] expected: Allows to default-construct expected: Allows to copy-construct from expected: value expected: Allows to copy-construct from expected: error @@ -486,11 +486,11 @@ expected: Allows to move its error expected: Allows to observe its error as unexpected expected: Allows to query if it contains an exception of a specific base type expected: Throws bad_expected_access on value access when disengaged -expected: Observe unexpected value, or fallback to a default value with error_or -expected: calling argless functions with and_then -expected: or_else unexpected handling works -expected: using transform to assign a new expected value -expected: transform_error maps unexpected values +expected: Allows to observe unexpected value, or fallback to a default value with error_or [monadic p2505r4] +expected: Allows to call argless functions with and_then [monadic p2505r3] +expected: Allows to map to expected or unexpected with or_else [monadic p2505r3] +expected: Allows to assign a new expected value using transform [monadic p2505r3] +expected: Allows to map unexpected error value via transform_error [monadic p2505r3] operators: Provides expected relational operators operators: Provides expected relational operators (void) swap: Allows expected to be swapped diff --git a/test/expected.t.cpp b/test/expected.t.cpp index f933778..10f5dcf 100644 --- a/test/expected.t.cpp +++ b/test/expected.t.cpp @@ -1241,7 +1241,7 @@ CASE( "expected: Throws bad_expected_access on value access when disengaged" ) } #if nsel_P2505R >= 4 -CASE( "expected: Allows to observe its unexpected value, or fallback to the specified value with error_or" ) +CASE( "expected: Allows to observe its unexpected value, or fallback to the specified value with error_or" " [monadic p2505r4]") { const auto ve = 3; const auto vu = 7; @@ -1254,7 +1254,7 @@ CASE( "expected: Allows to observe its unexpected value, or fallback to the spec #endif // nsel_P2505R >= 4 #if nsel_P2505R >= 3 -CASE( "expected: Allows to map value with and_then" ) +CASE( "expected: Allows to map value with and_then" " [monadic p2505r3]" ) { const auto mul2 = []( int n ) -> expected { return n * 2; }; const auto to_unexpect42 = []( int ) -> expected { return make_unexpected( 42 ); }; @@ -1285,7 +1285,7 @@ CASE( "expected: Allows to map value with and_then" ) EXPECT( (expected(3)).and_then( map_to_void_unexpect42 ).error() == 42 ); } -CASE( "expected: Handling unexpected with or_else" ) +CASE( "expected: Allows to map unexpected with or_else" " [monadic p2505r3]" ) { const auto to_unexpect43 = []( int ) -> expected { return make_unexpected( 43 ); }; @@ -1308,7 +1308,7 @@ CASE( "expected: Handling unexpected with or_else" ) EXPECT( (expected{ unexpect, 15 }).or_else(moveonly_fallback_to_66).value() == 66 ); } -CASE( "expected: transform values" ) +CASE( "expected: Allows to transform value" " [monadic p2505r3]" ) { const auto mul2 = []( int n ) -> int { return n * 2; }; @@ -1345,7 +1345,7 @@ CASE( "expected: transform values" ) "transform to void results in void value" ); } -CASE( "expected: Mapping errors with transform_error" ) +CASE( "expected: Allows to map errors with transform_error" " [monadic p2505r3]" ) { const auto to_43 = []( int ) -> int { return 43; }; @@ -1660,7 +1660,7 @@ CASE( "expected: Throws bad_expected_access on value access when disengage } #if nsel_P2505R >= 4 -CASE( "expected: Observe unexpected value, or fallback to a default value with error_or" ) +CASE( "expected: Allows to observe unexpected value, or fallback to a default value with error_or" " [monadic p2505r4]" ) { const auto vu = 7; expected e; @@ -1672,7 +1672,7 @@ CASE( "expected: Observe unexpected value, or fallback to a default value #endif // nsel_P2505R >= 4 #if nsel_P2505R >= 3 -CASE( "expected: calling argless functions with and_then" ) +CASE( "expected: Allows to call argless functions with and_then" " [monadic p2505r3]" ) { const auto ret22 = []() -> expected { return 22; }; const auto unexpect32 = []() -> expected { return make_unexpected( 32 ); }; @@ -1724,7 +1724,7 @@ CASE( "expected: calling argless functions with and_then" ) EXPECT( map_to_unexpect_success ); } -CASE( "expected: or_else unexpected handling works" ) +CASE( "expected: Allows to map to expected or unexpected with or_else" " [monadic p2505r3]" ) { const auto make_valid = [](int) -> expected { return {}; }; const auto unexpect32 = [](int) -> expected { return make_unexpected( 32 ); }; @@ -1747,7 +1747,7 @@ CASE( "expected: or_else unexpected handling works" ) } } -CASE( "expected: using transform to assign a new expected value" ) +CASE( "expected: Allows to assign a new expected value using transform" " [monadic p2505r3]" ) { const auto make_int_32 = [] { return 32; }; const auto mul2 = [](int v) { return v * 2; }; @@ -1757,7 +1757,7 @@ CASE( "expected: using transform to assign a new expected value" ) EXPECT( e.transform( make_int_32 ).transform( mul2 ).value() == 64 ); } -CASE( "expected: transform_error maps unexpected values" ) +CASE( "expected: Allows to map unexpected error value via transform_error" " [monadic p2505r3]" ) { const auto mul2 = []( int v ) -> int { return v * 2; }; enum class my_error { einval };