diff --git a/include/etl/chrono.h b/include/etl/chrono.h index facde8a4..b452ca4e 100644 --- a/include/etl/chrono.h +++ b/include/etl/chrono.h @@ -35,10 +35,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #if ETL_USING_CPP11 #include "hash.h" diff --git a/include/etl/concepts.h b/include/etl/concepts.h index ce5cec97..ac539947 100644 --- a/include/etl/concepts.h +++ b/include/etl/concepts.h @@ -36,10 +36,6 @@ SOFTWARE. #include "type_traits.h" #include "utility.h" -#if ETL_NOT_USING_CPP20 && !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR BELOW C++20 -#endif - #if ETL_USING_CPP20 #if ETL_USING_STL diff --git a/include/etl/const_map.h b/include/etl/const_map.h index aa20fb4d..f96f616b 100644 --- a/include/etl/const_map.h +++ b/include/etl/const_map.h @@ -33,10 +33,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #include "algorithm.h" #include "functional.h" #include "nth_type.h" @@ -45,6 +41,8 @@ SOFTWARE. #include "private/comparator_is_transparent.h" +#if ETL_USING_CPP11 + ///\defgroup const_map const_map ///\ingroup containers @@ -528,14 +526,14 @@ namespace etl value_type element_list[Size]; }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_map(TElements...) -> const_map::first_type, typename etl::nth_type_t<0, TElements...>::second_type, sizeof...(TElements)>; -#endif + #endif //********************************************************************* /// Map type designed for constexpr. @@ -586,16 +584,16 @@ namespace etl } }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_map_ext(const etl::span&) -> const_map_ext; template const_map_ext(const TElements (&)[Size]) -> const_map_ext; -#endif + #endif //************************************************************************* /// Equality test. @@ -659,3 +657,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/const_multimap.h b/include/etl/const_multimap.h index 6f5f8208..dea60ee1 100644 --- a/include/etl/const_multimap.h +++ b/include/etl/const_multimap.h @@ -33,10 +33,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #include "algorithm.h" #include "functional.h" #include "nth_type.h" @@ -45,6 +41,8 @@ SOFTWARE. #include "private/comparator_is_transparent.h" +#if ETL_USING_CPP11 + ///\defgroup const_multimap const_multimap ///\ingroup containers @@ -478,14 +476,14 @@ namespace etl value_type element_list[Size]; }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_multimap(TPairs...) -> const_multimap::first_type, typename etl::nth_type_t<0, TPairs...>::second_type, sizeof...(TPairs)>; -#endif + #endif //********************************************************************* /// Map type designed for constexpr. @@ -536,16 +534,16 @@ namespace etl } }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_multimap_ext(const etl::span&) -> const_multimap_ext; template const_multimap_ext(const TElements (&)[Size]) -> const_multimap_ext; -#endif + #endif //************************************************************************* /// Equality test. @@ -626,3 +624,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/const_multiset.h b/include/etl/const_multiset.h index 1fb0bd9e..6184f9e7 100644 --- a/include/etl/const_multiset.h +++ b/include/etl/const_multiset.h @@ -33,10 +33,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #include "algorithm.h" #include "functional.h" #include "nth_type.h" @@ -45,6 +41,8 @@ SOFTWARE. #include "private/comparator_is_transparent.h" +#if ETL_USING_CPP11 + ///\defgroup const_multiset const_multiset ///\ingroup containers @@ -433,13 +431,13 @@ namespace etl value_type element_list[Size]; }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_multiset(TElements...) -> const_multiset, sizeof...(TElements)>; -#endif + #endif //********************************************************************* /// Multiset type designed for constexpr. @@ -488,16 +486,16 @@ namespace etl } }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_multiset_ext(const etl::span&) -> const_multiset_ext; template const_multiset_ext(const TElements (&)[Size]) -> const_multiset_ext; -#endif + #endif //************************************************************************* /// Equality test. @@ -572,3 +570,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/const_set.h b/include/etl/const_set.h index e4629d71..df7f0989 100644 --- a/include/etl/const_set.h +++ b/include/etl/const_set.h @@ -33,10 +33,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #include "algorithm.h" #include "functional.h" #include "nth_type.h" @@ -45,6 +41,8 @@ SOFTWARE. #include "private/comparator_is_transparent.h" +#if ETL_USING_CPP11 + ///\defgroup const_set const_set ///\ingroup containers @@ -426,13 +424,13 @@ namespace etl value_type element_list[Size]; }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_set(TElements...) -> const_set, sizeof...(TElements)>; -#endif + #endif //********************************************************************* /// Map type designed for constexpr. @@ -481,16 +479,16 @@ namespace etl } }; - //************************************************************************* - /// Template deduction guides. - //************************************************************************* -#if ETL_USING_CPP17 + //************************************************************************* + /// Template deduction guides. + //************************************************************************* + #if ETL_USING_CPP17 template const_set_ext(const etl::span&) -> const_set_ext; template const_set_ext(const TElements (&)[Size]) -> const_set_ext; -#endif + #endif //************************************************************************* /// Equality test. @@ -548,3 +546,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/manchester.h b/include/etl/manchester.h index 032d9e29..b385565d 100644 --- a/include/etl/manchester.h +++ b/include/etl/manchester.h @@ -35,6 +35,8 @@ SOFTWARE. #include "span.h" #include "static_assert.h" +#if ETL_USING_CPP11 + ///\defgroup manchester manchester /// Manchester encoding and decoding ///\ingroup utilities @@ -51,13 +53,13 @@ namespace etl struct is_encodable { static const bool value = -#if ETL_USING_8BIT_TYPES + #if ETL_USING_8BIT_TYPES etl::is_same::value || -#endif + #endif etl::is_same::value -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES || etl::is_same::value -#endif + #endif ; }; @@ -69,13 +71,13 @@ namespace etl struct is_decodable { static const bool value = -#if ETL_USING_8BIT_TYPES + #if ETL_USING_8BIT_TYPES etl::is_same::value || -#endif + #endif etl::is_same::value -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES || etl::is_same::value -#endif + #endif ; }; @@ -91,13 +93,13 @@ namespace etl ETL_STATIC_ASSERT(sizeof(T) == 0, "Manchester encoding type should be one of [uint8_t, uint16_t, uint32_t]"); }; -#if ETL_USING_8BIT_TYPES + #if ETL_USING_8BIT_TYPES template <> struct encoded { typedef uint16_t type; }; -#endif + #endif template <> struct encoded @@ -105,13 +107,13 @@ namespace etl typedef uint32_t type; }; -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES template <> struct encoded { typedef uint64_t type; }; -#endif + #endif //************************************************************************* /// Type trait to determine the decoded type for a given encoded type. @@ -125,13 +127,13 @@ namespace etl ETL_STATIC_ASSERT(sizeof(T) == 0, "Manchester decoding type should be one of [uint16_t, uint32_t, uint64_t]"); }; -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES template <> struct decoded { typedef uint8_t type; }; -#endif + #endif template <> struct decoded @@ -139,24 +141,24 @@ namespace etl typedef uint16_t type; }; -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES template <> struct decoded { typedef uint32_t type; }; -#endif + #endif //************************************************************************* /// Normal Manchester encoding type (no inversion). //************************************************************************* struct manchester_type_normal { -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES static const uint64_t inversion_mask = 0x0000000000000000ULL; -#else + #else static const uint32_t inversion_mask = 0x00000000UL; -#endif + #endif }; //************************************************************************* @@ -164,11 +166,11 @@ namespace etl //************************************************************************* struct manchester_type_inverted { -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES static const uint64_t inversion_mask = 0xFFFFFFFFFFFFFFFFULL; -#else + #else static const uint32_t inversion_mask = 0xFFFFFFFFUL; -#endif + #endif }; //************************************************************************* @@ -247,11 +249,11 @@ namespace etl ETL_STATIC_ASSERT(CHAR_BIT == etl::numeric_limits::digits, "Manchester requires uint_least8_t to have the same number of bits as CHAR (CHAR_BITS)"); - //************************************************************************* - // Encoding functions - //************************************************************************* + //************************************************************************* + // Encoding functions + //************************************************************************* -#if ETL_USING_8BIT_TYPES + #if ETL_USING_8BIT_TYPES //************************************************************************* /// Encode a 8-bit unsigned value and return 16-bit result. ///\param decoded The value to encode. @@ -273,7 +275,7 @@ namespace etl ^ (0xAAAAU ^ static_cast(TManchesterType::inversion_mask))); return encoded; } -#endif + #endif //************************************************************************* /// Encode a 16-bit unsigned value and return the 32-bit result. @@ -297,7 +299,7 @@ namespace etl return encoded; } -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES //************************************************************************* /// Encode a 32-bit unsigned value and return the 64-bit result. ///\param decoded The value to encode. @@ -320,7 +322,7 @@ namespace etl encoded = (encoded | (encoded << 1U)) ^ (0xAAAAAAAAAAAAAAAAULL ^ TManchesterType::inversion_mask); return encoded; } -#endif + #endif //************************************************************************* /// Encode a span of data with the specified chunk size. @@ -350,11 +352,11 @@ namespace etl } } - //************************************************************************* - // Decoding functions - //************************************************************************* + //************************************************************************* + // Decoding functions + //************************************************************************* -#if ETL_USING_8BIT_TYPES + #if ETL_USING_8BIT_TYPES //************************************************************************* /// Decode a 16-bit value and return the 8-bit result. ///\param encoded The value to decode. @@ -373,7 +375,7 @@ namespace etl encoded = static_cast((static_cast(encoded) | (static_cast(encoded) >> 2)) & 0x0F0FU); return static_cast(static_cast(encoded) | (static_cast(encoded) >> 4U)); } -#endif + #endif //************************************************************************* /// Decode a 32-bit value and return the 16-bit result. @@ -394,7 +396,7 @@ namespace etl return static_cast(encoded | (encoded >> 8U)); } -#if ETL_USING_64BIT_TYPES + #if ETL_USING_64BIT_TYPES //************************************************************************* /// Decode a 64-bit value and return the 32-bit result. ///\param encoded The value to decode. @@ -414,7 +416,7 @@ namespace etl encoded = (encoded | (encoded >> 8)) & 0x0000FFFF0000FFFFULL; return static_cast(encoded | (encoded >> 16U)); } -#endif + #endif //************************************************************************* /// Decode a span of data using the specified chunk type. @@ -500,3 +502,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/parameter_pack.h b/include/etl/parameter_pack.h index 5dd21717..267065bb 100644 --- a/include/etl/parameter_pack.h +++ b/include/etl/parameter_pack.h @@ -34,11 +34,7 @@ SOFTWARE. #include -#if ETL_CPP11_NOT_SUPPORTED - #if !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR C++03 OR BELOW - #endif -#else +#if ETL_CPP11_SUPPORTED namespace etl { //*************************************************************************** diff --git a/include/etl/result.h b/include/etl/result.h index 5b5fcad8..22b5f92c 100644 --- a/include/etl/result.h +++ b/include/etl/result.h @@ -38,11 +38,7 @@ SOFTWARE. #include "optional.h" #include "variant.h" -#if ETL_CPP11_NOT_SUPPORTED - #if !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR C++03 OR BELOW - #endif -#else +#if ETL_CPP11_SUPPORTED namespace etl { @@ -70,7 +66,6 @@ namespace etl { } - #if ETL_CPP11_SUPPORTED //******************************************* /// Move constructor //******************************************* @@ -78,7 +73,6 @@ namespace etl : data(etl::move(other.data)) { } - #endif //******************************************* // Construct from a value @@ -104,15 +98,13 @@ namespace etl { } - //******************************************* - /// Move construct from error - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Move construct from error + //******************************************* result(TError&& error) : data(etl::move(error)) { } - #endif //******************************************* /// Copy assign @@ -141,16 +133,14 @@ namespace etl return *this; } - //******************************************* - /// Move assign from value - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Move assign from value + //******************************************* result& operator=(TValue&& value) { data = etl::move(value); return *this; } - #endif //******************************************* /// Copy assign from error @@ -161,16 +151,14 @@ namespace etl return *this; } - //******************************************* - /// Move assign from error - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Move assign from error + //******************************************* result& operator=(TError&& error) { data = etl::move(error); return *this; } - #endif //******************************************* /// true if result contains a value @@ -223,16 +211,14 @@ namespace etl return etl::get(data); } - //******************************************* - /// Returns an rvalue reference to the error. - /// Undefined if the result does not contain an error. - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Returns an rvalue reference to the error. + /// Undefined if the result does not contain an error. + //******************************************* TError&& error() { return etl::move(etl::get(data)); } - #endif private: @@ -280,15 +266,13 @@ namespace etl { } - //******************************************* - /// Move construct from error - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Move construct from error + //******************************************* result(TError&& error) : data(etl::move(error)) { } - #endif //******************************************* /// Copy assign from error @@ -299,16 +283,14 @@ namespace etl return *this; } - //******************************************* - /// Move assign from error - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Move assign from error + //******************************************* result& operator=(TError&& error) { data = etl::move(error); return *this; } - #endif //******************************************* /// true if result contains a value @@ -343,16 +325,14 @@ namespace etl return data.value(); } - //******************************************* - /// Returns an rvalue reference to the error. - /// Undefined if the result does not contain an error. - //******************************************* - #if ETL_CPP11_SUPPORTED + //******************************************* + /// Returns an rvalue reference to the error. + /// Undefined if the result does not contain an error. + //******************************************* TError&& error() { return etl::move(data.value()); } - #endif private: diff --git a/include/etl/rounded_integral_division.h b/include/etl/rounded_integral_division.h index b56a9dc5..3b31a88d 100644 --- a/include/etl/rounded_integral_division.h +++ b/include/etl/rounded_integral_division.h @@ -36,6 +36,8 @@ SOFTWARE. #include "type_traits.h" #include "utility.h" +#if ETL_USING_CPP11 + namespace etl { namespace private_rounded_integral_division @@ -784,3 +786,4 @@ namespace etl } // namespace etl #endif +#endif diff --git a/include/etl/signal.h b/include/etl/signal.h index 0f198824..3392cff6 100644 --- a/include/etl/signal.h +++ b/include/etl/signal.h @@ -35,10 +35,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #if ETL_USING_CPP11 #include "algorithm.h" diff --git a/include/etl/tuple.h b/include/etl/tuple.h index 31cdce5f..f76c0a62 100644 --- a/include/etl/tuple.h +++ b/include/etl/tuple.h @@ -31,10 +31,6 @@ SOFTWARE. #include "platform.h" -#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST) - #error NOT SUPPORTED FOR C++03 OR BELOW -#endif - #if ETL_USING_CPP11 #if ETL_USING_STL diff --git a/test/syntax_check/etl_profile.h b/test/syntax_check/etl_profile.h index ed633219..deee267c 100644 --- a/test/syntax_check/etl_profile.h +++ b/test/syntax_check/etl_profile.h @@ -31,7 +31,6 @@ SOFTWARE. #define ETL_TARGET_DEVICE_GENERIC #define ETL_TARGET_OS_NONE -#define ETL_IN_UNIT_TEST #define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK #define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS #define ETL_CALLBACK_TIMER_ENABLE_INTERRUPTS diff --git a/test/test_manchester.cpp b/test/test_manchester.cpp index bd357435..68a9deaa 100644 --- a/test/test_manchester.cpp +++ b/test/test_manchester.cpp @@ -6,6 +6,8 @@ #include #include +#if ETL_USING_CPP11 + SUITE(test_manchester) { TEST(encode_uint8_t) @@ -15,9 +17,9 @@ SUITE(test_manchester) CHECK_EQUAL(0xAAA9, (etl::manchester::encode(0x01U))); CHECK_EQUAL(0x6AAA, (etl::manchester::encode(0x80U))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0xAAAA == etl::manchester::encode(0x00U), "Compile time manchester encoding failed"); -#endif + #endif } TEST(encode_uint8_t_inverted) @@ -27,9 +29,9 @@ SUITE(test_manchester) CHECK_EQUAL(0x5556, (etl::manchester_inverted::encode(0x01U))); CHECK_EQUAL(0x9555, (etl::manchester_inverted::encode(0x80U))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x5555 == etl::manchester_inverted::encode(0x00U), "Compile time manchester encoding failed"); -#endif + #endif } TEST(encode_uint16_t) @@ -37,9 +39,9 @@ SUITE(test_manchester) CHECK_EQUAL(0x5555AAAA, (etl::manchester::encode(0xFF00UL))); CHECK_EQUAL(0x6AAAAAA9, (etl::manchester::encode(0x8001UL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x5555AAAA == etl::manchester::encode(0xFF00UL), "Compile time manchester encoding failed"); -#endif + #endif } TEST(encode_uint16_t_inverted) @@ -47,30 +49,30 @@ SUITE(test_manchester) CHECK_EQUAL(0xAAAA5555, (etl::manchester_inverted::encode(0xFF00UL))); CHECK_EQUAL(0x95555556, (etl::manchester_inverted::encode(0x8001UL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0xAAAA5555 == etl::manchester_inverted::encode(0xFF00UL), "Compile time manchester encoding failed"); -#endif + #endif } TEST(encode_uint32_t) { CHECK_EQUAL(0x6AAAAAA95555AAAA, (etl::manchester::encode(0x8001FF00ULL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x6AAAAAA95555AAAA == etl::manchester::encode(0x8001FF00ULL), "Compile time manchester encoding failed"); -#endif + #endif } TEST(encode_uint32_t_inverted) { CHECK_EQUAL(0x95555556AAAA5555, (etl::manchester_inverted::encode(0x8001FF00ULL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x95555556AAAA5555 == etl::manchester_inverted::encode(0x8001FF00ULL), "Compile time manchester encoding failed"); -#endif + #endif } -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 constexpr etl::array manchester_encoded_uint8(etl::span decoded) { etl::array encoded{0, 0, 0, 0, 0, 0, 0, 0}; @@ -91,7 +93,7 @@ SUITE(test_manchester) etl::manchester::encode(decoded, encoded); return encoded; } -#endif + #endif TEST(encode_span) { @@ -121,7 +123,7 @@ SUITE(test_manchester) CHECK_TRUE(encoded0 == encoded3); } -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 TEST(encode_span_constexpr) { constexpr etl::array decoded{0x00, 0xFF, 0x01, 0x80}; @@ -153,7 +155,7 @@ SUITE(test_manchester) static_assert(manchester_encoded_uint32(decoded)[6] == 0xAA, "Compile time encoding with uint32_t failed"); static_assert(manchester_encoded_uint32(decoded)[7] == 0x6A, "Compile time encoding with uint32_t failed"); } -#endif + #endif TEST(encode_span_inverted) { @@ -214,9 +216,9 @@ SUITE(test_manchester) CHECK_EQUAL(0x01, (etl::manchester::decode(0xAAA9UL))); CHECK_EQUAL(0x80, (etl::manchester::decode(0x6AAAUL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x00 == etl::manchester::decode(0xAAAAUL), "Compile time manchester decoding failed"); -#endif + #endif } TEST(decode_uint16_t_inverted) @@ -226,9 +228,9 @@ SUITE(test_manchester) CHECK_EQUAL(0x01, (etl::manchester_inverted::decode(0x5556UL))); CHECK_EQUAL(0x80, (etl::manchester_inverted::decode(0x9555UL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x00 == etl::manchester_inverted::decode(0x5555UL), "Compile time manchester decoding failed"); -#endif + #endif } TEST(decode_uint32_t) @@ -236,9 +238,9 @@ SUITE(test_manchester) CHECK_EQUAL(0xFF00UL, (etl::manchester::decode(0x5555AAAAUL))); CHECK_EQUAL(0x8001UL, (etl::manchester::decode(0x6AAAAAA9UL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0xFF00UL == etl::manchester::decode(0x5555AAAAUL), "Compile time manchester decoding failed"); -#endif + #endif } TEST(decode_uint32_t_inverted) @@ -246,30 +248,30 @@ SUITE(test_manchester) CHECK_EQUAL(0xFF00UL, (etl::manchester_inverted::decode(0xAAAA5555UL))); CHECK_EQUAL(0x8001UL, (etl::manchester_inverted::decode(0x95555556UL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0xFF00UL == etl::manchester_inverted::decode(0xAAAA5555UL), "Compile time manchester decoding failed"); -#endif + #endif } TEST(decode_uint64_t) { CHECK_EQUAL(0x8001FF00ULL, (etl::manchester::decode(0x6AAAAAA95555AAAAULL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x8001FF00ULL == etl::manchester::decode(0x6AAAAAA95555AAAAULL), "Compile time manchester decoding failed"); -#endif + #endif } TEST(decode_uint64_t_inverted) { CHECK_EQUAL(0x8001FF00ULL, (etl::manchester_inverted::decode(0x95555556AAAA5555ULL))); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(0x8001FF00ULL == etl::manchester_inverted::decode(0x95555556AAAA5555ULL), "Compile time manchester decoding failed"); -#endif + #endif } -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 constexpr etl::array manchester_decoded_uint16(etl::span encoded) { etl::array decoded{0, 0, 0, 0}; @@ -290,7 +292,7 @@ SUITE(test_manchester) etl::manchester::decode(encoded, decoded); return decoded; } -#endif + #endif TEST(decode_span) { @@ -316,7 +318,7 @@ SUITE(test_manchester) CHECK_TRUE(decoded0 == decoded3); } -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 TEST(decode_span_constexpr) { constexpr etl::array encoded{0xAA, 0xAA, 0x55, 0x55, 0xA9, 0xAA, 0xAA, 0x6A}; @@ -336,7 +338,7 @@ SUITE(test_manchester) static_assert(manchester_decoded_uint64(encoded)[2] == 0x01, "Compile time decoding with uint64_t failed"); static_assert(manchester_decoded_uint64(encoded)[3] == 0x80, "Compile time decoding with uint64_t failed"); } -#endif + #endif TEST(decode_span_inverted) { @@ -395,10 +397,10 @@ SUITE(test_manchester) CHECK_FALSE(etl::manchester::is_valid(0xAAA8UL)); CHECK_FALSE(etl::manchester_inverted::is_valid(0xAAA8UL)); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(etl::manchester::is_valid(0xAAAAUL), "Compile time manchester validity check failed"); static_assert(etl::manchester_inverted::is_valid(0xAAAAUL), "Compile time manchester validity check failed"); -#endif + #endif } TEST(valid32) @@ -408,10 +410,10 @@ SUITE(test_manchester) CHECK_FALSE(etl::manchester::is_valid(0xAAAAAAA8UL)); CHECK_FALSE(etl::manchester_inverted::is_valid(0xAAAAAAA8UL)); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(etl::manchester::is_valid(0xAAAAAAAAUL), "Compile time manchester validity check failed"); static_assert(etl::manchester_inverted::is_valid(0xAAAAAAAAUL), "Compile time manchester validity check failed"); -#endif + #endif } TEST(valid64) @@ -421,10 +423,10 @@ SUITE(test_manchester) CHECK_FALSE(etl::manchester::is_valid(0xAAAAAAAAAAAAAAA8ULL)); CHECK_FALSE(etl::manchester_inverted::is_valid(0xAAAAAAAAAAAAAAA8ULL)); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(etl::manchester::is_valid(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed"); static_assert(etl::manchester_inverted::is_valid(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed"); -#endif + #endif } TEST(valid_span) @@ -435,10 +437,10 @@ SUITE(test_manchester) CHECK_TRUE(etl::manchester::is_valid(encoded1)); CHECK_FALSE(etl::manchester::is_valid(encoded2)); -#if ETL_USING_CPP14 + #if ETL_USING_CPP14 static_assert(etl::manchester::is_valid(encoded1), "Compile time manchester validity check failed"); static_assert(!etl::manchester::is_valid(encoded2), "Compile time manchester validity check failed"); -#endif + #endif } TEST(valid_span_on_invalid_source) @@ -447,3 +449,5 @@ SUITE(test_manchester) CHECK_THROW({ std::ignore = etl::manchester::is_valid(invalid_source); }, etl::manchester_invalid_size); } } + +#endif diff --git a/test/test_rounded_integral_division.cpp b/test/test_rounded_integral_division.cpp index a29d2506..7250155e 100644 --- a/test/test_rounded_integral_division.cpp +++ b/test/test_rounded_integral_division.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include #include +#if ETL_USING_CPP11 + namespace { SUITE(test_constant) @@ -910,3 +912,5 @@ namespace } } } // namespace + +#endif