aboutsummaryrefslogtreecommitdiff
path: root/pw_polyfill/test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'pw_polyfill/test.cc')
-rw-r--r--pw_polyfill/test.cc81
1 files changed, 5 insertions, 76 deletions
diff --git a/pw_polyfill/test.cc b/pw_polyfill/test.cc
index b761d4e2d..d17475df4 100644
--- a/pw_polyfill/test.cc
+++ b/pw_polyfill/test.cc
@@ -17,10 +17,8 @@
#include "gtest/gtest.h"
#include "pw_polyfill/language_feature_macros.h"
#include "pw_polyfill/standard.h"
-#include "pw_polyfill/standard_library/bit.h"
#include "pw_polyfill/standard_library/cstddef.h"
#include "pw_polyfill/standard_library/iterator.h"
-#include "pw_polyfill/standard_library/type_traits.h"
namespace pw {
namespace polyfill {
@@ -40,15 +38,11 @@ static_assert(PW_CXX_STANDARD_IS_SUPPORTED(17), "C++17 must be not supported");
static_assert(!PW_CXX_STANDARD_IS_SUPPORTED(17), "C++17 must be supported");
#endif // __cplusplus >= 201703L
-TEST(Bit, Endian) {
- if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) {
- EXPECT_EQ(std::endian::native, std::endian::big);
- } else if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) {
- EXPECT_EQ(std::endian::native, std::endian::little);
- } else {
- FAIL();
- }
-}
+#if __cplusplus >= 202002L
+static_assert(PW_CXX_STANDARD_IS_SUPPORTED(20), "C++20 must be supported");
+#else
+static_assert(!PW_CXX_STANDARD_IS_SUPPORTED(20), "C++20 must not be supported");
+#endif // __cplusplus >= 202002L
TEST(Cstddef, Byte_Operators) {
std::byte value = std::byte(0);
@@ -96,71 +90,6 @@ TEST(Constinit, ValueIsMutable) {
mutable_value = true;
}
-TEST(TypeTraits, Aliases) {
- static_assert(
- std::is_same<std::aligned_storage_t<40, 40>,
- typename std::aligned_storage<40, 40>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::common_type_t<int, bool>,
- typename std::common_type<int, bool>::type>::value,
- "Alias must be defined");
-
- static_assert(
- std::is_same<std::conditional_t<false, int, char>,
- typename std::conditional<false, int, char>::type>::value,
- "Alias must be defined");
-
- static_assert(
- std::is_same<std::decay_t<int>, typename std::decay<int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::enable_if_t<true, int>,
- typename std::enable_if<true, int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::make_signed_t<int>,
- typename std::make_signed<int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::make_unsigned_t<int>,
- typename std::make_unsigned<int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::remove_cv_t<int>,
- typename std::remove_cv<int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::remove_pointer_t<int>,
- typename std::remove_pointer<int>::type>::value,
- "Alias must be defined");
-
- static_assert(std::is_same<std::remove_reference_t<int>,
- typename std::remove_reference<int>::type>::value,
- "Alias must be defined");
-}
-
-TEST(TypeTraits, LogicalTraits) {
- static_assert(std::conjunction<std::true_type, std::true_type>::value,
- "conjunction should be true");
- static_assert(!std::conjunction<std::true_type, std::false_type>::value,
- "conjunction should be false");
- static_assert(!std::conjunction<std::false_type, std::false_type>::value,
- "conjunction should be false");
-
- static_assert(std::disjunction<std::true_type, std::true_type>::value,
- "disjunction should be true");
- static_assert(std::disjunction<std::true_type, std::false_type>::value,
- "disjunction should be true");
- static_assert(!std::disjunction<std::false_type, std::false_type>::value,
- "disjunction should be false");
-
- static_assert(!std::negation<std::true_type>::value,
- "negation should be false");
- static_assert(std::negation<std::false_type>::value,
- "negation should be true");
-}
-
} // namespace
} // namespace polyfill
} // namespace pw