Skip to content

Commit

Permalink
Guard tests for std::hash<std::expected<>> that is not available with…
Browse files Browse the repository at this point in the history
… std::expected (#66)
  • Loading branch information
martinmoene committed Jun 5, 2024
1 parent d3f27c4 commit 653e4c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/expected.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,10 +1977,14 @@ CASE( "swap: Allows expected to be swapped" )

CASE( "std::hash: Allows to compute hash value for expected" )
{
#if !nsel_USES_STD_EXPECTED
expected<int, char> a{ 7 };
expected<int, char> b{ 7 };

EXPECT( (std::hash< expected<int, char> >{}( a )) == (std::hash< expected<int, char> >{}( b )) );
#else
EXPECT( !!"std::hash<std::expected<>> is not available for std::unexpected (C++23)." );
#endif
}

#if nsel_P0323R <= 3
Expand Down

0 comments on commit 653e4c2

Please sign in to comment.