Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests/Compilation.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2024-04-08 13:15:31 +0200
committerMartin Hořeňovský2024-04-08 13:15:35 +0200
commit05fb437cbbf60de794a7101c5e6ef8f650755ce4 (patch)
tree96f04eff6f27debfec3eedfaa995214ea10e6454 /tests/SelfTest/UsageTests/Compilation.tests.cpp
parent71b11c4e3328090d2ec72268299e3fb9e0ac3f8e (diff)
downloadcatch3-05fb437cbbf60de794a7101c5e6ef8f650755ce4.tar.gz
Fix & extend tests for comparing const instances of zero lit types
Diffstat (limited to 'tests/SelfTest/UsageTests/Compilation.tests.cpp')
-rw-r--r--tests/SelfTest/UsageTests/Compilation.tests.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp
index ebb2add6..a7fbf08f 100644
--- a/tests/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp
@@ -405,14 +405,26 @@ TEST_CASE( "#2555 - types that can only be compared with 0 literal implemented a
// have the ambiguity issue) for `==` and `!=`.
TEST_CASE( "Comparing const instances of type registered with capture_by_value",
"[regression][approvals][compilation]" ) {
- auto const const_Lit0Type_1 = TypeWithLit0Comparisons{};
- auto const const_Lit0Type_2 = TypeWithLit0Comparisons{};
- REQUIRE( const_Lit0Type_1 == const_Lit0Type_2 );
- REQUIRE( const_Lit0Type_1 <= const_Lit0Type_2 );
- REQUIRE( const_Lit0Type_1 < const_Lit0Type_2 );
- REQUIRE( const_Lit0Type_1 >= const_Lit0Type_2 );
- REQUIRE( const_Lit0Type_1 > const_Lit0Type_2 );
- REQUIRE_FALSE( const_Lit0Type_1 != const_Lit0Type_2 );
+ SECTION("Type with consteval-int constructor") {
+ auto const const_Lit0Type_1 = TypeWithConstevalLit0Comparison{};
+ auto const const_Lit0Type_2 = TypeWithConstevalLit0Comparison{};
+ REQUIRE( const_Lit0Type_1 == const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 <= const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 < const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 >= const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 > const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 != const_Lit0Type_2 );
+ }
+ SECTION("Type with constexpr-int constructor") {
+ auto const const_Lit0Type_1 = TypeWithLit0Comparisons{};
+ auto const const_Lit0Type_2 = TypeWithLit0Comparisons{};
+ REQUIRE( const_Lit0Type_1 == const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 <= const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 < const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 >= const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 > const_Lit0Type_2 );
+ REQUIRE( const_Lit0Type_1 != const_Lit0Type_2 );
+ }
}
#endif // C++20 consteval