From bc524d70253a4ab2fe40c3ca3e5666e267c0a4d1 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sun, 29 Jun 2025 19:25:29 +0100 Subject: import catch2 3.8.1 --- tests/SelfTest/IntrospectiveTests/Traits.tests.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/SelfTest/IntrospectiveTests/Traits.tests.cpp (limited to 'tests/SelfTest/IntrospectiveTests/Traits.tests.cpp') diff --git a/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp b/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp new file mode 100644 index 0000000..459e0d4 --- /dev/null +++ b/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include +#include +#include + + +#define ADD_TRAIT_TEST_CASE( op ) \ + TEST_CASE( "is_" #op "_comparable", \ + "[traits][is_comparable][approvals]" ) { \ + using Catch::Detail::is_##op##_0_comparable; \ + using Catch::Detail::is_##op##_comparable; \ + \ + STATIC_REQUIRE( is_##op##_comparable::value ); \ + STATIC_REQUIRE( \ + is_##op##_comparable::value ); \ + STATIC_REQUIRE( !is_##op##_comparable::value ); \ + STATIC_REQUIRE( \ + !is_##op##_comparable::value ); \ + STATIC_REQUIRE( \ + !is_##op##_comparable::value ); \ + \ + STATIC_REQUIRE( is_##op##_0_comparable::value ); \ + STATIC_REQUIRE( \ + is_##op##_0_comparable::value ); \ + STATIC_REQUIRE( !is_##op##_0_comparable::value ); \ + \ + /* This test fails with MSVC in permissive mode, because of course it does */ \ + /* STATIC_REQUIRE( !is_##op##_0_comparable::value ); */ \ +} + +ADD_TRAIT_TEST_CASE(lt) +ADD_TRAIT_TEST_CASE(gt) +ADD_TRAIT_TEST_CASE(le) +ADD_TRAIT_TEST_CASE(ge) +ADD_TRAIT_TEST_CASE(eq) +ADD_TRAIT_TEST_CASE(ne) + +#undef ADD_TRAIT_TEST_CASE -- cgit v1.2.3