Skip to content

Commit

Permalink
Changes for OSX + C++20 + STL compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Apr 16, 2024
1 parent f12629b commit ea9d5b0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/etl/private/variant_variadic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ namespace etl
/// Only defined if using C++20 and STL.
/// https://en.cppreference.com/w/cpp/utility/variant/operator_cmp
//***************************************************************************
#if ETL_USING_CPP20 && ETL_USING_STL
#if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
template <typename... TTypes>
ETL_CONSTEXPR14
std::common_comparison_category_t<std::compare_three_way_result_t<TTypes>...>
Expand Down
25 changes: 20 additions & 5 deletions test/UnitTest++/Checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace UnitTest
template <>
inline std::string DisplayValue(const char& c)
{
using type = std::char_traits<char>::int_type;
typedef std::char_traits<char>::int_type type;

std::ostringstream oss;

Expand All @@ -47,7 +47,7 @@ namespace UnitTest
template <>
inline std::string DisplayValue(const char8_t& c)
{
using type = std::char_traits<char8_t>::int_type;
typedef std::char_traits<char8_t>::int_type type;

std::ostringstream oss;

Expand All @@ -60,7 +60,7 @@ namespace UnitTest
template <>
inline std::string DisplayValue(const wchar_t& c)
{
using type = std::char_traits<wchar_t>::int_type;
typedef std::char_traits<wchar_t>::int_type type;

std::ostringstream oss;

Expand All @@ -73,7 +73,7 @@ namespace UnitTest
template <>
inline std::string DisplayValue(const char16_t& c)
{
using type = std::char_traits<char16_t>::int_type;
typedef std::char_traits<char16_t>::int_type type;

std::ostringstream oss;

Expand All @@ -85,7 +85,7 @@ namespace UnitTest
template <>
inline std::string DisplayValue(const char32_t& c)
{
using type = std::char_traits<char32_t>::int_type;
typedef std::char_traits<char32_t>::int_type type;

std::ostringstream oss;

Expand Down Expand Up @@ -171,6 +171,7 @@ namespace UnitTest
return !value;
}

#if __cplusplus >= 201103L
template< typename Expected, typename Actual >
void CheckEqual(TestResults& results, Expected&& expected, Actual&& actual, TestDetails const& details)
{
Expand All @@ -183,6 +184,20 @@ namespace UnitTest
results.OnTestFailure(details, stream.GetText());
}
}
#else
template< typename Expected, typename Actual >
void CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details)
{
if (!(expected == actual))
{
UnitTest::MemoryOutStream stream;
stream << "Expected "
<< DisplayValue(expected) << " but was " << DisplayValue(actual);

results.OnTestFailure(details, stream.GetText());
}
}
#endif

template< typename Expected, typename Actual >
void CheckEqualHex(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details)
Expand Down
2 changes: 1 addition & 1 deletion test/test_variant_variadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ namespace
}
#endif

#if ETL_USING_CPP20 && ETL_USING_STL
#if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
//*************************************************************************
TEST(test_variant_spaceship_operator)
{
Expand Down

0 comments on commit ea9d5b0

Please sign in to comment.