mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Remove ETL_USING_CPP11 from unit tests
Unit tests are always run with at least C++11.
This commit is contained in:
parent
e971ca87ae
commit
6f3782cf41
@ -6,8 +6,6 @@
|
||||
#include <etl/span.h>
|
||||
#include <utility>
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
|
||||
SUITE(test_manchester)
|
||||
{
|
||||
TEST(encode_uint8_t)
|
||||
@ -17,9 +15,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0xAAA9, (etl::manchester::encode<uint8_t>(0x01U)));
|
||||
CHECK_EQUAL(0x6AAA, (etl::manchester::encode<uint8_t>(0x80U)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0xAAAA == etl::manchester::encode<uint8_t>(0x00U), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(encode_uint8_t_inverted)
|
||||
@ -29,9 +27,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0x5556, (etl::manchester_inverted::encode<uint8_t>(0x01U)));
|
||||
CHECK_EQUAL(0x9555, (etl::manchester_inverted::encode<uint8_t>(0x80U)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x5555 == etl::manchester_inverted::encode<uint8_t>(0x00U), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(encode_uint16_t)
|
||||
@ -39,9 +37,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0x5555AAAA, (etl::manchester::encode<uint16_t>(0xFF00UL)));
|
||||
CHECK_EQUAL(0x6AAAAAA9, (etl::manchester::encode<uint16_t>(0x8001UL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x5555AAAA == etl::manchester::encode<uint16_t>(0xFF00UL), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(encode_uint16_t_inverted)
|
||||
@ -49,30 +47,30 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0xAAAA5555, (etl::manchester_inverted::encode<uint16_t>(0xFF00UL)));
|
||||
CHECK_EQUAL(0x95555556, (etl::manchester_inverted::encode<uint16_t>(0x8001UL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0xAAAA5555 == etl::manchester_inverted::encode<uint16_t>(0xFF00UL), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(encode_uint32_t)
|
||||
{
|
||||
CHECK_EQUAL(0x6AAAAAA95555AAAA, (etl::manchester::encode<uint32_t>(0x8001FF00ULL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x6AAAAAA95555AAAA == etl::manchester::encode<uint32_t>(0x8001FF00ULL), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(encode_uint32_t_inverted)
|
||||
{
|
||||
CHECK_EQUAL(0x95555556AAAA5555, (etl::manchester_inverted::encode<uint32_t>(0x8001FF00ULL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x95555556AAAA5555 == etl::manchester_inverted::encode<uint32_t>(0x8001FF00ULL), "Compile time manchester encoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
constexpr etl::array<uint8_t, 8> manchester_encoded_uint8(etl::span<const uint_least8_t> decoded)
|
||||
{
|
||||
etl::array<uint8_t, 8> encoded{0, 0, 0, 0, 0, 0, 0, 0};
|
||||
@ -93,7 +91,7 @@ SUITE(test_manchester)
|
||||
etl::manchester::encode<uint32_t>(decoded, encoded);
|
||||
return encoded;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TEST(encode_span)
|
||||
{
|
||||
@ -123,7 +121,7 @@ SUITE(test_manchester)
|
||||
CHECK_TRUE(encoded0 == encoded3);
|
||||
}
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
TEST(encode_span_constexpr)
|
||||
{
|
||||
constexpr etl::array<const uint8_t, 4> decoded{0x00, 0xFF, 0x01, 0x80};
|
||||
@ -155,7 +153,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)
|
||||
{
|
||||
@ -216,9 +214,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0x01, (etl::manchester::decode<uint16_t>(0xAAA9UL)));
|
||||
CHECK_EQUAL(0x80, (etl::manchester::decode<uint16_t>(0x6AAAUL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x00 == etl::manchester::decode<uint16_t>(0xAAAAUL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(decode_uint16_t_inverted)
|
||||
@ -228,9 +226,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0x01, (etl::manchester_inverted::decode<uint16_t>(0x5556UL)));
|
||||
CHECK_EQUAL(0x80, (etl::manchester_inverted::decode<uint16_t>(0x9555UL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x00 == etl::manchester_inverted::decode<uint16_t>(0x5555UL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(decode_uint32_t)
|
||||
@ -238,9 +236,9 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0xFF00UL, (etl::manchester::decode<uint32_t>(0x5555AAAAUL)));
|
||||
CHECK_EQUAL(0x8001UL, (etl::manchester::decode<uint32_t>(0x6AAAAAA9UL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0xFF00UL == etl::manchester::decode<uint32_t>(0x5555AAAAUL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(decode_uint32_t_inverted)
|
||||
@ -248,30 +246,30 @@ SUITE(test_manchester)
|
||||
CHECK_EQUAL(0xFF00UL, (etl::manchester_inverted::decode<uint32_t>(0xAAAA5555UL)));
|
||||
CHECK_EQUAL(0x8001UL, (etl::manchester_inverted::decode<uint32_t>(0x95555556UL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0xFF00UL == etl::manchester_inverted::decode<uint32_t>(0xAAAA5555UL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(decode_uint64_t)
|
||||
{
|
||||
CHECK_EQUAL(0x8001FF00ULL, (etl::manchester::decode<uint64_t>(0x6AAAAAA95555AAAAULL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x8001FF00ULL == etl::manchester::decode<uint64_t>(0x6AAAAAA95555AAAAULL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(decode_uint64_t_inverted)
|
||||
{
|
||||
CHECK_EQUAL(0x8001FF00ULL, (etl::manchester_inverted::decode<uint64_t>(0x95555556AAAA5555ULL)));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(0x8001FF00ULL == etl::manchester_inverted::decode<uint64_t>(0x95555556AAAA5555ULL), "Compile time manchester decoding failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
constexpr etl::array<uint8_t, 4> manchester_decoded_uint16(etl::span<const uint_least8_t> encoded)
|
||||
{
|
||||
etl::array<uint8_t, 4> decoded{0, 0, 0, 0};
|
||||
@ -292,7 +290,7 @@ SUITE(test_manchester)
|
||||
etl::manchester::decode<uint64_t>(encoded, decoded);
|
||||
return decoded;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TEST(decode_span)
|
||||
{
|
||||
@ -318,7 +316,7 @@ SUITE(test_manchester)
|
||||
CHECK_TRUE(decoded0 == decoded3);
|
||||
}
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
TEST(decode_span_constexpr)
|
||||
{
|
||||
constexpr etl::array<const uint8_t, 8> encoded{0xAA, 0xAA, 0x55, 0x55, 0xA9, 0xAA, 0xAA, 0x6A};
|
||||
@ -338,7 +336,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)
|
||||
{
|
||||
@ -397,10 +395,10 @@ SUITE(test_manchester)
|
||||
CHECK_FALSE(etl::manchester::is_valid<uint16_t>(0xAAA8UL));
|
||||
CHECK_FALSE(etl::manchester_inverted::is_valid<uint16_t>(0xAAA8UL));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(etl::manchester::is_valid<uint16_t>(0xAAAAUL), "Compile time manchester validity check failed");
|
||||
static_assert(etl::manchester_inverted::is_valid<uint16_t>(0xAAAAUL), "Compile time manchester validity check failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(valid32)
|
||||
@ -410,10 +408,10 @@ SUITE(test_manchester)
|
||||
CHECK_FALSE(etl::manchester::is_valid<uint32_t>(0xAAAAAAA8UL));
|
||||
CHECK_FALSE(etl::manchester_inverted::is_valid<uint32_t>(0xAAAAAAA8UL));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(etl::manchester::is_valid<uint32_t>(0xAAAAAAAAUL), "Compile time manchester validity check failed");
|
||||
static_assert(etl::manchester_inverted::is_valid<uint32_t>(0xAAAAAAAAUL), "Compile time manchester validity check failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(valid64)
|
||||
@ -423,10 +421,10 @@ SUITE(test_manchester)
|
||||
CHECK_FALSE(etl::manchester::is_valid<uint64_t>(0xAAAAAAAAAAAAAAA8ULL));
|
||||
CHECK_FALSE(etl::manchester_inverted::is_valid<uint64_t>(0xAAAAAAAAAAAAAAA8ULL));
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
#if ETL_USING_CPP14
|
||||
static_assert(etl::manchester::is_valid<uint64_t>(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed");
|
||||
static_assert(etl::manchester_inverted::is_valid<uint64_t>(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(valid_span)
|
||||
@ -437,10 +435,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)
|
||||
@ -449,5 +447,3 @@ SUITE(test_manchester)
|
||||
CHECK_THROW({ std::ignore = etl::manchester::is_valid(invalid_source); }, etl::manchester_invalid_size);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(test_constant)
|
||||
@ -912,5 +910,3 @@ namespace
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user