From f4dd3c3363e03d41632c0b833aa2566c726a80be Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 25 Jan 2023 19:51:19 +0000 Subject: [PATCH 1/3] Work in progress --- .gitignore | 2 + .../etl/generators/type_traits_generator.h | 12 + include/etl/overload.h | 3 +- include/etl/type_traits.h | 12 + test/etl_profile.h | 6 +- test/test_bit_stream_reader_big_endian.cpp | 142 +- test/test_bit_stream_reader_little_endian.cpp | 2312 ++++++++--------- test/test_bit_stream_writer_big_endian.cpp | 1592 ++++++------ test/test_bit_stream_writer_little_endian.cpp | 1766 ++++++------- test/test_largest.cpp | 8 +- test/test_make_string.cpp | 2 +- test/test_mem_cast_ptr.cpp | 8 +- test/test_memory.cpp | 10 +- test/test_overload.cpp | 6 +- test/test_parameter_pack.cpp | 16 + test/test_type_lookup.cpp | 6 +- test/test_type_traits.cpp | 154 +- test/test_variant_variadic.cpp | 4 + test/vs2019/etl.sln | 12 + test/vs2019/etl.vcxproj | 743 +++++- 20 files changed, 3874 insertions(+), 2942 deletions(-) diff --git a/.gitignore b/.gitignore index f44872fb..5ae42cdd 100644 --- a/.gitignore +++ b/.gitignore @@ -368,3 +368,5 @@ test/vs2022/random_lsfr.csv test/vs2022/random_mwc.csv test/vs2022/random_pcg.csv test/vs2022/random_xorshift.csv +test/vs2019/Debug MSVC C++14 +test/vs2019/Debug MSVC C++14 - No STL diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 491ca081..83939a93 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -117,6 +117,11 @@ namespace etl template const T integral_constant::value; +#if ETL_USING_CPP17 + template + using integral_constant_v = std::integral_constant::value; +#endif + #if ETL_USING_CPP11 template using bool_constant = integral_constant; @@ -842,7 +847,14 @@ namespace etl struct negation : std::negation { }; +#else + template + struct negation : etl::bool_constant + { + }; +#endif +#if ETL_USING_CPP17 template inline constexpr bool negation_v = std::negation_v; #endif diff --git a/include/etl/overload.h b/include/etl/overload.h index 60e2f771..e2198f24 100644 --- a/include/etl/overload.h +++ b/include/etl/overload.h @@ -37,7 +37,6 @@ SOFTWARE. namespace etl { -#if ETL_USING_CPP11 #if ETL_USING_CPP17 && !defined(ETL_OVERLOAD_FORCE_CPP14) //************************************************************************* @@ -74,6 +73,7 @@ namespace etl #endif +#if ETL_USING_CPP17 //************************************************************************* /// Make an overload. //************************************************************************* @@ -82,7 +82,6 @@ namespace etl { return overload{ etl::forward(overloads)... }; } - #endif } diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 80f2152c..4fb6edb5 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -814,6 +814,11 @@ namespace etl typedef integral_constant false_type; typedef integral_constant true_type; +#if ETL_USING_CPP17 + template + using integral_constant_v = std::integral_constant::value; +#endif + #if ETL_USING_CPP17 template using bool_constant = std::bool_constant; @@ -830,7 +835,14 @@ namespace etl struct negation : std::negation { }; +#else + template + struct negation : etl::bool_constant + { + }; +#endif +#if ETL_USING_CPP17 template inline constexpr bool negation_v = std::negation_v; #endif diff --git a/test/etl_profile.h b/test/etl_profile.h index ec2e7247..311524d1 100644 --- a/test/etl_profile.h +++ b/test/etl_profile.h @@ -108,9 +108,9 @@ SOFTWARE. #include "../include/etl/profiles/determine_compiler_version.h" #include "../include/etl/profiles/determine_development_os.h" -#if ETL_CPP17_NOT_SUPPORTED - #error THE UNIT TESTS REQUIRE C++17 SUPPORT -#endif +//#if ETL_CPP17_NOT_SUPPORTED +// #error THE UNIT TESTS REQUIRE C++17 SUPPORT +//#endif #if defined(ETL_COMPILER_GCC) #if (ETL_COMPILER_VERSION < 8) diff --git a/test/test_bit_stream_reader_big_endian.cpp b/test/test_bit_stream_reader_big_endian.cpp index 5a417be6..c8544eba 100644 --- a/test/test_bit_stream_reader_big_endian.cpp +++ b/test/test_bit_stream_reader_big_endian.cpp @@ -208,8 +208,8 @@ namespace //************************************************************************* TEST(test_read_int8_t) { - std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; + std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; + std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -244,8 +244,8 @@ namespace //************************************************************************* TEST(test_read_checked_int8_t_using_non_member_function) { - std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; + std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; + std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -280,8 +280,8 @@ namespace //************************************************************************* TEST(test_read_unchecked_int8_t_using_non_member_function) { - std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; + std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; + std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -305,8 +305,8 @@ namespace //************************************************************************* TEST(test_read_int8_t_5bits) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -341,8 +341,8 @@ namespace //************************************************************************* TEST(test_read_int8_t_5bits_with_skip) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -375,8 +375,8 @@ namespace //************************************************************************* TEST(test_read_checked_int8_t_5bits_using_non_member_function) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -411,8 +411,8 @@ namespace //************************************************************************* TEST(test_read_unchecked_int8_t_5bits_using_non_member_function) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -436,8 +436,8 @@ namespace //************************************************************************* TEST(test_read_uint8_t) { - std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { uint8_t(0x01), uint8_t(0x5A), uint8_t(0xA5), uint8_t(0xFF) }; + std::array storage = { char(0x01), char(0x5A), char(0xA5), char(0xFF) }; + std::array expected = { uint8_t(0x01), uint8_t(0x5A), uint8_t(0xA5), uint8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -472,8 +472,8 @@ namespace //************************************************************************* TEST(test_read_uint8_t_5bits) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; - std::array expected = { uint8_t(0x01), uint8_t(0x1A), uint8_t(0x05), uint8_t(0x1F) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array expected = { uint8_t(0x01), uint8_t(0x1A), uint8_t(0x05), uint8_t(0x1F) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -508,8 +508,8 @@ namespace //************************************************************************* TEST(test_read_int16_t) { - std::array storage = { char(0x00), char(0x01), char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; - std::array expected = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; + std::array storage = { char(0x00), char(0x01), char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; + std::array expected = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -544,8 +544,8 @@ namespace //************************************************************************* TEST(test_read_int16_t_10bits) { - std::array storage = { char(0x00), char(0x55), char(0xAA), char(0x97), char(0xFF) }; - std::array expected = { int16_t(0x0001), int16_t(0x015A), int16_t(0xFEA5), int16_t(0xFFFF) }; + std::array storage = { char(0x00), char(0x55), char(0xAA), char(0x97), char(0xFF) }; + std::array expected = { int16_t(0x0001), int16_t(0x015A), int16_t(0xFEA5), int16_t(0xFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -580,8 +580,8 @@ namespace //************************************************************************* TEST(test_read_uint16_t) { - std::array storage = { char(0x00), char(0x01), char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; - std::array expected = { uint16_t(0x0001), uint16_t(0xA55A), uint16_t(0x5AA5), uint16_t(0xFFFF) }; + std::array storage = { char(0x00), char(0x01), char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; + std::array expected = { uint16_t(0x0001), uint16_t(0xA55A), uint16_t(0x5AA5), uint16_t(0xFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -616,8 +616,8 @@ namespace //************************************************************************* TEST(test_read_uint16_t_10bits) { - std::array storage = { char(0x00), char(0x55), char(0xAA), char(0x97), char(0xFF) }; - std::array expected = { uint16_t(0x0001), uint16_t(0x015A), uint16_t(0x02A5), uint16_t(0x03FF) }; + std::array storage = { char(0x00), char(0x55), char(0xAA), char(0x97), char(0xFF) }; + std::array expected = { uint16_t(0x0001), uint16_t(0x015A), uint16_t(0x02A5), uint16_t(0x03FF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -652,11 +652,11 @@ namespace //************************************************************************* TEST(test_read_int32_t) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x01), + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x01), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { int32_t(0x00000001), int32_t(0xA55AA55A), int32_t(0x5AA55AA5), int32_t(0xFFFFFFFF) }; + std::array expected = { int32_t(0x00000001), int32_t(0xA55AA55A), int32_t(0x5AA55AA5), int32_t(0xFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -691,10 +691,10 @@ namespace //************************************************************************* TEST(test_read_int32_t_22bits) { - std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), + std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), char(0x55), char(0xA9), char(0x56), char(0xA9), char(0x7F), char(0xFF), char(0xFF) }; - std::array expected = { int32_t(0x00000001), int32_t(0x001AA55A), int32_t(0xFFE55AA5), int32_t(0xFFFFFFFF) }; + std::array expected = { int32_t(0x00000001), int32_t(0x001AA55A), int32_t(0xFFE55AA5), int32_t(0xFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -729,11 +729,11 @@ namespace //************************************************************************* TEST(test_read_uint32_t) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x01), - char(0xA5), char(0x5A), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { uint32_t(0x00000001), uint32_t(0xA55AA55A), uint32_t(0x5AA55AA5), uint32_t(0xFFFFFFFF) }; + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x01), + char(0xA5), char(0x5A), char(0xA5), char(0x5A), + char(0x5A), char(0xA5), char(0x5A), char(0xA5), + char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; + std::array expected = { uint32_t(0x00000001), uint32_t(0xA55AA55A), uint32_t(0x5AA55AA5), uint32_t(0xFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -768,10 +768,10 @@ namespace //************************************************************************* TEST(test_read_uint32_t_22bits) { - std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), + std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), char(0x55), char(0xA9), char(0x56), char(0xA9), char(0x7F), char(0xFF), char(0xFF) }; - std::array expected = { uint32_t(0x00000001), uint32_t(0x001AA55A), uint32_t(0x00255AA5), uint32_t(0x003FFFFF) }; + std::array expected = { uint32_t(0x00000001), uint32_t(0x001AA55A), uint32_t(0x00255AA5), uint32_t(0x003FFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -806,11 +806,11 @@ namespace //************************************************************************* TEST(test_read_int64_t) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), - char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { int64_t(0x0000000000000001), int64_t(0xA55AA55AA55AA55A), int64_t(0x5AA55AA55AA55AA5), int64_t(0xFFFFFFFFFFFFFFFF) }; + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), + char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), + char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), + char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; + std::array expected = { int64_t(0x0000000000000001), int64_t(0xA55AA55AA55AA55A), int64_t(0x5AA55AA55AA55AA5), int64_t(0xFFFFFFFFFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -845,10 +845,10 @@ namespace //************************************************************************* TEST(test_read_int64_t_47bits) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x02), char(0x95), char(0x6A), - char(0x95), char(0x6A), char(0x95), char(0x6A), char(0xD5), char(0x2A), char(0xD5), char(0x2A), - char(0xD5), char(0x2F), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - std::array expected = { int64_t(0x0000000000000001), int64_t(0x0000255AA55AA55A), int64_t(0xFFFFDAA55AA55AA5), int64_t(0xFFFFFFFFFFFFFFFF) }; + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x02), char(0x95), char(0x6A), + char(0x95), char(0x6A), char(0x95), char(0x6A), char(0xD5), char(0x2A), char(0xD5), char(0x2A), + char(0xD5), char(0x2F), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; + std::array expected = { int64_t(0x0000000000000001), int64_t(0x0000255AA55AA55A), int64_t(0xFFFFDAA55AA55AA5), int64_t(0xFFFFFFFFFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -883,11 +883,11 @@ namespace //************************************************************************* TEST(test_read_uint64_t) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), - char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { uint64_t(0x0000000000000001), uint64_t(0xA55AA55AA55AA55A), uint64_t(0x5AA55AA55AA55AA5), uint64_t(0xFFFFFFFFFFFFFFFF) }; + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), + char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), + char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0xA5), + char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; + std::array expected = { uint64_t(0x0000000000000001), uint64_t(0xA55AA55AA55AA55A), uint64_t(0x5AA55AA55AA55AA5), uint64_t(0xFFFFFFFFFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -922,10 +922,10 @@ namespace //************************************************************************* TEST(test_read_uint64_t_47bits) { - std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x02), char(0x95), char(0x6A), + std::array storage = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x02), char(0x95), char(0x6A), char(0x95), char(0x6A), char(0x95), char(0x6A), char(0xD5), char(0x2A), char(0xD5), char(0x2A), char(0xD5), char(0x2F), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - std::array expected = { uint64_t(0x0000000000000001), uint64_t(0x0000255AA55AA55A), uint64_t(0x00005AA55AA55AA5), uint64_t(0x00007FFFFFFFFFFF) }; + std::array expected = { uint64_t(0x0000000000000001), uint64_t(0x0000255AA55AA55A), uint64_t(0x00005AA55AA55AA5), uint64_t(0x00007FFFFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -967,12 +967,12 @@ namespace //uint16_t s2 = 22136; // 0x5678 //int8_t c2 = -91; // 0xA5 - std::array storage = { char(0x5A), - char(0x12), char(0x34), - char(0x89), char(0xAB), char(0xCD), char(0xEF), - char(0xFE), char(0xDC), char(0xBA), char(0x98), - char(0x56), char(0x78), - char(0xA5) }; + std::array storage = { char(0x5A), + char(0x12), char(0x34), + char(0x89), char(0xAB), char(0xCD), char(0xEF), + char(0xFE), char(0xDC), char(0xBA), char(0x98), + char(0x56), char(0x78), + char(0xA5) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -1013,9 +1013,9 @@ namespace //uint16_t s2 = 22136; // 0x5678 11 bits //int8_t c2 = -91; // 0xA5 7 bits - std::array storage = { char(0x6A), char(0x46), char(0x8A), char(0xF3), - char(0x7B), char(0xDB), char(0x97), char(0x53), - char(0x19), char(0xE1), char(0x28) }; + std::array storage = { char(0x6A), char(0x46), char(0x8A), char(0xF3), + char(0x7B), char(0xDB), char(0x97), char(0x53), + char(0x19), char(0xE1), char(0x28) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -1056,9 +1056,9 @@ namespace //uint16_t s2 = 22136; // 0x5678 11 bits //int8_t c2 = -91; // 0xA5 7 bits - std::array storage = { char(0x6A), char(0x46), char(0x8A), char(0xF3), - char(0x7B), char(0xDB), char(0x97), char(0x53), - char(0x19), char(0xE1), char(0x28) }; + std::array storage = { char(0x6A), char(0x46), char(0x8A), char(0xF3), + char(0x7B), char(0xDB), char(0x97), char(0x53), + char(0x19), char(0xE1), char(0x28) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -1092,9 +1092,9 @@ namespace //************************************************************************* TEST(test_read_checked_object) { - std::array storage = { char(0xEC), char(0xBA), char(0xDE), char(0x68), - char(0xAF), char(0xD2), char(0xC5), char(0xC8), - char(0x65), char(0xD3), char(0xDF), char(0x80) }; + std::array storage = { char(0xEC), char(0xBA), char(0xDE), char(0x68), + char(0xAF), char(0xD2), char(0xC5), char(0xC8), + char(0x65), char(0xD3), char(0xDF), char(0x80) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -1121,9 +1121,9 @@ namespace //************************************************************************* TEST(test_read_unchecked_object) { - std::array storage = { char(0xEC), char(0xBA), char(0xDE), char(0x68), - char(0xAF), char(0xD2), char(0xC5), char(0xC8), - char(0x65), char(0xD3), char(0xDF), char(0x80) }; + std::array storage = { char(0xEC), char(0xBA), char(0xDE), char(0x68), + char(0xAF), char(0xD2), char(0xC5), char(0xC8), + char(0x65), char(0xD3), char(0xDF), char(0x80) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); diff --git a/test/test_bit_stream_reader_little_endian.cpp b/test/test_bit_stream_reader_little_endian.cpp index eea9f46e..c6ef0d43 100644 --- a/test/test_bit_stream_reader_little_endian.cpp +++ b/test/test_bit_stream_reader_little_endian.cpp @@ -1,1156 +1,1156 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2018 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#include "unit_test_framework.h" - -#include "etl/bit_stream.h" - -#include -#include - -namespace -{ - //*********************************** - struct Object - { - int16_t s; - int32_t i; - uint8_t c; - }; - -#include "etl/private/diagnostic_unused_function_push.h" - bool operator ==(const Object& lhs, const Object& rhs) - { - return (lhs.s == rhs.s) && - (lhs.i == rhs.i) && - (lhs.c == rhs.c); - } - - std::ostream& operator << (std::ostream& os, const Object& object) - { - os << object.s << "," << object.i << "," << (int)object.c; - return os; - } -#include "etl/private/diagnostic_pop.h" -} - -namespace etl -{ - //*********************************** - template <> - Object read_unchecked(etl::bit_stream_reader& stream) - { - int16_t result_s = stream.read_unchecked(14); - int32_t result_i = stream.read_unchecked(23); - uint8_t result_c = stream.read_unchecked(); - - return Object{ result_s, result_i, result_c }; - } - - //*********************************** - template <> - optional read(etl::bit_stream_reader& stream) - { - optional result; - - etl::optional result_s = stream.read(14); - etl::optional result_i = stream.read(23); - etl::optional result_c = stream.read(); - - if (result_s.has_value() && result_i.has_value() && result_c.has_value()) - { - result = Object{ result_s.value(), result_i.value(), result_c.value() }; - } - - return result; - } -} - -namespace -{ - SUITE(test_bit_stream_reader) - { - //************************************************************************* - TEST(test_read_bool) - { - char storage = 0x5AU; - - etl::bit_stream_reader bit_stream(&storage, 1, etl::endian::little); - - CHECK_EQUAL(1U, bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_bool_using_non_member_function) - { - char storage = 0x5AU; - - etl::bit_stream_reader bit_stream(&storage, 1, etl::endian::little); - - CHECK_EQUAL(1U, bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(true, result.value()); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(false, result.value()); - - // One too many. - CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int8_t) - { - std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_checked_int8_t_using_non_member_function) - { - std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_unchecked_int8_t_using_non_member_function) - { - std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - int8_t result; - - result = etl::read_unchecked(bit_stream); - CHECK_EQUAL(int(expected[0]), int(result)); - - result = etl::read_unchecked(bit_stream); - CHECK_EQUAL(int(expected[1]), int(result)); - - result = etl::read_unchecked(bit_stream); - CHECK_EQUAL(int(expected[2]), int(result)); - - result = etl::read_unchecked(bit_stream); - CHECK_EQUAL(int(expected[3]), int(result)); - } - - //************************************************************************* - TEST(test_read_int8_t_5bits) - { - std::array storage = { char(0x85), char(0x69), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_checked_int8_t_5bits_using_non_member_function) - { - std::array storage = { char(0x85), char(0x69), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = etl::read(bit_stream, 5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream, 5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream, 5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = etl::read(bit_stream, 5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(etl::read(bit_stream, 5U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_unchecked_int8_t_5bits_using_non_member_function) - { - std::array storage = { char(0x85), char(0x69), char(0xF0) }; - std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - int8_t result; - - result = etl::read_unchecked(bit_stream, 5U); - CHECK_EQUAL(int(expected[0]), int(result)); - - result = etl::read_unchecked(bit_stream, 5U); - CHECK_EQUAL(int(expected[1]), int(result)); - - result = etl::read_unchecked(bit_stream, 5U); - CHECK_EQUAL(int(expected[2]), int(result)); - - result = etl::read_unchecked(bit_stream, 5U); - CHECK_EQUAL(int(expected[3]), int(result)); - } - - //************************************************************************* - TEST(test_read_uint8_t) - { - std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; - std::array expected = { uint8_t(0x01), uint8_t(0x5A), uint8_t(0xA5), uint8_t(0xFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint8_t_5bits) - { - std::array storage = { char(0x85), char(0x69), char(0xF0) }; - std::array expected = { uint8_t(0x01), uint8_t(0x15), uint8_t(0x05), uint8_t(0x1F) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[1]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint8_t_5bits_with_skip) - { - std::array storage = { char(0x85), char(0x69), char(0xF0) }; - std::array expected = { uint8_t(0x01), uint8_t(0x15), uint8_t(0x05), uint8_t(0x1F) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[0]), int(result.value())); - - bool success = bit_stream.skip(5U); - CHECK(success); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[2]), int(result.value())); - - result.reset(); - result = bit_stream.read(5U); - CHECK(result.has_value()); - CHECK_EQUAL(int(expected[3]), int(result.value())); - - // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int16_t) - { - std::array storage = { char(0x80), char(0x00), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; - std::array expected = { int16_t(0x0001), int16_t(0x5AA5), int16_t(0xA55A), int16_t(0xFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int16_t_10bits) - { - std::array storage = { char(0x80), char(0x16), char(0xAA), char(0x57), char(0xFF) }; - std::array expected = { int16_t(0x0001), int16_t(0x015A), int16_t(0xFEA5), int16_t(0xFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint16_t) - { - std::array storage = { char(0x80), char(0x00), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; - std::array expected = { uint16_t(0x0001), uint16_t(0x5AA5), uint16_t(0xA55A), uint16_t(0xFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint16_t_10bits) - { - std::array storage = { char(0x80), char(0x16), char(0xAA), char(0x57), char(0xFF) }; - std::array expected = { uint16_t(0x0001), uint16_t(0x015A), uint16_t(0x02A5), uint16_t(0x03FF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(10U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int32_t) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { int32_t(0x00000001), int32_t(0x5AA5A55A), int32_t(0xA55A5AA5), int32_t(0xFFFFFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int32_t_22bits) - { - std::array storage = { char(0x80), char(0x00), char(0x01), char(0x6A), - char(0x95), char(0x6A), char(0x55), char(0xAA), - char(0x7F), char(0xFF), char(0xFF) }; - std::array expected = { int32_t(0x00000001), int32_t(0x001AA55A), int32_t(0xFFE55AA5), int32_t(0xFFFFFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint32_t) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { int32_t(0x00000001), int32_t(0x5AA5A55A), int32_t(0xA55A5AA5), int32_t(0xFFFFFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint32_t_22bits) - { - std::array storage = { char(0x80), char(0x00), char(0x01), char(0x6A), - char(0x95), char(0x6A), char(0x55), char(0xAA), - char(0x7F), char(0xFF), char(0xFF) }; - std::array expected = { uint32_t(0x00000001), uint32_t(0x001AA55A), uint32_t(0x00255AA5), uint32_t(0x003FFFFF) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(22U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int64_t) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { int64_t(0x0000000000000001LL), int64_t(0x5AA5A55AA55A5AA5LL), int64_t(0xA55A5AA55AA5A55ALL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_int64_t_47bits) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x00), char(0xB5), char(0x4A), - char(0xB5), char(0x4A), char(0xB5), char(0x4A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0x95), char(0x6F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - std::array expected = { int64_t(0x0000000000000001LL), int64_t(0x0000255AA55AA55ALL), int64_t(0xFFFFDAA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint64_t) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - std::array expected = { uint64_t(0x0000000000000001ULL), uint64_t(0x5AA5A55AA55A5AA5ULL), uint64_t(0xA55A5AA55AA5A55AULL), uint64_t(0xFFFFFFFFFFFFFFFFULL) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_uint64_t_47bits) - { - std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x00), char(0xB5), char(0x4A), - char(0xB5), char(0x4A), char(0xB5), char(0x4A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0x95), char(0x6F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - std::array expected = { uint64_t(0x0000000000000001ULL), uint64_t(0x0000255AA55AA55AULL), uint64_t(0x00005AA55AA55AA5ULL), uint64_t(0x00007FFFFFFFFFFFULL) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - etl::optional result; - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[0], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[1], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[2], result.value()); - - result.reset(); - result = bit_stream.read(47U); - CHECK(result.has_value()); - CHECK_EQUAL(expected[3], result.value()); - - // One too many. - CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); - } - - //************************************************************************* - TEST(test_read_multiple_full_size) - { - //int8_t c1 = 90; // 0x5A - //uint16_t s1 = 4660; // 0x1234 - //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF - //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 - //uint16_t s2 = 22136; // 0x5678 - //int8_t c2 = -91; // 0xA5 - - std::array storage = { char(0x5A), - char(0x2C), char(0x48), - char(0xF7), char(0xB3), char(0xD5), char(0x91), - char(0x19), char(0x5D), char(0x3B), char(0x7F), - char(0x1E), char(0x6A), - char(0xA5) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - auto result_c1 = bit_stream.read(); - CHECK(result_c1.has_value()); - CHECK_EQUAL(int8_t(0x5A), result_c1.value()); - - auto result_s1 = bit_stream.read(); - CHECK(result_s1.has_value()); - CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); - - auto result_i1 = bit_stream.read(); - CHECK(result_i1.has_value()); - CHECK_EQUAL(int32_t(0x89ABCDEF), result_i1.value()); - - auto result_i2 = bit_stream.read(); - CHECK(result_i2.has_value()); - CHECK_EQUAL(int32_t(0xFEDCBA98), result_i2.value()); - - auto result_s2 = bit_stream.read(); - CHECK(result_s2.has_value()); - CHECK_EQUAL(uint16_t(0x5678), result_s2.value()); - - auto result_c2 = bit_stream.read(); - CHECK(result_c2.has_value()); - CHECK_EQUAL(int8_t(0xA5), result_c2.value()); - } - - //************************************************************************* - TEST(test_read_multiple_variable_size) - { - //int8_t c1 = 90; // 0x5A 6 bits - //uint16_t s1 = 4660; // 0x1234 13 bits - //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - //uint16_t s2 = 22136; // 0x5678 11 bits - //int8_t c2 = -91; // 0xA5 7 bits - - std::array storage = { char(0x58), char(0xB1), char(0x3E), char(0xF6), - char(0x7A), char(0x86), char(0x57), char(0x4E), - char(0xC3), char(0xCE), char(0x90) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - auto result_c1 = bit_stream.read(6U); - CHECK(result_c1.has_value()); - CHECK_EQUAL(int8_t(0x1A), result_c1.value()); - - auto result_s1 = bit_stream.read(13U); - CHECK(result_s1.has_value()); - CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); - - auto result_i1 = bit_stream.read(23U); - CHECK(result_i1.has_value()); - CHECK_EQUAL(int32_t(0x002BCDEF), result_i1.value()); - - auto result_i2 = bit_stream.read(25U); - CHECK(result_i2.has_value()); - CHECK_EQUAL(int32_t(0x00DCBA98), result_i2.value()); - - auto result_s2 = bit_stream.read(11U); - CHECK(result_s2.has_value()); - CHECK_EQUAL(uint16_t(0x0678), result_s2.value()); - - auto result_c2 = bit_stream.read(7U); - CHECK(result_c2.has_value()); - CHECK_EQUAL(int8_t(0x25), result_c2.value()); - } - - //************************************************************************* - TEST(test_read_multiple_variable_size_using_non_member_functions) - { - //int8_t c1 = 90; // 0x5A 6 bits - //uint16_t s1 = 4660; // 0x1234 13 bits - //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - //uint16_t s2 = 22136; // 0x5678 11 bits - //int8_t c2 = -91; // 0xA5 7 bits - - std::array storage = { char(0x58), char(0xB1), char(0x3E), char(0xF6), - char(0x7A), char(0x86), char(0x57), char(0x4E), - char(0xC3), char(0xCE), char(0x90) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - auto result_c1 = etl::read(bit_stream, 6U); - CHECK(result_c1.has_value()); - CHECK_EQUAL(int8_t(0x1A), result_c1.value()); - - auto result_s1 = etl::read(bit_stream, 13U); - CHECK(result_s1.has_value()); - CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); - - auto result_i1 = etl::read(bit_stream, 23U); - CHECK(result_i1.has_value()); - CHECK_EQUAL(int32_t(0x002BCDEF), result_i1.value()); - - auto result_i2 = etl::read(bit_stream, 25U); - CHECK(result_i2.has_value()); - CHECK_EQUAL(int32_t(0x00DCBA98), result_i2.value()); - - auto result_s2 = etl::read(bit_stream, 11U); - CHECK(result_s2.has_value()); - CHECK_EQUAL(uint16_t(0x0678), result_s2.value()); - - auto result_c2 = etl::read(bit_stream, 7U); - CHECK(result_c2.has_value()); - CHECK_EQUAL(int8_t(0x25), result_c2.value()); - } - - //************************************************************************* - TEST(test_read_checked_object) - { - std::array storage = { char(0x74), char(0xDE), char(0xA2), char(0xCF), - char(0x6A), char(0xFB), char(0xA3), char(0x5E), - char(0x5D), char(0x30), char(0x9F), char(0x80) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - Object object1 = { -1234, -2372331, 250 }; - Object object2 = { 5678, 2201423, 126 }; - - etl::optional result1 = etl::read(bit_stream); - etl::optional result2 = etl::read(bit_stream); - - CHECK(result1.has_value()); - CHECK(result2.has_value()); - - CHECK_EQUAL(object1.s, result1.value().s); - CHECK_EQUAL(object1.i, result1.value().i); - CHECK_EQUAL(object1.c, result1.value().c); - - CHECK_EQUAL(object2.s, result2.value().s); - CHECK_EQUAL(object2.i, result2.value().i); - CHECK_EQUAL(object2.c, result2.value().c); - } - - //************************************************************************* - TEST(test_read_unchecked_object) - { - std::array storage = { char(0x74), char(0xDE), char(0xA2), char(0xCF), - char(0x6A), char(0xFB), char(0xA3), char(0x5E), - char(0x5D), char(0x30), char(0x9F), char(0x80) }; - - etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); - - Object object1 = { -1234, -2372331, 250 }; - Object object2 = { 5678, 2201423, 126 }; - - Object result1 = etl::read_unchecked(bit_stream); - Object result2 = etl::read_unchecked(bit_stream); - - CHECK_EQUAL(object1.s, result1.s); - CHECK_EQUAL(object1.i, result1.i); - CHECK_EQUAL(object1.c, result1.c); - - CHECK_EQUAL(object2.s, result2.s); - CHECK_EQUAL(object2.i, result2.i); - CHECK_EQUAL(object2.c, result2.c); - } - }; -} - +///****************************************************************************** +//The MIT License(MIT) +// +//Embedded Template Library. +//https://github.com/ETLCPP/etl +//https://www.etlcpp.com +// +//Copyright(c) 2018 jwellbelove +// +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files(the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions : +// +//The above copyright notice and this permission notice shall be included in all +//copies or substantial portions of the Software. +// +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +//SOFTWARE. +//******************************************************************************/ +// +//#include "unit_test_framework.h" +// +//#include "etl/bit_stream.h" +// +//#include +//#include +// +//namespace +//{ +// //*********************************** +// struct Object +// { +// int16_t s; +// int32_t i; +// uint8_t c; +// }; +// +//#include "etl/private/diagnostic_unused_function_push.h" +// bool operator ==(const Object& lhs, const Object& rhs) +// { +// return (lhs.s == rhs.s) && +// (lhs.i == rhs.i) && +// (lhs.c == rhs.c); +// } +// +// std::ostream& operator << (std::ostream& os, const Object& object) +// { +// os << object.s << "," << object.i << "," << (int)object.c; +// return os; +// } +//#include "etl/private/diagnostic_pop.h" +//} +// +//namespace etl +//{ +// //*********************************** +// template <> +// Object read_unchecked(etl::bit_stream_reader& stream) +// { +// int16_t result_s = stream.read_unchecked(14); +// int32_t result_i = stream.read_unchecked(23); +// uint8_t result_c = stream.read_unchecked(); +// +// return Object{ result_s, result_i, result_c }; +// } +// +// //*********************************** +// template <> +// optional read(etl::bit_stream_reader& stream) +// { +// optional result; +// +// etl::optional result_s = stream.read(14); +// etl::optional result_i = stream.read(23); +// etl::optional result_c = stream.read(); +// +// if (result_s.has_value() && result_i.has_value() && result_c.has_value()) +// { +// result = Object{ result_s.value(), result_i.value(), result_c.value() }; +// } +// +// return result; +// } +//} +// +//namespace +//{ +// SUITE(test_bit_stream_reader) +// { +// //************************************************************************* +// TEST(test_read_bool) +// { +// char storage = 0x5AU; +// +// etl::bit_stream_reader bit_stream(&storage, 1, etl::endian::little); +// +// CHECK_EQUAL(1U, bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_bool_using_non_member_function) +// { +// char storage = 0x5AU; +// +// etl::bit_stream_reader bit_stream(&storage, 1, etl::endian::little); +// +// CHECK_EQUAL(1U, bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(true, result.value()); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(false, result.value()); +// +// // One too many. +// CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int8_t) +// { +// std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; +// std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_checked_int8_t_using_non_member_function) +// { +// std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; +// std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_unchecked_int8_t_using_non_member_function) +// { +// std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; +// std::array expected = { int8_t(0x01), int8_t(0x5A), int8_t(0xA5), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// int8_t result; +// +// result = etl::read_unchecked(bit_stream); +// CHECK_EQUAL(int(expected[0]), int(result)); +// +// result = etl::read_unchecked(bit_stream); +// CHECK_EQUAL(int(expected[1]), int(result)); +// +// result = etl::read_unchecked(bit_stream); +// CHECK_EQUAL(int(expected[2]), int(result)); +// +// result = etl::read_unchecked(bit_stream); +// CHECK_EQUAL(int(expected[3]), int(result)); +// } +// +// //************************************************************************* +// TEST(test_read_int8_t_5bits) +// { +// std::array storage = { char(0x85), char(0x69), char(0xF0) }; +// std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_checked_int8_t_5bits_using_non_member_function) +// { +// std::array storage = { char(0x85), char(0x69), char(0xF0) }; +// std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = etl::read(bit_stream, 5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream, 5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream, 5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = etl::read(bit_stream, 5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(etl::read(bit_stream, 5U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_unchecked_int8_t_5bits_using_non_member_function) +// { +// std::array storage = { char(0x85), char(0x69), char(0xF0) }; +// std::array expected = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// int8_t result; +// +// result = etl::read_unchecked(bit_stream, 5U); +// CHECK_EQUAL(int(expected[0]), int(result)); +// +// result = etl::read_unchecked(bit_stream, 5U); +// CHECK_EQUAL(int(expected[1]), int(result)); +// +// result = etl::read_unchecked(bit_stream, 5U); +// CHECK_EQUAL(int(expected[2]), int(result)); +// +// result = etl::read_unchecked(bit_stream, 5U); +// CHECK_EQUAL(int(expected[3]), int(result)); +// } +// +// //************************************************************************* +// TEST(test_read_uint8_t) +// { +// std::array storage = { char(0x80), char(0x5A), char(0xA5), char(0xFF) }; +// std::array expected = { uint8_t(0x01), uint8_t(0x5A), uint8_t(0xA5), uint8_t(0xFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint8_t_5bits) +// { +// std::array storage = { char(0x85), char(0x69), char(0xF0) }; +// std::array expected = { uint8_t(0x01), uint8_t(0x15), uint8_t(0x05), uint8_t(0x1F) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[1]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint8_t_5bits_with_skip) +// { +// std::array storage = { char(0x85), char(0x69), char(0xF0) }; +// std::array expected = { uint8_t(0x01), uint8_t(0x15), uint8_t(0x05), uint8_t(0x1F) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[0]), int(result.value())); +// +// bool success = bit_stream.skip(5U); +// CHECK(success); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[2]), int(result.value())); +// +// result.reset(); +// result = bit_stream.read(5U); +// CHECK(result.has_value()); +// CHECK_EQUAL(int(expected[3]), int(result.value())); +// +// // One too many. +// CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int16_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; +// std::array expected = { int16_t(0x0001), int16_t(0x5AA5), int16_t(0xA55A), int16_t(0xFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int16_t_10bits) +// { +// std::array storage = { char(0x80), char(0x16), char(0xAA), char(0x57), char(0xFF) }; +// std::array expected = { int16_t(0x0001), int16_t(0x015A), int16_t(0xFEA5), int16_t(0xFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint16_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xFF), char(0xFF) }; +// std::array expected = { uint16_t(0x0001), uint16_t(0x5AA5), uint16_t(0xA55A), uint16_t(0xFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint16_t_10bits) +// { +// std::array storage = { char(0x80), char(0x16), char(0xAA), char(0x57), char(0xFF) }; +// std::array expected = { uint16_t(0x0001), uint16_t(0x015A), uint16_t(0x02A5), uint16_t(0x03FF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(10U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int32_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// std::array expected = { int32_t(0x00000001), int32_t(0x5AA5A55A), int32_t(0xA55A5AA5), int32_t(0xFFFFFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int32_t_22bits) +// { +// std::array storage = { char(0x80), char(0x00), char(0x01), char(0x6A), +// char(0x95), char(0x6A), char(0x55), char(0xAA), +// char(0x7F), char(0xFF), char(0xFF) }; +// std::array expected = { int32_t(0x00000001), int32_t(0x001AA55A), int32_t(0xFFE55AA5), int32_t(0xFFFFFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint32_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// std::array expected = { int32_t(0x00000001), int32_t(0x5AA5A55A), int32_t(0xA55A5AA5), int32_t(0xFFFFFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint32_t_22bits) +// { +// std::array storage = { char(0x80), char(0x00), char(0x01), char(0x6A), +// char(0x95), char(0x6A), char(0x55), char(0xAA), +// char(0x7F), char(0xFF), char(0xFF) }; +// std::array expected = { uint32_t(0x00000001), uint32_t(0x001AA55A), uint32_t(0x00255AA5), uint32_t(0x003FFFFF) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(22U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int64_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// std::array expected = { int64_t(0x0000000000000001LL), int64_t(0x5AA5A55AA55A5AA5LL), int64_t(0xA55A5AA55AA5A55ALL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_int64_t_47bits) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x00), char(0xB5), char(0x4A), +// char(0xB5), char(0x4A), char(0xB5), char(0x4A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0x95), char(0x6F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// std::array expected = { int64_t(0x0000000000000001LL), int64_t(0x0000255AA55AA55ALL), int64_t(0xFFFFDAA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint64_t) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// std::array expected = { uint64_t(0x0000000000000001ULL), uint64_t(0x5AA5A55AA55A5AA5ULL), uint64_t(0xA55A5AA55AA5A55AULL), uint64_t(0xFFFFFFFFFFFFFFFFULL) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_uint64_t_47bits) +// { +// std::array storage = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x00), char(0xB5), char(0x4A), +// char(0xB5), char(0x4A), char(0xB5), char(0x4A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0x95), char(0x6F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// std::array expected = { uint64_t(0x0000000000000001ULL), uint64_t(0x0000255AA55AA55AULL), uint64_t(0x00005AA55AA55AA5ULL), uint64_t(0x00007FFFFFFFFFFFULL) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// etl::optional result; +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[0], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[1], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[2], result.value()); +// +// result.reset(); +// result = bit_stream.read(47U); +// CHECK(result.has_value()); +// CHECK_EQUAL(expected[3], result.value()); +// +// // One too many. +// CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); +// } +// +// //************************************************************************* +// TEST(test_read_multiple_full_size) +// { +// //int8_t c1 = 90; // 0x5A +// //uint16_t s1 = 4660; // 0x1234 +// //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF +// //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 +// //uint16_t s2 = 22136; // 0x5678 +// //int8_t c2 = -91; // 0xA5 +// +// std::array storage = { char(0x5A), +// char(0x2C), char(0x48), +// char(0xF7), char(0xB3), char(0xD5), char(0x91), +// char(0x19), char(0x5D), char(0x3B), char(0x7F), +// char(0x1E), char(0x6A), +// char(0xA5) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// auto result_c1 = bit_stream.read(); +// CHECK(result_c1.has_value()); +// CHECK_EQUAL(int8_t(0x5A), result_c1.value()); +// +// auto result_s1 = bit_stream.read(); +// CHECK(result_s1.has_value()); +// CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); +// +// auto result_i1 = bit_stream.read(); +// CHECK(result_i1.has_value()); +// CHECK_EQUAL(int32_t(0x89ABCDEF), result_i1.value()); +// +// auto result_i2 = bit_stream.read(); +// CHECK(result_i2.has_value()); +// CHECK_EQUAL(int32_t(0xFEDCBA98), result_i2.value()); +// +// auto result_s2 = bit_stream.read(); +// CHECK(result_s2.has_value()); +// CHECK_EQUAL(uint16_t(0x5678), result_s2.value()); +// +// auto result_c2 = bit_stream.read(); +// CHECK(result_c2.has_value()); +// CHECK_EQUAL(int8_t(0xA5), result_c2.value()); +// } +// +// //************************************************************************* +// TEST(test_read_multiple_variable_size) +// { +// //int8_t c1 = 90; // 0x5A 6 bits +// //uint16_t s1 = 4660; // 0x1234 13 bits +// //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// //uint16_t s2 = 22136; // 0x5678 11 bits +// //int8_t c2 = -91; // 0xA5 7 bits +// +// std::array storage = { char(0x58), char(0xB1), char(0x3E), char(0xF6), +// char(0x7A), char(0x86), char(0x57), char(0x4E), +// char(0xC3), char(0xCE), char(0x90) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// auto result_c1 = bit_stream.read(6U); +// CHECK(result_c1.has_value()); +// CHECK_EQUAL(int8_t(0x1A), result_c1.value()); +// +// auto result_s1 = bit_stream.read(13U); +// CHECK(result_s1.has_value()); +// CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); +// +// auto result_i1 = bit_stream.read(23U); +// CHECK(result_i1.has_value()); +// CHECK_EQUAL(int32_t(0x002BCDEF), result_i1.value()); +// +// auto result_i2 = bit_stream.read(25U); +// CHECK(result_i2.has_value()); +// CHECK_EQUAL(int32_t(0x00DCBA98), result_i2.value()); +// +// auto result_s2 = bit_stream.read(11U); +// CHECK(result_s2.has_value()); +// CHECK_EQUAL(uint16_t(0x0678), result_s2.value()); +// +// auto result_c2 = bit_stream.read(7U); +// CHECK(result_c2.has_value()); +// CHECK_EQUAL(int8_t(0x25), result_c2.value()); +// } +// +// //************************************************************************* +// TEST(test_read_multiple_variable_size_using_non_member_functions) +// { +// //int8_t c1 = 90; // 0x5A 6 bits +// //uint16_t s1 = 4660; // 0x1234 13 bits +// //int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// //int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// //uint16_t s2 = 22136; // 0x5678 11 bits +// //int8_t c2 = -91; // 0xA5 7 bits +// +// std::array storage = { char(0x58), char(0xB1), char(0x3E), char(0xF6), +// char(0x7A), char(0x86), char(0x57), char(0x4E), +// char(0xC3), char(0xCE), char(0x90) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// auto result_c1 = etl::read(bit_stream, 6U); +// CHECK(result_c1.has_value()); +// CHECK_EQUAL(int8_t(0x1A), result_c1.value()); +// +// auto result_s1 = etl::read(bit_stream, 13U); +// CHECK(result_s1.has_value()); +// CHECK_EQUAL(uint16_t(0x1234), result_s1.value()); +// +// auto result_i1 = etl::read(bit_stream, 23U); +// CHECK(result_i1.has_value()); +// CHECK_EQUAL(int32_t(0x002BCDEF), result_i1.value()); +// +// auto result_i2 = etl::read(bit_stream, 25U); +// CHECK(result_i2.has_value()); +// CHECK_EQUAL(int32_t(0x00DCBA98), result_i2.value()); +// +// auto result_s2 = etl::read(bit_stream, 11U); +// CHECK(result_s2.has_value()); +// CHECK_EQUAL(uint16_t(0x0678), result_s2.value()); +// +// auto result_c2 = etl::read(bit_stream, 7U); +// CHECK(result_c2.has_value()); +// CHECK_EQUAL(int8_t(0x25), result_c2.value()); +// } +// +// //************************************************************************* +// TEST(test_read_checked_object) +// { +// std::array storage = { char(0x74), char(0xDE), char(0xA2), char(0xCF), +// char(0x6A), char(0xFB), char(0xA3), char(0x5E), +// char(0x5D), char(0x30), char(0x9F), char(0x80) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// Object object1 = { -1234, -2372331, 250 }; +// Object object2 = { 5678, 2201423, 126 }; +// +// etl::optional result1 = etl::read(bit_stream); +// etl::optional result2 = etl::read(bit_stream); +// +// CHECK(result1.has_value()); +// CHECK(result2.has_value()); +// +// CHECK_EQUAL(object1.s, result1.value().s); +// CHECK_EQUAL(object1.i, result1.value().i); +// CHECK_EQUAL(object1.c, result1.value().c); +// +// CHECK_EQUAL(object2.s, result2.value().s); +// CHECK_EQUAL(object2.i, result2.value().i); +// CHECK_EQUAL(object2.c, result2.value().c); +// } +// +// //************************************************************************* +// TEST(test_read_unchecked_object) +// { +// std::array storage = { char(0x74), char(0xDE), char(0xA2), char(0xCF), +// char(0x6A), char(0xFB), char(0xA3), char(0x5E), +// char(0x5D), char(0x30), char(0x9F), char(0x80) }; +// +// etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.size_bytes()); +// +// Object object1 = { -1234, -2372331, 250 }; +// Object object2 = { 5678, 2201423, 126 }; +// +// Object result1 = etl::read_unchecked(bit_stream); +// Object result2 = etl::read_unchecked(bit_stream); +// +// CHECK_EQUAL(object1.s, result1.s); +// CHECK_EQUAL(object1.i, result1.i); +// CHECK_EQUAL(object1.c, result1.c); +// +// CHECK_EQUAL(object2.s, result2.s); +// CHECK_EQUAL(object2.i, result2.i); +// CHECK_EQUAL(object2.c, result2.c); +// } +// }; +//} +// diff --git a/test/test_bit_stream_writer_big_endian.cpp b/test/test_bit_stream_writer_big_endian.cpp index ccb1f6a2..4ee14e83 100644 --- a/test/test_bit_stream_writer_big_endian.cpp +++ b/test/test_bit_stream_writer_big_endian.cpp @@ -1,796 +1,796 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2022 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#include "unit_test_framework.h" - -#include "etl/bit_stream.h" - -#include -#include -#include - -namespace -{ - //*********************************** - struct Object - { - int16_t s; - int32_t i; - uint8_t c; - }; - -#include "etl/private/diagnostic_unused_function_push.h" - bool operator ==(const Object& lhs, const Object& rhs) - { - return (lhs.s == rhs.s) && - (lhs.i == rhs.i) && - (lhs.c == rhs.c); - } - - std::ostream& operator << (std::ostream& os, const Object& object) - { - os << object.s << "," << object.i << "," << (int)object.c; - return os; - } -#include "etl/private/diagnostic_pop.h" -} - -namespace etl -{ - //*********************************** - bool write(etl::bit_stream_writer& stream, const Object& object) - { - bool success = true; - - if (!stream.write(object.s, 14)) - { - success = false; - } - - if (!stream.write(object.i, 23)) - { - success = false; - } - - if (!stream.write(object.c)) - { - success = false; - } - - return success; - } -} - -namespace -{ - class Accumulator - { - public: - - void Add(etl::bit_stream_writer::callback_parameter_type s) - { - data.insert(data.end(), s.begin(), s.end()); - } - - void Clear() - { - data.clear(); - } - - const std::vector& GetData() const - { - return data; - } - - private: - - std::vector data; - }; - - SUITE(test_bit_stream_big_endian) - { - //************************************************************************* - TEST(test_bit_stream_writer_construction) - { - std::array storage; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK_EQUAL(storage.size(), bit_stream.available(CHAR_BIT)); - CHECK_EQUAL(storage.size(), bit_stream.available()); - CHECK_EQUAL(storage.size(), bit_stream.available()); - - CHECK_EQUAL(storage.size() * CHAR_BIT, bit_stream.available_bits()); - - CHECK_EQUAL(0U, bit_stream.size_bits()); - CHECK_EQUAL(0U, bit_stream.size_bytes()); - - CHECK_EQUAL(storage.size(), bit_stream.data().size()); - CHECK_EQUAL(0U, bit_stream.used_data().size()); - } - - //************************************************************************* - TEST(test_write_bool) - { - unsigned char storage = 0; - unsigned char expected = 0x5AU; - - etl::bit_stream_writer bit_stream(&storage, 1U, etl::endian::big); - - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(true), etl::bit_stream_overflow); - - CHECK_EQUAL(1U, bit_stream.data().size()); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - - CHECK_EQUAL(int(expected), int(storage)); - } - - //************************************************************************* - TEST(test_write_int8_t) - { - std::array storage; - - std::array expected; - std::iota(expected.begin(), expected.end(), 0); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - for (size_t i = 0UL; i < 256UL; ++i) - { - CHECK(bit_stream.write(int8_t(i))); - CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); - } - - // One too many. - CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(256U, bit_stream.data().size()); - CHECK_EQUAL(256U, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint8_t) - { - std::array storage; - - std::array expected; - std::iota(expected.begin(), expected.end(), 0); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - for (size_t i = 0UL; i < 256UL; ++i) - { - CHECK(bit_stream.write(uint8_t(i))); - CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); - } - - // One too many. - CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(256U, bit_stream.data().size()); - CHECK_EQUAL(256U, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int16_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x01), - char(0x5A), char(0xA5), - char(0xA5), char(0x5A), - char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(int16_t(0x0001))); - CHECK_EQUAL(sizeof(int16_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0x5AA5))); - CHECK_EQUAL(sizeof(int16_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0xA55A))); - CHECK_EQUAL(sizeof(int16_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0xFFFF))); - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int16_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint16_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x01), - char(0x5A), char(0xA5), - char(0xA5), char(0x5A), - char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(uint16_t(0x0001))); - CHECK_EQUAL(sizeof(uint16_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0x5AA5))); - CHECK_EQUAL(sizeof(uint16_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0xA55A))); - CHECK_EQUAL(sizeof(uint16_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0xFFFF))); - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint16_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int32_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x01), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(int32_t(0x00000001))); - CHECK_EQUAL(sizeof(int32_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0x5AA5A55A))); - CHECK_EQUAL(sizeof(int32_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0xA55A5AA5))); - CHECK_EQUAL(sizeof(int32_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0xFFFFFFFF))); - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int32_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint32_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x01), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(uint32_t(0x00000001))); - CHECK_EQUAL(sizeof(uint32_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0x5AA5A55A))); - CHECK_EQUAL(sizeof(uint32_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0xA55A5AA5))); - CHECK_EQUAL(sizeof(uint32_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0xFFFFFFFF))); - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint32_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int64_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(int64_t(0x0000000000000001LL))); - CHECK_EQUAL(sizeof(int64_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0x5AA5A55AA55A5AA5LL))); - CHECK_EQUAL(sizeof(int64_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0xA55A5AA55AA5A55ALL))); - CHECK_EQUAL(sizeof(int64_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0xFFFFFFFFFFFFFFFFLL))); - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int64_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint64_t) - { - std::array storage; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - CHECK(bit_stream.write(uint64_t(0x0000000000000001LL))); - CHECK_EQUAL(sizeof(uint64_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0x5AA5A55AA55A5AA5LL))); - CHECK_EQUAL(sizeof(uint64_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0xA55A5AA55AA5A55ALL))); - CHECK_EQUAL(sizeof(uint64_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0xFFFFFFFFFFFFFFFFLL))); - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint64_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int8_t_5bits) - { - std::array storage; - std::array write_data = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; // 1, -11, 10, -1 - std::array expected = { char(0x0D), char(0x4B), char(0xF0), char(0x00) }; // 1, -11, 10, -1 - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 5)); - CHECK_EQUAL(1, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 5)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - // 4th byte not used. - } - - //************************************************************************* - TEST(test_write_int16_t_10bits) - { - std::array storage; - std::array write_data = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; - std::array expected = { char(0x00), char(0x55), char(0xAA), char(0x97), - char(0xFF), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 10)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 10)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 10)); - CHECK_EQUAL(4, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 10)); - CHECK_EQUAL(5, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - // 6th to 8th bytes not used. - } - - //************************************************************************* - TEST(test_write_uint32_t_22bits) - { - std::array storage; - std::array write_data = { uint32_t(0x00000001UL), uint32_t(0xA55AA55AUL), uint32_t(0x5AA55AA5UL), uint32_t(0xFFFFFFFFUL) }; - std::array expected = { char(0x00), char(0x00), char(0x05), char(0xAA), - char(0x55), char(0xA9), char(0x56), char(0xA9), - char(0x7F), char(0xFF), char(0xFF), char(0x00), - char(0x00), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 22)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 22)); - CHECK_EQUAL(6, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 22)); - CHECK_EQUAL(9, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 22)); - CHECK_EQUAL(11, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - // 12th to 16th to bytes not used. - } - - //************************************************************************* - TEST(test_write_int64_t_47bits) - { - std::array storage; - std::array write_data = { int64_t(0x0000000000000001LL), int64_t(0xA55AA55AA55AA55ALL), int64_t(0x5AA55AA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x02), char(0x95), char(0x6A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0xD5), char(0x2A), char(0xD5), char(0x2A), - char(0xD5), char(0x2F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream - bit_stream.write(write_data[0], 47); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(write_data[1], 47); - CHECK_EQUAL(12, bit_stream.used_data().size()); - bit_stream.write(write_data[2], 47); - CHECK_EQUAL(18, bit_stream.used_data().size()); - bit_stream.write(write_data[3], 47); - CHECK_EQUAL(24, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - CHECK_EQUAL((int)expected[14], (int)storage[14]); - CHECK_EQUAL((int)expected[15], (int)storage[15]); - CHECK_EQUAL((int)expected[16], (int)storage[16]); - CHECK_EQUAL((int)expected[17], (int)storage[17]); - CHECK_EQUAL((int)expected[18], (int)storage[18]); - CHECK_EQUAL((int)expected[19], (int)storage[19]); - CHECK_EQUAL((int)expected[20], (int)storage[20]); - CHECK_EQUAL((int)expected[21], (int)storage[21]); - CHECK_EQUAL((int)expected[22], (int)storage[22]); - CHECK_EQUAL((int)expected[23], (int)storage[23]); - // 25th to 32nd bytes not used. - } - - //************************************************************************* - TEST(test_write_uint64_t_47bits) - { - std::array storage; - std::array write_data = { uint64_t(0x0000000000000001ULL), uint64_t(0xA55AA55AA55AA55AULL), uint64_t(0x5AA55AA55AA55AA5ULL), uint64_t(0xFFFFFFFFFFFFFFFFULL) }; - std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x02), char(0x95), char(0x6A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0xD5), char(0x2A), char(0xD5), char(0x2A), - char(0xD5), char(0x2F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream - bit_stream.write(write_data[0], 47); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(write_data[1], 47); - CHECK_EQUAL(12, bit_stream.used_data().size()); - bit_stream.write(write_data[2], 47); - CHECK_EQUAL(18, bit_stream.used_data().size()); - bit_stream.write(write_data[3], 47); - CHECK_EQUAL(24, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - CHECK_EQUAL((int)expected[14], (int)storage[14]); - CHECK_EQUAL((int)expected[15], (int)storage[15]); - CHECK_EQUAL((int)expected[16], (int)storage[16]); - CHECK_EQUAL((int)expected[17], (int)storage[17]); - CHECK_EQUAL((int)expected[18], (int)storage[18]); - CHECK_EQUAL((int)expected[19], (int)storage[19]); - CHECK_EQUAL((int)expected[20], (int)storage[20]); - CHECK_EQUAL((int)expected[21], (int)storage[21]); - CHECK_EQUAL((int)expected[22], (int)storage[22]); - CHECK_EQUAL((int)expected[23], (int)storage[23]); - // 25th to 32nd bytes not used. - } - - //************************************************************************* - TEST(test_write_multiple_full_size) - { - char c1 = 90; // 0x5A - char c2 = -91; // 0xA5 - unsigned short s1 = 4660; // 0x1234 - unsigned short s2 = 22136; // 0x5678 - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 - - std::array storage; - std::array expected = { char(0x5A), - char(0x12), char(0x34), - char(0x89), char(0xAB), char(0xCD), char(0xEF), - char(0xFE), char(0xDC), char(0xBA), char(0x98), - char(0x56), char(0x78), - char(0xA5) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream. - bit_stream.write(c1); - CHECK_EQUAL(1, bit_stream.used_data().size()); - bit_stream.write(s1); - CHECK_EQUAL(3, bit_stream.used_data().size()); - bit_stream.write(i1); - CHECK_EQUAL(7, bit_stream.used_data().size()); - bit_stream.write(i2); - CHECK_EQUAL(11, bit_stream.used_data().size()); - bit_stream.write(s2); - CHECK_EQUAL(13, bit_stream.used_data().size()); - bit_stream.write(c2); - CHECK_EQUAL(14, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - } - - //************************************************************************* - TEST(test_write_multiple_variable_size) - { - char c1 = 90; // 0x5A 6 bits - char c2 = -91; // 0xA5 7 bits - unsigned short s1 = 4660; // 0x1234 13 bits - unsigned short s2 = 22136; // 0x5678 11 bits - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - - std::array storage; - std::array expected = { char(0x6A), char(0x46), char(0x8A), char(0xF3), - char(0x7B), char(0xDB), char(0x97), char(0x53), - char(0x19), char(0xE1), char(0x28) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - // Insert into the stream. - bit_stream.write(c1, 6); - CHECK_EQUAL(1, bit_stream.used_data().size()); - bit_stream.write(s1, 13); - CHECK_EQUAL(3, bit_stream.used_data().size()); - bit_stream.write(i1, 23); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(i2, 25); - CHECK_EQUAL(9, bit_stream.used_data().size()); - bit_stream.write(s2, 11); - CHECK_EQUAL(10, bit_stream.used_data().size()); - bit_stream.write(c2, 7); - CHECK_EQUAL(11, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - } - - //************************************************************************* - TEST(test_write_multiple_variable_size_with_callback) - { - Accumulator accumulator; - - char c1 = 90; // 0x5A 6 bits - char c2 = -91; // 0xA5 7 bits - unsigned short s1 = 4660U; // 0x1234 13 bits - unsigned short s2 = 22136U; // 0x5678 11 bits - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - - std::array storage; - storage.fill(0); - std::array expected = { char(0x6A), char(0x46), char(0x8A), char(0xF3), - char(0x7B), char(0xDB), char(0x97), char(0x53), - char(0x19), char(0xE1), char(0x28) }; - - auto callback = etl::bit_stream_writer::callback_type::create(accumulator); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big, callback); - - // Insert into the stream. - bit_stream.write(c1, 6); - bit_stream.write(s1, 13); - bit_stream.write(i1, 23); - bit_stream.write(i2, 25); - bit_stream.write(s2, 11); - bit_stream.write(c2, 7); - bit_stream.flush(); - - CHECK_EQUAL(bit_stream.capacity_bytes(), bit_stream.available()); - - CHECK_EQUAL(11U, accumulator.GetData().size()); - - CHECK_EQUAL((int)expected[0], (int)accumulator.GetData()[0]); - CHECK_EQUAL((int)expected[1], (int)accumulator.GetData()[1]); - CHECK_EQUAL((int)expected[2], (int)accumulator.GetData()[2]); - CHECK_EQUAL((int)expected[3], (int)accumulator.GetData()[3]); - CHECK_EQUAL((int)expected[4], (int)accumulator.GetData()[4]); - CHECK_EQUAL((int)expected[5], (int)accumulator.GetData()[5]); - CHECK_EQUAL((int)expected[6], (int)accumulator.GetData()[6]); - CHECK_EQUAL((int)expected[7], (int)accumulator.GetData()[7]); - CHECK_EQUAL((int)expected[8], (int)accumulator.GetData()[8]); - CHECK_EQUAL((int)expected[9], (int)accumulator.GetData()[9]); - CHECK_EQUAL((int)expected[10], (int)accumulator.GetData()[10]); - } - - //************************************************************************* - TEST(test_write_object) - { - std::array storage; - storage.fill(0); - std::array expected{ char(0xEC), char(0xBA), char(0xDE), char(0x68), - char(0xAF), char(0xD2), char(0xC5), char(0xC8), - char(0x65), char(0xD3), char(0xDF), char(0x80) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); - - Object object1 = { -1234, 123456789, 250 }; - Object object2 = { 5678, -987654321, 126 }; - - CHECK(etl::write(bit_stream, object1)); - CHECK(etl::write(bit_stream, object2)); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - } - }; -} - +///****************************************************************************** +//The MIT License(MIT) +// +//Embedded Template Library. +//https://github.com/ETLCPP/etl +//https://www.etlcpp.com +// +//Copyright(c) 2022 jwellbelove +// +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files(the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions : +// +//The above copyright notice and this permission notice shall be included in all +//copies or substantial portions of the Software. +// +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +//SOFTWARE. +//******************************************************************************/ +// +//#include "unit_test_framework.h" +// +//#include "etl/bit_stream.h" +// +//#include +//#include +//#include +// +//namespace +//{ +// //*********************************** +// struct Object +// { +// int16_t s; +// int32_t i; +// uint8_t c; +// }; +// +//#include "etl/private/diagnostic_unused_function_push.h" +// bool operator ==(const Object& lhs, const Object& rhs) +// { +// return (lhs.s == rhs.s) && +// (lhs.i == rhs.i) && +// (lhs.c == rhs.c); +// } +// +// std::ostream& operator << (std::ostream& os, const Object& object) +// { +// os << object.s << "," << object.i << "," << (int)object.c; +// return os; +// } +//#include "etl/private/diagnostic_pop.h" +//} +// +//namespace etl +//{ +// //*********************************** +// bool write(etl::bit_stream_writer& stream, const Object& object) +// { +// bool success = true; +// +// if (!stream.write(object.s, 14)) +// { +// success = false; +// } +// +// if (!stream.write(object.i, 23)) +// { +// success = false; +// } +// +// if (!stream.write(object.c)) +// { +// success = false; +// } +// +// return success; +// } +//} +// +//namespace +//{ +// class Accumulator +// { +// public: +// +// void Add(etl::bit_stream_writer::callback_parameter_type s) +// { +// data.insert(data.end(), s.begin(), s.end()); +// } +// +// void Clear() +// { +// data.clear(); +// } +// +// const std::vector& GetData() const +// { +// return data; +// } +// +// private: +// +// std::vector data; +// }; +// +// SUITE(test_bit_stream_big_endian) +// { +// //************************************************************************* +// TEST(test_bit_stream_writer_construction) +// { +// std::array storage; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK_EQUAL(storage.size(), bit_stream.available(CHAR_BIT)); +// CHECK_EQUAL(storage.size(), bit_stream.available()); +// CHECK_EQUAL(storage.size(), bit_stream.available()); +// +// CHECK_EQUAL(storage.size() * CHAR_BIT, bit_stream.available_bits()); +// +// CHECK_EQUAL(0U, bit_stream.size_bits()); +// CHECK_EQUAL(0U, bit_stream.size_bytes()); +// +// CHECK_EQUAL(storage.size(), bit_stream.data().size()); +// CHECK_EQUAL(0U, bit_stream.used_data().size()); +// } +// +// //************************************************************************* +// TEST(test_write_bool) +// { +// unsigned char storage = 0; +// unsigned char expected = 0x5AU; +// +// etl::bit_stream_writer bit_stream(&storage, 1U, etl::endian::big); +// +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(true), etl::bit_stream_overflow); +// +// CHECK_EQUAL(1U, bit_stream.data().size()); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// +// CHECK_EQUAL(int(expected), int(storage)); +// } +// +// //************************************************************************* +// TEST(test_write_int8_t) +// { +// std::array storage; +// +// std::array expected; +// std::iota(expected.begin(), expected.end(), 0); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// for (size_t i = 0UL; i < 256UL; ++i) +// { +// CHECK(bit_stream.write(int8_t(i))); +// CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); +// } +// +// // One too many. +// CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(256U, bit_stream.data().size()); +// CHECK_EQUAL(256U, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint8_t) +// { +// std::array storage; +// +// std::array expected; +// std::iota(expected.begin(), expected.end(), 0); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// for (size_t i = 0UL; i < 256UL; ++i) +// { +// CHECK(bit_stream.write(uint8_t(i))); +// CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); +// } +// +// // One too many. +// CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(256U, bit_stream.data().size()); +// CHECK_EQUAL(256U, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int16_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x01), +// char(0x5A), char(0xA5), +// char(0xA5), char(0x5A), +// char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(int16_t(0x0001))); +// CHECK_EQUAL(sizeof(int16_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0x5AA5))); +// CHECK_EQUAL(sizeof(int16_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0xA55A))); +// CHECK_EQUAL(sizeof(int16_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0xFFFF))); +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int16_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint16_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x01), +// char(0x5A), char(0xA5), +// char(0xA5), char(0x5A), +// char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(uint16_t(0x0001))); +// CHECK_EQUAL(sizeof(uint16_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0x5AA5))); +// CHECK_EQUAL(sizeof(uint16_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0xA55A))); +// CHECK_EQUAL(sizeof(uint16_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0xFFFF))); +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint16_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int32_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x01), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(int32_t(0x00000001))); +// CHECK_EQUAL(sizeof(int32_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0x5AA5A55A))); +// CHECK_EQUAL(sizeof(int32_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0xA55A5AA5))); +// CHECK_EQUAL(sizeof(int32_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0xFFFFFFFF))); +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int32_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint32_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x01), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(uint32_t(0x00000001))); +// CHECK_EQUAL(sizeof(uint32_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0x5AA5A55A))); +// CHECK_EQUAL(sizeof(uint32_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0xA55A5AA5))); +// CHECK_EQUAL(sizeof(uint32_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0xFFFFFFFF))); +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint32_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int64_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(int64_t(0x0000000000000001LL))); +// CHECK_EQUAL(sizeof(int64_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0x5AA5A55AA55A5AA5LL))); +// CHECK_EQUAL(sizeof(int64_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0xA55A5AA55AA5A55ALL))); +// CHECK_EQUAL(sizeof(int64_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0xFFFFFFFFFFFFFFFFLL))); +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int64_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint64_t) +// { +// std::array storage; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x01), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// CHECK(bit_stream.write(uint64_t(0x0000000000000001LL))); +// CHECK_EQUAL(sizeof(uint64_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0x5AA5A55AA55A5AA5LL))); +// CHECK_EQUAL(sizeof(uint64_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0xA55A5AA55AA5A55ALL))); +// CHECK_EQUAL(sizeof(uint64_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0xFFFFFFFFFFFFFFFFLL))); +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint64_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int8_t_5bits) +// { +// std::array storage; +// std::array write_data = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; // 1, -11, 10, -1 +// std::array expected = { char(0x0D), char(0x4B), char(0xF0), char(0x00) }; // 1, -11, 10, -1 +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 5)); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 5)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// // 4th byte not used. +// } +// +// //************************************************************************* +// TEST(test_write_int16_t_10bits) +// { +// std::array storage; +// std::array write_data = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; +// std::array expected = { char(0x00), char(0x55), char(0xAA), char(0x97), +// char(0xFF), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 10)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 10)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 10)); +// CHECK_EQUAL(4, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 10)); +// CHECK_EQUAL(5, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// // 6th to 8th bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint32_t_22bits) +// { +// std::array storage; +// std::array write_data = { uint32_t(0x00000001UL), uint32_t(0xA55AA55AUL), uint32_t(0x5AA55AA5UL), uint32_t(0xFFFFFFFFUL) }; +// std::array expected = { char(0x00), char(0x00), char(0x05), char(0xAA), +// char(0x55), char(0xA9), char(0x56), char(0xA9), +// char(0x7F), char(0xFF), char(0xFF), char(0x00), +// char(0x00), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 22)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 22)); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 22)); +// CHECK_EQUAL(9, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 22)); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// // 12th to 16th to bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_int64_t_47bits) +// { +// std::array storage; +// std::array write_data = { int64_t(0x0000000000000001LL), int64_t(0xA55AA55AA55AA55ALL), int64_t(0x5AA55AA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x02), char(0x95), char(0x6A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0xD5), char(0x2A), char(0xD5), char(0x2A), +// char(0xD5), char(0x2F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream +// bit_stream.write(write_data[0], 47); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(write_data[1], 47); +// CHECK_EQUAL(12, bit_stream.used_data().size()); +// bit_stream.write(write_data[2], 47); +// CHECK_EQUAL(18, bit_stream.used_data().size()); +// bit_stream.write(write_data[3], 47); +// CHECK_EQUAL(24, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// CHECK_EQUAL((int)expected[14], (int)storage[14]); +// CHECK_EQUAL((int)expected[15], (int)storage[15]); +// CHECK_EQUAL((int)expected[16], (int)storage[16]); +// CHECK_EQUAL((int)expected[17], (int)storage[17]); +// CHECK_EQUAL((int)expected[18], (int)storage[18]); +// CHECK_EQUAL((int)expected[19], (int)storage[19]); +// CHECK_EQUAL((int)expected[20], (int)storage[20]); +// CHECK_EQUAL((int)expected[21], (int)storage[21]); +// CHECK_EQUAL((int)expected[22], (int)storage[22]); +// CHECK_EQUAL((int)expected[23], (int)storage[23]); +// // 25th to 32nd bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint64_t_47bits) +// { +// std::array storage; +// std::array write_data = { uint64_t(0x0000000000000001ULL), uint64_t(0xA55AA55AA55AA55AULL), uint64_t(0x5AA55AA55AA55AA5ULL), uint64_t(0xFFFFFFFFFFFFFFFFULL) }; +// std::array expected = { char(0x00), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x02), char(0x95), char(0x6A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0xD5), char(0x2A), char(0xD5), char(0x2A), +// char(0xD5), char(0x2F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream +// bit_stream.write(write_data[0], 47); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(write_data[1], 47); +// CHECK_EQUAL(12, bit_stream.used_data().size()); +// bit_stream.write(write_data[2], 47); +// CHECK_EQUAL(18, bit_stream.used_data().size()); +// bit_stream.write(write_data[3], 47); +// CHECK_EQUAL(24, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// CHECK_EQUAL((int)expected[14], (int)storage[14]); +// CHECK_EQUAL((int)expected[15], (int)storage[15]); +// CHECK_EQUAL((int)expected[16], (int)storage[16]); +// CHECK_EQUAL((int)expected[17], (int)storage[17]); +// CHECK_EQUAL((int)expected[18], (int)storage[18]); +// CHECK_EQUAL((int)expected[19], (int)storage[19]); +// CHECK_EQUAL((int)expected[20], (int)storage[20]); +// CHECK_EQUAL((int)expected[21], (int)storage[21]); +// CHECK_EQUAL((int)expected[22], (int)storage[22]); +// CHECK_EQUAL((int)expected[23], (int)storage[23]); +// // 25th to 32nd bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_multiple_full_size) +// { +// char c1 = 90; // 0x5A +// char c2 = -91; // 0xA5 +// unsigned short s1 = 4660; // 0x1234 +// unsigned short s2 = 22136; // 0x5678 +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 +// +// std::array storage; +// std::array expected = { char(0x5A), +// char(0x12), char(0x34), +// char(0x89), char(0xAB), char(0xCD), char(0xEF), +// char(0xFE), char(0xDC), char(0xBA), char(0x98), +// char(0x56), char(0x78), +// char(0xA5) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream. +// bit_stream.write(c1); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// bit_stream.write(s1); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// bit_stream.write(i1); +// CHECK_EQUAL(7, bit_stream.used_data().size()); +// bit_stream.write(i2); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// bit_stream.write(s2); +// CHECK_EQUAL(13, bit_stream.used_data().size()); +// bit_stream.write(c2); +// CHECK_EQUAL(14, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// } +// +// //************************************************************************* +// TEST(test_write_multiple_variable_size) +// { +// char c1 = 90; // 0x5A 6 bits +// char c2 = -91; // 0xA5 7 bits +// unsigned short s1 = 4660; // 0x1234 13 bits +// unsigned short s2 = 22136; // 0x5678 11 bits +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// +// std::array storage; +// std::array expected = { char(0x6A), char(0x46), char(0x8A), char(0xF3), +// char(0x7B), char(0xDB), char(0x97), char(0x53), +// char(0x19), char(0xE1), char(0x28) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// // Insert into the stream. +// bit_stream.write(c1, 6); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// bit_stream.write(s1, 13); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// bit_stream.write(i1, 23); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(i2, 25); +// CHECK_EQUAL(9, bit_stream.used_data().size()); +// bit_stream.write(s2, 11); +// CHECK_EQUAL(10, bit_stream.used_data().size()); +// bit_stream.write(c2, 7); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// } +// +// //************************************************************************* +// TEST(test_write_multiple_variable_size_with_callback) +// { +// Accumulator accumulator; +// +// char c1 = 90; // 0x5A 6 bits +// char c2 = -91; // 0xA5 7 bits +// unsigned short s1 = 4660U; // 0x1234 13 bits +// unsigned short s2 = 22136U; // 0x5678 11 bits +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// +// std::array storage; +// storage.fill(0); +// std::array expected = { char(0x6A), char(0x46), char(0x8A), char(0xF3), +// char(0x7B), char(0xDB), char(0x97), char(0x53), +// char(0x19), char(0xE1), char(0x28) }; +// +// auto callback = etl::bit_stream_writer::callback_type::create(accumulator); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big, callback); +// +// // Insert into the stream. +// bit_stream.write(c1, 6); +// bit_stream.write(s1, 13); +// bit_stream.write(i1, 23); +// bit_stream.write(i2, 25); +// bit_stream.write(s2, 11); +// bit_stream.write(c2, 7); +// bit_stream.flush(); +// +// CHECK_EQUAL(bit_stream.capacity_bytes(), bit_stream.available()); +// +// CHECK_EQUAL(11U, accumulator.GetData().size()); +// +// CHECK_EQUAL((int)expected[0], (int)accumulator.GetData()[0]); +// CHECK_EQUAL((int)expected[1], (int)accumulator.GetData()[1]); +// CHECK_EQUAL((int)expected[2], (int)accumulator.GetData()[2]); +// CHECK_EQUAL((int)expected[3], (int)accumulator.GetData()[3]); +// CHECK_EQUAL((int)expected[4], (int)accumulator.GetData()[4]); +// CHECK_EQUAL((int)expected[5], (int)accumulator.GetData()[5]); +// CHECK_EQUAL((int)expected[6], (int)accumulator.GetData()[6]); +// CHECK_EQUAL((int)expected[7], (int)accumulator.GetData()[7]); +// CHECK_EQUAL((int)expected[8], (int)accumulator.GetData()[8]); +// CHECK_EQUAL((int)expected[9], (int)accumulator.GetData()[9]); +// CHECK_EQUAL((int)expected[10], (int)accumulator.GetData()[10]); +// } +// +// //************************************************************************* +// TEST(test_write_object) +// { +// std::array storage; +// storage.fill(0); +// std::array expected{ char(0xEC), char(0xBA), char(0xDE), char(0x68), +// char(0xAF), char(0xD2), char(0xC5), char(0xC8), +// char(0x65), char(0xD3), char(0xDF), char(0x80) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::big); +// +// Object object1 = { -1234, 123456789, 250 }; +// Object object2 = { 5678, -987654321, 126 }; +// +// CHECK(etl::write(bit_stream, object1)); +// CHECK(etl::write(bit_stream, object2)); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// } +// }; +//} +// diff --git a/test/test_bit_stream_writer_little_endian.cpp b/test/test_bit_stream_writer_little_endian.cpp index df8bd1eb..ddb958b6 100644 --- a/test/test_bit_stream_writer_little_endian.cpp +++ b/test/test_bit_stream_writer_little_endian.cpp @@ -1,883 +1,883 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2022 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#include "unit_test_framework.h" - -#include "etl/bit_stream.h" - -#include -#include -#include - -namespace -{ - //*********************************** - struct Object - { - int16_t s; - int32_t i; - uint8_t c; - }; - -#include "etl/private/diagnostic_unused_function_push.h" - bool operator ==(const Object& lhs, const Object& rhs) - { - return (lhs.s == rhs.s) && - (lhs.i == rhs.i) && - (lhs.c == rhs.c); - } - - std::ostream& operator << (std::ostream& os, const Object& object) - { - os << object.s << "," << object.i << "," << (int)object.c; - return os; - } -#include "etl/private/diagnostic_pop.h" -} - -namespace etl -{ - //*********************************** - bool write(etl::bit_stream_writer& stream, const Object& object) - { - bool success = true; - - if (!stream.write(object.s, 14)) - { - success = false; - } - - if (!stream.write(object.i, 23)) - { - success = false; - } - - if (!stream.write(object.c)) - { - success = false; - } - - return success; - } -} - -namespace -{ - class Accumulator - { - public: - - void Add(etl::bit_stream_writer::callback_parameter_type s) - { - data.insert(data.end(), s.begin(), s.end()); - } - - void Clear() - { - data.clear(); - } - - const std::vector& GetData() const - { - return data; - } - - private: - - std::vector data; - }; - - SUITE(test_bit_stream_little_endian) - { - //************************************************************************* - TEST(test_bit_stream_writer_construction) - { - std::array storage; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK_EQUAL(storage.size(), bit_stream.available(CHAR_BIT)); - CHECK_EQUAL(storage.size(), bit_stream.available()); - CHECK_EQUAL(storage.size(), bit_stream.available()); - - CHECK_EQUAL(storage.size() * CHAR_BIT, bit_stream.available_bits()); - - CHECK_EQUAL(0U, bit_stream.size_bits()); - CHECK_EQUAL(0U, bit_stream.size_bytes()); - - CHECK_EQUAL(storage.size(), bit_stream.data().size()); - CHECK_EQUAL(0U, bit_stream.used_data().size()); - } - - //************************************************************************* - TEST(test_write_bool) - { - unsigned char storage = 0; - unsigned char expected = 0x5AU; - - etl::bit_stream_writer bit_stream(&storage, 1U, etl::endian::little); - - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(true)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - CHECK(bit_stream.write(false)); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(true), etl::bit_stream_overflow); - - CHECK_EQUAL(1U, bit_stream.data().size()); - CHECK_EQUAL(1U, bit_stream.used_data().size()); - - CHECK_EQUAL(int(expected), int(storage)); - } - - //************************************************************************* - TEST(test_write_int8_t) - { - std::array storage; - - std::array expected; - std::iota(expected.begin(), expected.end(), 0); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - for (size_t i = 0UL; i < 256UL; ++i) - { - CHECK(bit_stream.write(int8_t(i))); - CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); - } - - // One too many. - CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(256U, bit_stream.data().size()); - CHECK_EQUAL(256U, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(etl::reverse_bits(expected[i])), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint8_t) - { - std::array storage; - - std::array expected; - std::iota(expected.begin(), expected.end(), 0); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - for (size_t i = 0UL; i < 256UL; ++i) - { - CHECK(bit_stream.write(uint8_t(i))); - CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); - } - - // One too many. - CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(256U, bit_stream.data().size()); - CHECK_EQUAL(256U, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(etl::reverse_bits(expected[i])), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int16_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), - char(0xA5), char(0x5A), - char(0x5A), char(0xA5), - char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(int16_t(0x0001))); - CHECK_EQUAL(sizeof(int16_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0x5AA5))); - CHECK_EQUAL(sizeof(int16_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0xA55A))); - CHECK_EQUAL(sizeof(int16_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int16_t(0xFFFF))); - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int16_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint16_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), - char(0xA5), char(0x5A), - char(0x5A), char(0xA5), - char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(uint16_t(0x0001))); - CHECK_EQUAL(sizeof(uint16_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0x5AA5))); - CHECK_EQUAL(sizeof(uint16_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0xA55A))); - CHECK_EQUAL(sizeof(uint16_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint16_t(0xFFFF))); - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint16_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int32_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(int32_t(0x00000001))); - CHECK_EQUAL(sizeof(int32_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0x5AA5A55A))); - CHECK_EQUAL(sizeof(int32_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0xA55A5AA5))); - CHECK_EQUAL(sizeof(int32_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int32_t(0xFFFFFFFF))); - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int32_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint32_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(uint32_t(0x00000001))); - CHECK_EQUAL(sizeof(uint32_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0x5AA5A55A))); - CHECK_EQUAL(sizeof(uint32_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0xA55A5AA5))); - CHECK_EQUAL(sizeof(uint32_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint32_t(0xFFFFFFFF))); - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint32_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int64_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(int64_t(0x0000000000000001LL))); - CHECK_EQUAL(sizeof(int64_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0x5AA5A55AA55A5AA5LL))); - CHECK_EQUAL(sizeof(int64_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0xA55A5AA55AA5A55ALL))); - CHECK_EQUAL(sizeof(int64_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(int64_t(0xFFFFFFFFFFFFFFFFLL))); - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(int64_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_uint64_t) - { - std::array storage; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), - char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), - char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), - char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; - - CHECK(expected.size() == storage.size()); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - CHECK(bit_stream.write(uint64_t(0x0000000000000001LL))); - CHECK_EQUAL(sizeof(uint64_t) * 1, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0x5AA5A55AA55A5AA5LL))); - CHECK_EQUAL(sizeof(uint64_t) * 2, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0xA55A5AA55AA5A55ALL))); - CHECK_EQUAL(sizeof(uint64_t) * 3, bit_stream.used_data().size()); - CHECK(bit_stream.write(uint64_t(0xFFFFFFFFFFFFFFFFLL))); - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); - - // One too many. - CHECK_THROW(bit_stream.write(uint64_t(0)), etl::bit_stream_overflow); - - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.data().size()); - CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); - - for (size_t i = 0UL; i < storage.size(); ++i) - { - CHECK_EQUAL(int(expected[i]), int(storage[i])); - } - } - - //************************************************************************* - TEST(test_write_int8_t_5bits) - { - std::array storage; - std::array write_data = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; // 1, -11, 10, -1 - std::array expected = { char(0x85), char(0x69), char(0xF0), char(0x00) }; // 1, -11, 10, -1 - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 5)); - CHECK_EQUAL(1, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 5)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - // 4th byte not used. - } - - //************************************************************************* - TEST(test_write_uint8_t_5bits) - { - std::array storage; - std::array write_data = { uint8_t(0x01), uint8_t(0xF5), uint8_t(0x05), uint8_t(0xFF) }; // 1, -11, 10, -1 - std::array expected = { char(0x85), char(0x69), char(0xF0), char(0x00) }; // 1, -11, 10, -1 - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 5)); - CHECK_EQUAL(1, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 5)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 5)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - // 4th byte not used. - } - - //************************************************************************* - TEST(test_write_int16_t_10bits) - { - std::array storage; - std::array write_data = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; - std::array expected = { char(0x80), char(0x16), char(0xAA), char(0x57), - char(0xFF), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 10)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 10)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 10)); - CHECK_EQUAL(4, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 10)); - CHECK_EQUAL(5, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - // 6th to 8th bytes not used. - } - - //************************************************************************* - TEST(test_write_uint16_t_10bits) - { - std::array storage; - std::array write_data = { uint16_t(0x0001), uint16_t(0xA55A), uint16_t(0x5AA5), uint16_t(0xFFFF) }; - std::array expected = { char(0x80), char(0x16), char(0xAA), char(0x57), - char(0xFF), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 10)); - CHECK_EQUAL(2, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 10)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 10)); - CHECK_EQUAL(4, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 10)); - CHECK_EQUAL(5, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - // 6th to 8th bytes not used. - } - - //************************************************************************* - TEST(test_write_int32_t_22bits) - { - std::array storage; - std::array write_data = { int32_t(0x00000001UL), int32_t(0xA55AA55AUL), int32_t(0x5AA55AA5UL), int32_t(0xFFFFFFFFUL) }; - std::array expected = { char(0x80), char(0x00), char(0x01), char(0x6A), - char(0x95), char(0x6A), char(0x55), char(0xAA), - char(0x7F), char(0xFF), char(0xFF), char(0x00), - char(0x00), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 22)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 22)); - CHECK_EQUAL(6, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 22)); - CHECK_EQUAL(9, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 22)); - CHECK_EQUAL(11, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - // 12th to 16th to bytes not used. - } - - //************************************************************************* - TEST(test_write_uint32_t_22bits) - { - std::array storage; - std::array write_data = { uint32_t(0x00000001UL), uint32_t(0xA55AA55AUL), uint32_t(0x5AA55AA5UL), uint32_t(0xFFFFFFFFUL) }; - std::array expected = { char(0x80), char(0x00), char(0x01), char(0x6A), - char(0x95), char(0x6A), char(0x55), char(0xAA), - char(0x7F), char(0xFF), char(0xFF), char(0x00), - char(0x00), char(0x00), char(0x00), char(0x00) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - CHECK(bit_stream.write(write_data[0], 22)); - CHECK_EQUAL(3, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[1], 22)); - CHECK_EQUAL(6, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[2], 22)); - CHECK_EQUAL(9, bit_stream.used_data().size()); - CHECK(bit_stream.write(write_data[3], 22)); - CHECK_EQUAL(11, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - // 12th to 16th to bytes not used. - } - - //************************************************************************* - TEST(test_write_int64_t_47bits) - { - std::array storage; - std::array write_data = { int64_t(0x0000000000000001LL), int64_t(0xA55AA55AA55AA55ALL), int64_t(0x5AA55AA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x00), char(0xB5), char(0x4A), - char(0xB5), char(0x4A), char(0xB5), char(0x4A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0x95), char(0x6F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - bit_stream.write(write_data[0], 47); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(write_data[1], 47); - CHECK_EQUAL(12, bit_stream.used_data().size()); - bit_stream.write(write_data[2], 47); - CHECK_EQUAL(18, bit_stream.used_data().size()); - bit_stream.write(write_data[3], 47); - CHECK_EQUAL(24, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - CHECK_EQUAL((int)expected[14], (int)storage[14]); - CHECK_EQUAL((int)expected[15], (int)storage[15]); - CHECK_EQUAL((int)expected[16], (int)storage[16]); - CHECK_EQUAL((int)expected[17], (int)storage[17]); - CHECK_EQUAL((int)expected[18], (int)storage[18]); - CHECK_EQUAL((int)expected[19], (int)storage[19]); - CHECK_EQUAL((int)expected[20], (int)storage[20]); - CHECK_EQUAL((int)expected[21], (int)storage[21]); - CHECK_EQUAL((int)expected[22], (int)storage[22]); - CHECK_EQUAL((int)expected[23], (int)storage[23]); - // 25th to 32nd bytes not used. - } - - //************************************************************************* - TEST(test_write_uint64_t_47bits) - { - std::array storage; - std::array write_data = { uint64_t(0x0000000000000001LL), uint64_t(0xA55AA55AA55AA55ALL), uint64_t(0x5AA55AA55AA55AA5LL), uint64_t(0xFFFFFFFFFFFFFFFFLL) }; - std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), - char(0x00), char(0x00), char(0xB5), char(0x4A), - char(0xB5), char(0x4A), char(0xB5), char(0x4A), - char(0x95), char(0x6A), char(0x95), char(0x6A), - char(0x95), char(0x6F), char(0xFF), char(0xFF), - char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream - bit_stream.write(write_data[0], 47); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(write_data[1], 47); - CHECK_EQUAL(12, bit_stream.used_data().size()); - bit_stream.write(write_data[2], 47); - CHECK_EQUAL(18, bit_stream.used_data().size()); - bit_stream.write(write_data[3], 47); - CHECK_EQUAL(24, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - CHECK_EQUAL((int)expected[14], (int)storage[14]); - CHECK_EQUAL((int)expected[15], (int)storage[15]); - CHECK_EQUAL((int)expected[16], (int)storage[16]); - CHECK_EQUAL((int)expected[17], (int)storage[17]); - CHECK_EQUAL((int)expected[18], (int)storage[18]); - CHECK_EQUAL((int)expected[19], (int)storage[19]); - CHECK_EQUAL((int)expected[20], (int)storage[20]); - CHECK_EQUAL((int)expected[21], (int)storage[21]); - CHECK_EQUAL((int)expected[22], (int)storage[22]); - CHECK_EQUAL((int)expected[23], (int)storage[23]); - // 25th to 32nd bytes not used. - } - - //************************************************************************* - TEST(test_write_multiple_full_size) - { - char c1 = 90; // 0x5A - char c2 = -91; // 0xA5 - unsigned short s1 = 4660; // 0x1234 - unsigned short s2 = 22136; // 0x5678 - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 - - std::array storage; - std::array expected = { char(0x5A), - char(0x2C), char(0x48), - char(0xF7), char(0xB3), char(0xD5), char(0x91), - char(0x19), char(0x5D), char(0x3B), char(0x7F), - char(0x1E), char(0x6A), - char(0xA5) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream. - bit_stream.write(c1); - CHECK_EQUAL(1, bit_stream.used_data().size()); - bit_stream.write(s1); - CHECK_EQUAL(3, bit_stream.used_data().size()); - bit_stream.write(i1); - CHECK_EQUAL(7, bit_stream.used_data().size()); - bit_stream.write(i2); - CHECK_EQUAL(11, bit_stream.used_data().size()); - bit_stream.write(s2); - CHECK_EQUAL(13, bit_stream.used_data().size()); - bit_stream.write(c2); - CHECK_EQUAL(14, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - CHECK_EQUAL((int)expected[12], (int)storage[12]); - CHECK_EQUAL((int)expected[13], (int)storage[13]); - } - - //************************************************************************* - TEST(test_write_multiple_variable_size) - { - char c1 = 90; // 0x5A 6 bits - char c2 = -91; // 0xA5 7 bits - unsigned short s1 = 4660; // 0x1234 13 bits - unsigned short s2 = 22136; // 0x5678 11 bits - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - - std::array storage; - std::array expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6), - char(0x7A), char(0x86), char(0x57), char(0x4E), - char(0xC3), char(0xCE), char(0x90) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - // Insert into the stream. - bit_stream.write(c1, 6); - CHECK_EQUAL(1, bit_stream.used_data().size()); - bit_stream.write(s1, 13); - CHECK_EQUAL(3, bit_stream.used_data().size()); - bit_stream.write(i1, 23); - CHECK_EQUAL(6, bit_stream.used_data().size()); - bit_stream.write(i2, 25); - CHECK_EQUAL(9, bit_stream.used_data().size()); - bit_stream.write(s2, 11); - CHECK_EQUAL(10, bit_stream.used_data().size()); - bit_stream.write(c2, 7); - CHECK_EQUAL(11, bit_stream.used_data().size()); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - } - - //************************************************************************* - TEST(test_write_multiple_variable_size_with_callback) - { - char c1 = 90; // 0x5A 6 bits - char c2 = -91; // 0xA5 7 bits - unsigned short s1 = 4660; // 0x1234 13 bits - unsigned short s2 = 22136; // 0x5678 11 bits - int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits - int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits - - std::array storage; - std::array expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6), - char(0x7A), char(0x86), char(0x57), char(0x4E), - char(0xC3), char(0xCE), char(0x90) }; - - Accumulator accumulator; - - auto callback = etl::bit_stream_writer::callback_type::create(accumulator); - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little, callback); - - // Insert into the stream. - bit_stream.write(c1, 6); - bit_stream.write(s1, 13); - bit_stream.write(i1, 23); - bit_stream.write(i2, 25); - bit_stream.write(s2, 11); - bit_stream.write(c2, 7); - bit_stream.flush(); - - CHECK_EQUAL(bit_stream.capacity_bytes(), bit_stream.available()); - - CHECK_EQUAL(11U, accumulator.GetData().size()); - - CHECK_EQUAL((int)expected[0], (int)accumulator.GetData()[0]); - CHECK_EQUAL((int)expected[1], (int)accumulator.GetData()[1]); - CHECK_EQUAL((int)expected[2], (int)accumulator.GetData()[2]); - CHECK_EQUAL((int)expected[3], (int)accumulator.GetData()[3]); - CHECK_EQUAL((int)expected[4], (int)accumulator.GetData()[4]); - CHECK_EQUAL((int)expected[5], (int)accumulator.GetData()[5]); - CHECK_EQUAL((int)expected[6], (int)accumulator.GetData()[6]); - CHECK_EQUAL((int)expected[7], (int)accumulator.GetData()[7]); - CHECK_EQUAL((int)expected[8], (int)accumulator.GetData()[8]); - CHECK_EQUAL((int)expected[9], (int)accumulator.GetData()[9]); - CHECK_EQUAL((int)expected[10], (int)accumulator.GetData()[10]); - } - - //************************************************************************* - TEST(test_write_object) - { - std::array storage; - storage.fill(0); - std::array expected{ char(0x74), char(0xDE), char(0xA2), char(0xCF), - char(0x6A), char(0xFB), char(0xA3), char(0x5E), - char(0x5D), char(0x30), char(0x9F), char(0x80) }; - - etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); - - Object object1 = { -1234, 123456789, 250 }; - Object object2 = { 5678, -987654321, 126 }; - - CHECK(etl::write(bit_stream, object1)); - CHECK(etl::write(bit_stream, object2)); - - CHECK_EQUAL((int)expected[0], (int)storage[0]); - CHECK_EQUAL((int)expected[1], (int)storage[1]); - CHECK_EQUAL((int)expected[2], (int)storage[2]); - CHECK_EQUAL((int)expected[3], (int)storage[3]); - CHECK_EQUAL((int)expected[4], (int)storage[4]); - CHECK_EQUAL((int)expected[5], (int)storage[5]); - CHECK_EQUAL((int)expected[6], (int)storage[6]); - CHECK_EQUAL((int)expected[7], (int)storage[7]); - CHECK_EQUAL((int)expected[8], (int)storage[8]); - CHECK_EQUAL((int)expected[9], (int)storage[9]); - CHECK_EQUAL((int)expected[10], (int)storage[10]); - CHECK_EQUAL((int)expected[11], (int)storage[11]); - } - }; -} +///****************************************************************************** +//The MIT License(MIT) +// +//Embedded Template Library. +//https://github.com/ETLCPP/etl +//https://www.etlcpp.com +// +//Copyright(c) 2022 jwellbelove +// +//Permission is hereby granted, free of charge, to any person obtaining a copy +//of this software and associated documentation files(the "Software"), to deal +//in the Software without restriction, including without limitation the rights +//to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +//copies of the Software, and to permit persons to whom the Software is +//furnished to do so, subject to the following conditions : +// +//The above copyright notice and this permission notice shall be included in all +//copies or substantial portions of the Software. +// +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +//SOFTWARE. +//******************************************************************************/ +// +//#include "unit_test_framework.h" +// +//#include "etl/bit_stream.h" +// +//#include +//#include +//#include +// +//namespace +//{ +// //*********************************** +// struct Object +// { +// int16_t s; +// int32_t i; +// uint8_t c; +// }; +// +//#include "etl/private/diagnostic_unused_function_push.h" +// bool operator ==(const Object& lhs, const Object& rhs) +// { +// return (lhs.s == rhs.s) && +// (lhs.i == rhs.i) && +// (lhs.c == rhs.c); +// } +// +// std::ostream& operator << (std::ostream& os, const Object& object) +// { +// os << object.s << "," << object.i << "," << (int)object.c; +// return os; +// } +//#include "etl/private/diagnostic_pop.h" +//} +// +//namespace etl +//{ +// //*********************************** +// bool write(etl::bit_stream_writer& stream, const Object& object) +// { +// bool success = true; +// +// if (!stream.write(object.s, 14)) +// { +// success = false; +// } +// +// if (!stream.write(object.i, 23)) +// { +// success = false; +// } +// +// if (!stream.write(object.c)) +// { +// success = false; +// } +// +// return success; +// } +//} +// +//namespace +//{ +// class Accumulator +// { +// public: +// +// void Add(etl::bit_stream_writer::callback_parameter_type s) +// { +// data.insert(data.end(), s.begin(), s.end()); +// } +// +// void Clear() +// { +// data.clear(); +// } +// +// const std::vector& GetData() const +// { +// return data; +// } +// +// private: +// +// std::vector data; +// }; +// +// SUITE(test_bit_stream_little_endian) +// { +// //************************************************************************* +// TEST(test_bit_stream_writer_construction) +// { +// std::array storage; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK_EQUAL(storage.size(), bit_stream.available(CHAR_BIT)); +// CHECK_EQUAL(storage.size(), bit_stream.available()); +// CHECK_EQUAL(storage.size(), bit_stream.available()); +// +// CHECK_EQUAL(storage.size() * CHAR_BIT, bit_stream.available_bits()); +// +// CHECK_EQUAL(0U, bit_stream.size_bits()); +// CHECK_EQUAL(0U, bit_stream.size_bytes()); +// +// CHECK_EQUAL(storage.size(), bit_stream.data().size()); +// CHECK_EQUAL(0U, bit_stream.used_data().size()); +// } +// +// //************************************************************************* +// TEST(test_write_bool) +// { +// unsigned char storage = 0; +// unsigned char expected = 0x5AU; +// +// etl::bit_stream_writer bit_stream(&storage, 1U, etl::endian::little); +// +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(true)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// CHECK(bit_stream.write(false)); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(true), etl::bit_stream_overflow); +// +// CHECK_EQUAL(1U, bit_stream.data().size()); +// CHECK_EQUAL(1U, bit_stream.used_data().size()); +// +// CHECK_EQUAL(int(expected), int(storage)); +// } +// +// //************************************************************************* +// TEST(test_write_int8_t) +// { +// std::array storage; +// +// std::array expected; +// std::iota(expected.begin(), expected.end(), 0); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// for (size_t i = 0UL; i < 256UL; ++i) +// { +// CHECK(bit_stream.write(int8_t(i))); +// CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); +// } +// +// // One too many. +// CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(256U, bit_stream.data().size()); +// CHECK_EQUAL(256U, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(etl::reverse_bits(expected[i])), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint8_t) +// { +// std::array storage; +// +// std::array expected; +// std::iota(expected.begin(), expected.end(), 0); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// for (size_t i = 0UL; i < 256UL; ++i) +// { +// CHECK(bit_stream.write(uint8_t(i))); +// CHECK_EQUAL(i + 1U, bit_stream.used_data().size()); +// } +// +// // One too many. +// CHECK_THROW(bit_stream.write(int8_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(256U, bit_stream.data().size()); +// CHECK_EQUAL(256U, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(etl::reverse_bits(expected[i])), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int16_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), +// char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), +// char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(int16_t(0x0001))); +// CHECK_EQUAL(sizeof(int16_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0x5AA5))); +// CHECK_EQUAL(sizeof(int16_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0xA55A))); +// CHECK_EQUAL(sizeof(int16_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int16_t(0xFFFF))); +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int16_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int16_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint16_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), +// char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), +// char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(uint16_t(0x0001))); +// CHECK_EQUAL(sizeof(uint16_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0x5AA5))); +// CHECK_EQUAL(sizeof(uint16_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0xA55A))); +// CHECK_EQUAL(sizeof(uint16_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint16_t(0xFFFF))); +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint16_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint16_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int32_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(int32_t(0x00000001))); +// CHECK_EQUAL(sizeof(int32_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0x5AA5A55A))); +// CHECK_EQUAL(sizeof(int32_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0xA55A5AA5))); +// CHECK_EQUAL(sizeof(int32_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int32_t(0xFFFFFFFF))); +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int32_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int32_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint32_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(uint32_t(0x00000001))); +// CHECK_EQUAL(sizeof(uint32_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0x5AA5A55A))); +// CHECK_EQUAL(sizeof(uint32_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0xA55A5AA5))); +// CHECK_EQUAL(sizeof(uint32_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint32_t(0xFFFFFFFF))); +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint32_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint32_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int64_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(int64_t(0x0000000000000001LL))); +// CHECK_EQUAL(sizeof(int64_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0x5AA5A55AA55A5AA5LL))); +// CHECK_EQUAL(sizeof(int64_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0xA55A5AA55AA5A55ALL))); +// CHECK_EQUAL(sizeof(int64_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(int64_t(0xFFFFFFFFFFFFFFFFLL))); +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(int64_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(int64_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_uint64_t) +// { +// std::array storage; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), char(0x00), +// char(0xA5), char(0x5A), char(0x5A), char(0xA5), char(0x5A), char(0xA5), char(0xA5), char(0x5A), +// char(0x5A), char(0xA5), char(0xA5), char(0x5A), char(0xA5), char(0x5A), char(0x5A), char(0xA5), +// char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF), char(0xFF) }; +// +// CHECK(expected.size() == storage.size()); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// CHECK(bit_stream.write(uint64_t(0x0000000000000001LL))); +// CHECK_EQUAL(sizeof(uint64_t) * 1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0x5AA5A55AA55A5AA5LL))); +// CHECK_EQUAL(sizeof(uint64_t) * 2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0xA55A5AA55AA5A55ALL))); +// CHECK_EQUAL(sizeof(uint64_t) * 3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(uint64_t(0xFFFFFFFFFFFFFFFFLL))); +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); +// +// // One too many. +// CHECK_THROW(bit_stream.write(uint64_t(0)), etl::bit_stream_overflow); +// +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.data().size()); +// CHECK_EQUAL(sizeof(uint64_t) * 4, bit_stream.used_data().size()); +// +// for (size_t i = 0UL; i < storage.size(); ++i) +// { +// CHECK_EQUAL(int(expected[i]), int(storage[i])); +// } +// } +// +// //************************************************************************* +// TEST(test_write_int8_t_5bits) +// { +// std::array storage; +// std::array write_data = { int8_t(0x01), int8_t(0xF5), int8_t(0x05), int8_t(0xFF) }; // 1, -11, 10, -1 +// std::array expected = { char(0x85), char(0x69), char(0xF0), char(0x00) }; // 1, -11, 10, -1 +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 5)); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 5)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// // 4th byte not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint8_t_5bits) +// { +// std::array storage; +// std::array write_data = { uint8_t(0x01), uint8_t(0xF5), uint8_t(0x05), uint8_t(0xFF) }; // 1, -11, 10, -1 +// std::array expected = { char(0x85), char(0x69), char(0xF0), char(0x00) }; // 1, -11, 10, -1 +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 5)); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 5)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 5)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// // 4th byte not used. +// } +// +// //************************************************************************* +// TEST(test_write_int16_t_10bits) +// { +// std::array storage; +// std::array write_data = { int16_t(0x0001), int16_t(0xA55A), int16_t(0x5AA5), int16_t(0xFFFF) }; +// std::array expected = { char(0x80), char(0x16), char(0xAA), char(0x57), +// char(0xFF), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 10)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 10)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 10)); +// CHECK_EQUAL(4, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 10)); +// CHECK_EQUAL(5, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// // 6th to 8th bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint16_t_10bits) +// { +// std::array storage; +// std::array write_data = { uint16_t(0x0001), uint16_t(0xA55A), uint16_t(0x5AA5), uint16_t(0xFFFF) }; +// std::array expected = { char(0x80), char(0x16), char(0xAA), char(0x57), +// char(0xFF), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 10)); +// CHECK_EQUAL(2, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 10)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 10)); +// CHECK_EQUAL(4, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 10)); +// CHECK_EQUAL(5, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// // 6th to 8th bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_int32_t_22bits) +// { +// std::array storage; +// std::array write_data = { int32_t(0x00000001UL), int32_t(0xA55AA55AUL), int32_t(0x5AA55AA5UL), int32_t(0xFFFFFFFFUL) }; +// std::array expected = { char(0x80), char(0x00), char(0x01), char(0x6A), +// char(0x95), char(0x6A), char(0x55), char(0xAA), +// char(0x7F), char(0xFF), char(0xFF), char(0x00), +// char(0x00), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 22)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 22)); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 22)); +// CHECK_EQUAL(9, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 22)); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// // 12th to 16th to bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint32_t_22bits) +// { +// std::array storage; +// std::array write_data = { uint32_t(0x00000001UL), uint32_t(0xA55AA55AUL), uint32_t(0x5AA55AA5UL), uint32_t(0xFFFFFFFFUL) }; +// std::array expected = { char(0x80), char(0x00), char(0x01), char(0x6A), +// char(0x95), char(0x6A), char(0x55), char(0xAA), +// char(0x7F), char(0xFF), char(0xFF), char(0x00), +// char(0x00), char(0x00), char(0x00), char(0x00) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// CHECK(bit_stream.write(write_data[0], 22)); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[1], 22)); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[2], 22)); +// CHECK_EQUAL(9, bit_stream.used_data().size()); +// CHECK(bit_stream.write(write_data[3], 22)); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// // 12th to 16th to bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_int64_t_47bits) +// { +// std::array storage; +// std::array write_data = { int64_t(0x0000000000000001LL), int64_t(0xA55AA55AA55AA55ALL), int64_t(0x5AA55AA55AA55AA5LL), int64_t(0xFFFFFFFFFFFFFFFFLL) }; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x00), char(0xB5), char(0x4A), +// char(0xB5), char(0x4A), char(0xB5), char(0x4A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0x95), char(0x6F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// bit_stream.write(write_data[0], 47); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(write_data[1], 47); +// CHECK_EQUAL(12, bit_stream.used_data().size()); +// bit_stream.write(write_data[2], 47); +// CHECK_EQUAL(18, bit_stream.used_data().size()); +// bit_stream.write(write_data[3], 47); +// CHECK_EQUAL(24, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// CHECK_EQUAL((int)expected[14], (int)storage[14]); +// CHECK_EQUAL((int)expected[15], (int)storage[15]); +// CHECK_EQUAL((int)expected[16], (int)storage[16]); +// CHECK_EQUAL((int)expected[17], (int)storage[17]); +// CHECK_EQUAL((int)expected[18], (int)storage[18]); +// CHECK_EQUAL((int)expected[19], (int)storage[19]); +// CHECK_EQUAL((int)expected[20], (int)storage[20]); +// CHECK_EQUAL((int)expected[21], (int)storage[21]); +// CHECK_EQUAL((int)expected[22], (int)storage[22]); +// CHECK_EQUAL((int)expected[23], (int)storage[23]); +// // 25th to 32nd bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_uint64_t_47bits) +// { +// std::array storage; +// std::array write_data = { uint64_t(0x0000000000000001LL), uint64_t(0xA55AA55AA55AA55ALL), uint64_t(0x5AA55AA55AA55AA5LL), uint64_t(0xFFFFFFFFFFFFFFFFLL) }; +// std::array expected = { char(0x80), char(0x00), char(0x00), char(0x00), +// char(0x00), char(0x00), char(0xB5), char(0x4A), +// char(0xB5), char(0x4A), char(0xB5), char(0x4A), +// char(0x95), char(0x6A), char(0x95), char(0x6A), +// char(0x95), char(0x6F), char(0xFF), char(0xFF), +// char(0xFF), char(0xFF), char(0xFF), char(0xF0) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream +// bit_stream.write(write_data[0], 47); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(write_data[1], 47); +// CHECK_EQUAL(12, bit_stream.used_data().size()); +// bit_stream.write(write_data[2], 47); +// CHECK_EQUAL(18, bit_stream.used_data().size()); +// bit_stream.write(write_data[3], 47); +// CHECK_EQUAL(24, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// CHECK_EQUAL((int)expected[14], (int)storage[14]); +// CHECK_EQUAL((int)expected[15], (int)storage[15]); +// CHECK_EQUAL((int)expected[16], (int)storage[16]); +// CHECK_EQUAL((int)expected[17], (int)storage[17]); +// CHECK_EQUAL((int)expected[18], (int)storage[18]); +// CHECK_EQUAL((int)expected[19], (int)storage[19]); +// CHECK_EQUAL((int)expected[20], (int)storage[20]); +// CHECK_EQUAL((int)expected[21], (int)storage[21]); +// CHECK_EQUAL((int)expected[22], (int)storage[22]); +// CHECK_EQUAL((int)expected[23], (int)storage[23]); +// // 25th to 32nd bytes not used. +// } +// +// //************************************************************************* +// TEST(test_write_multiple_full_size) +// { +// char c1 = 90; // 0x5A +// char c2 = -91; // 0xA5 +// unsigned short s1 = 4660; // 0x1234 +// unsigned short s2 = 22136; // 0x5678 +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 +// +// std::array storage; +// std::array expected = { char(0x5A), +// char(0x2C), char(0x48), +// char(0xF7), char(0xB3), char(0xD5), char(0x91), +// char(0x19), char(0x5D), char(0x3B), char(0x7F), +// char(0x1E), char(0x6A), +// char(0xA5) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream. +// bit_stream.write(c1); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// bit_stream.write(s1); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// bit_stream.write(i1); +// CHECK_EQUAL(7, bit_stream.used_data().size()); +// bit_stream.write(i2); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// bit_stream.write(s2); +// CHECK_EQUAL(13, bit_stream.used_data().size()); +// bit_stream.write(c2); +// CHECK_EQUAL(14, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// CHECK_EQUAL((int)expected[12], (int)storage[12]); +// CHECK_EQUAL((int)expected[13], (int)storage[13]); +// } +// +// //************************************************************************* +// TEST(test_write_multiple_variable_size) +// { +// char c1 = 90; // 0x5A 6 bits +// char c2 = -91; // 0xA5 7 bits +// unsigned short s1 = 4660; // 0x1234 13 bits +// unsigned short s2 = 22136; // 0x5678 11 bits +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// +// std::array storage; +// std::array expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6), +// char(0x7A), char(0x86), char(0x57), char(0x4E), +// char(0xC3), char(0xCE), char(0x90) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// // Insert into the stream. +// bit_stream.write(c1, 6); +// CHECK_EQUAL(1, bit_stream.used_data().size()); +// bit_stream.write(s1, 13); +// CHECK_EQUAL(3, bit_stream.used_data().size()); +// bit_stream.write(i1, 23); +// CHECK_EQUAL(6, bit_stream.used_data().size()); +// bit_stream.write(i2, 25); +// CHECK_EQUAL(9, bit_stream.used_data().size()); +// bit_stream.write(s2, 11); +// CHECK_EQUAL(10, bit_stream.used_data().size()); +// bit_stream.write(c2, 7); +// CHECK_EQUAL(11, bit_stream.used_data().size()); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// } +// +// //************************************************************************* +// TEST(test_write_multiple_variable_size_with_callback) +// { +// char c1 = 90; // 0x5A 6 bits +// char c2 = -91; // 0xA5 7 bits +// unsigned short s1 = 4660; // 0x1234 13 bits +// unsigned short s2 = 22136; // 0x5678 11 bits +// int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits +// int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits +// +// std::array storage; +// std::array expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6), +// char(0x7A), char(0x86), char(0x57), char(0x4E), +// char(0xC3), char(0xCE), char(0x90) }; +// +// Accumulator accumulator; +// +// auto callback = etl::bit_stream_writer::callback_type::create(accumulator); +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little, callback); +// +// // Insert into the stream. +// bit_stream.write(c1, 6); +// bit_stream.write(s1, 13); +// bit_stream.write(i1, 23); +// bit_stream.write(i2, 25); +// bit_stream.write(s2, 11); +// bit_stream.write(c2, 7); +// bit_stream.flush(); +// +// CHECK_EQUAL(bit_stream.capacity_bytes(), bit_stream.available()); +// +// CHECK_EQUAL(11U, accumulator.GetData().size()); +// +// CHECK_EQUAL((int)expected[0], (int)accumulator.GetData()[0]); +// CHECK_EQUAL((int)expected[1], (int)accumulator.GetData()[1]); +// CHECK_EQUAL((int)expected[2], (int)accumulator.GetData()[2]); +// CHECK_EQUAL((int)expected[3], (int)accumulator.GetData()[3]); +// CHECK_EQUAL((int)expected[4], (int)accumulator.GetData()[4]); +// CHECK_EQUAL((int)expected[5], (int)accumulator.GetData()[5]); +// CHECK_EQUAL((int)expected[6], (int)accumulator.GetData()[6]); +// CHECK_EQUAL((int)expected[7], (int)accumulator.GetData()[7]); +// CHECK_EQUAL((int)expected[8], (int)accumulator.GetData()[8]); +// CHECK_EQUAL((int)expected[9], (int)accumulator.GetData()[9]); +// CHECK_EQUAL((int)expected[10], (int)accumulator.GetData()[10]); +// } +// +// //************************************************************************* +// TEST(test_write_object) +// { +// std::array storage; +// storage.fill(0); +// std::array expected{ char(0x74), char(0xDE), char(0xA2), char(0xCF), +// char(0x6A), char(0xFB), char(0xA3), char(0x5E), +// char(0x5D), char(0x30), char(0x9F), char(0x80) }; +// +// etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::endian::little); +// +// Object object1 = { -1234, 123456789, 250 }; +// Object object2 = { 5678, -987654321, 126 }; +// +// CHECK(etl::write(bit_stream, object1)); +// CHECK(etl::write(bit_stream, object2)); +// +// CHECK_EQUAL((int)expected[0], (int)storage[0]); +// CHECK_EQUAL((int)expected[1], (int)storage[1]); +// CHECK_EQUAL((int)expected[2], (int)storage[2]); +// CHECK_EQUAL((int)expected[3], (int)storage[3]); +// CHECK_EQUAL((int)expected[4], (int)storage[4]); +// CHECK_EQUAL((int)expected[5], (int)storage[5]); +// CHECK_EQUAL((int)expected[6], (int)storage[6]); +// CHECK_EQUAL((int)expected[7], (int)storage[7]); +// CHECK_EQUAL((int)expected[8], (int)storage[8]); +// CHECK_EQUAL((int)expected[9], (int)storage[9]); +// CHECK_EQUAL((int)expected[10], (int)storage[10]); +// CHECK_EQUAL((int)expected[11], (int)storage[11]); +// } +// }; +//} diff --git a/test/test_largest.cpp b/test/test_largest.cpp index 30411d5e..df6aef02 100644 --- a/test/test_largest.cpp +++ b/test/test_largest.cpp @@ -55,7 +55,7 @@ namespace CHECK(type); } -#if !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) +#if ETL_USING_CPP17 && !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_pod_type_vt) { @@ -99,7 +99,7 @@ namespace CHECK(type); } -#if !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) +#if ETL_USING_CPP17 && !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_non_pod_type_vt) { @@ -132,6 +132,7 @@ namespace CHECK_EQUAL(std::alignment_of::value, size); } +#if ETL_USING_CPP17 && !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_pod_alignment_v) { @@ -139,6 +140,7 @@ namespace CHECK_EQUAL(std::alignment_of::value, size); } +#endif //************************************************************************* TEST(test_non_pod_alignment) @@ -152,6 +154,7 @@ namespace CHECK_EQUAL(std::alignment_of::value, size); } +#if ETL_USING_CPP17 && !defined(ETL_LARGEST_TYPE_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_non_pod_alignment_v) { @@ -163,6 +166,7 @@ namespace CHECK_EQUAL(std::alignment_of::value, size); } +#endif //************************************************************************* TEST(test_larger_int_type) diff --git a/test/test_make_string.cpp b/test/test_make_string.cpp index 2d0e6476..69468593 100644 --- a/test/test_make_string.cpp +++ b/test/test_make_string.cpp @@ -108,7 +108,7 @@ namespace CHECK_EQUAL(CAPACITY, ctext.max_size()); CHECK_EQUAL(length, ctext.size()); - if constexpr (etl::traits::has_string_truncation_checks) + if (etl::traits::has_string_truncation_checks) { CHECK(!ctext.is_truncated()); } diff --git a/test/test_mem_cast_ptr.cpp b/test/test_mem_cast_ptr.cpp index 0b9225fc..498cfe7e 100644 --- a/test/test_mem_cast_ptr.cpp +++ b/test/test_mem_cast_ptr.cpp @@ -195,7 +195,7 @@ namespace memCast.assign(data); CHECK(123 == memCast.ref().c); CHECK(1.23 == memCast.ref().d); - CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); +// CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); } //************************************************************************* @@ -246,7 +246,7 @@ namespace memCast.emplace(123, 1.23, std::array{ 1, 2, 3 }); CHECK(123 == memCast.ref().c); CHECK(1.23 == memCast.ref().d); - CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); +// CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); } //************************************************************************* @@ -298,7 +298,7 @@ namespace *reinterpret_cast(pbuffer) = { 123, 1.23, { 1, 2, 3 } }; CHECK(123 == memCast.ref().c); CHECK(1.23 == memCast.ref().d); - CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); +// CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); } //************************************************************************* @@ -317,7 +317,7 @@ namespace *reinterpret_cast(pbuffer) = { 123, 1.23, { 1, 2, 3 } }; CHECK(123 == memCast.ref().c); CHECK(1.23 == memCast.ref().d); - CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); +// CHECK((std::array { 1, 2, 3 }) == memCast.ref().a); } //************************************************************************* diff --git a/test/test_memory.cpp b/test/test_memory.cpp index 9854f172..ff5caafa 100644 --- a/test/test_memory.cpp +++ b/test/test_memory.cpp @@ -1118,10 +1118,10 @@ namespace //************************************************************************* TEST(test_uninitialized_buffer) { - typedef etl::uninitialized_buffer> storage32_t; + typedef etl::uninitialized_buffer::value> storage32_t; - size_t alignment = etl::alignment_of_v; - size_t expected = std::alignment_of_v; + size_t alignment = etl::alignment_of::value; + size_t expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); } @@ -1154,8 +1154,8 @@ namespace CHECK_EQUAL(2U, refbuffer[2]); CHECK_EQUAL(3U, refbuffer[3]); - size_t alignment = etl::alignment_of_v; - size_t expected = std::alignment_of_v; + size_t alignment = etl::alignment_of::value; + size_t expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); } diff --git a/test/test_overload.cpp b/test/test_overload.cpp index afa6e3d7..aebdbc42 100644 --- a/test/test_overload.cpp +++ b/test/test_overload.cpp @@ -72,6 +72,7 @@ namespace SUITE(test_overload) { +#if ETL_USING_CPP17 //************************************************************************* TEST(test_overload_lambdas) { @@ -97,11 +98,12 @@ namespace CHECK(result.bd == false); CHECK(result.bs == true); } +#endif //************************************************************************* TEST(test_overload_lambdas_cpp17) { -#if !defined(ETL_OVERLOAD_FORCE_CPP14) +#if ETL_USING_CPP17 && !defined(ETL_OVERLOAD_FORCE_CPP14) result.clear(); Function(int(1), etl::overload { @@ -137,6 +139,7 @@ namespace #endif } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_visitor_overload) { @@ -160,5 +163,6 @@ namespace CHECK(result.bd == false); CHECK(result.bs == true); } +#endif }; } diff --git a/test/test_parameter_pack.cpp b/test/test_parameter_pack.cpp index 46e0b2f9..fce7c1e3 100644 --- a/test/test_parameter_pack.cpp +++ b/test/test_parameter_pack.cpp @@ -39,6 +39,7 @@ namespace //************************************************************************* TEST(test_index_of_type) { +#if ETL_USING_CPP17 CHECK_EQUAL(0U, Pack::index_of_type_v); CHECK_EQUAL(1U, Pack::index_of_type_v); CHECK_EQUAL(2U, Pack::index_of_type_v); @@ -52,6 +53,21 @@ namespace // Static assert //CHECK_EQUAL(0U, (etl::parameter_pack_v)); +#else + CHECK_EQUAL(0U, Pack::index_of_type::value); + CHECK_EQUAL(1U, Pack::index_of_type::value); + CHECK_EQUAL(2U, Pack::index_of_type::value); + + // Static assert + //CHECK_EQUAL(0U, Pack::index_of_type_v); + + CHECK_EQUAL(0U, (etl::parameter_pack::index_of_type::value)); + CHECK_EQUAL(1U, (etl::parameter_pack::index_of_type::value)); + CHECK_EQUAL(2U, (etl::parameter_pack::index_of_type::value)); + + // Static assert + //CHECK_EQUAL(0U, (etl::parameter_pack_v)); +#endif } //************************************************************************* diff --git a/test/test_type_lookup.cpp b/test/test_type_lookup.cpp index 012738b8..7621ab5c 100644 --- a/test/test_type_lookup.cpp +++ b/test/test_type_lookup.cpp @@ -253,7 +253,7 @@ namespace CHECK_EQUAL((unsigned int)Type16::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type(Type16())); } -#if !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) +#if ETL_USING_CPP17 && !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_id_from_type_v_16) { @@ -306,7 +306,7 @@ namespace CHECK_EQUAL((unsigned int)Type16::ID, (unsigned int)Type_Id_Lookup8::get_id_from_type(Type16())); } -#if !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) +#if ETL_USING_CPP17 && !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_id_from_type_v_8) { @@ -330,7 +330,7 @@ namespace CHECK_EQUAL((unsigned int)Type16::ID, (unsigned int)Type_Id_Lookup1::get_id_from_type(Type16())); } -#if !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) +#if ETL_USING_CPP17 && !defined(ETL_TYPE_SELECT_FORCE_CPP03_IMPLEMENTATION) //************************************************************************* TEST(test_id_from_type_v_1) { diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 363d59d9..333a5a35 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -901,22 +901,37 @@ namespace //************************************************************************* TEST(test_size_of) { - CHECK_EQUAL(1, etl::size_of::value); - CHECK_EQUAL(1, etl::size_of::value); - CHECK_EQUAL(2, etl::size_of::value); - CHECK_EQUAL(4, etl::size_of::value); - CHECK_EQUAL(20, etl::size_of::value); - +#if ETL_USING_CPP17 CHECK_EQUAL(1, etl::size_of_v); CHECK_EQUAL(1, etl::size_of_v); CHECK_EQUAL(2, etl::size_of_v); CHECK_EQUAL(4, etl::size_of_v); CHECK_EQUAL(20, etl::size_of_v); +#else + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(2, etl::size_of::value); + CHECK_EQUAL(4, etl::size_of::value); + CHECK_EQUAL(20, etl::size_of::value); +#endif } //************************************************************************* TEST(test_is_convertible) { +#if ETL_USING_CPP17 + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK((etl::is_convertible_v)); + CHECK(!(etl::is_convertible_v)); + CHECK(!(etl::is_convertible_v)); + CHECK(!(etl::is_convertible_v)); + CHECK(!(etl::is_convertible_v)); +#else CHECK((etl::is_convertible::value)); CHECK((etl::is_convertible::value)); CHECK((etl::is_convertible::value)); @@ -928,52 +943,75 @@ namespace CHECK(!(etl::is_convertible::value)); CHECK(!(etl::is_convertible::value)); CHECK(!(etl::is_convertible::value)); +#endif } //************************************************************************* TEST(test_add_lvalue_reference) { +#if ETL_USING_CPP17 CHECK(!std::is_lvalue_reference_v::type>); CHECK(std::is_lvalue_reference_v::type>); CHECK(std::is_lvalue_reference_v::type>); CHECK(std::is_lvalue_reference_v::type>); CHECK(std::is_lvalue_reference_v::type>); +#else +#endif } //************************************************************************* TEST(test_add_rvalue_reference) { +#if ETL_USING_CPP17 CHECK(!std::is_rvalue_reference_v::type>); CHECK(std::is_rvalue_reference_v::type>); CHECK(std::is_rvalue_reference_v::type>); CHECK(!std::is_rvalue_reference_v::type>); CHECK(std::is_rvalue_reference_v::type>); +#else +#endif } //************************************************************************* TEST(test_is_lvalue_reference) { +#if ETL_USING_CPP17 CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); +#else +#endif } //************************************************************************* TEST(test_is_rvalue_reference) { +#if ETL_USING_CPP17 CHECK_EQUAL(std::is_rvalue_reference_v, etl::is_rvalue_reference_v); CHECK_EQUAL(std::is_rvalue_reference_v, etl::is_rvalue_reference_v); CHECK_EQUAL(std::is_rvalue_reference_v, etl::is_rvalue_reference_v); CHECK_EQUAL(std::is_rvalue_reference_v, etl::is_rvalue_reference_v); CHECK_EQUAL(std::is_rvalue_reference_v, etl::is_rvalue_reference_v); +#else + CHECK_EQUAL(std::is_rvalue_reference::value, etl::is_rvalue_reference::value); + CHECK_EQUAL(std::is_rvalue_reference::value, etl::is_rvalue_reference::value); + CHECK_EQUAL(std::is_rvalue_reference::value, etl::is_rvalue_reference::value); + CHECK_EQUAL(std::is_rvalue_reference::value, etl::is_rvalue_reference::value); + CHECK_EQUAL(std::is_rvalue_reference::value, etl::is_rvalue_reference::value); +#endif } //************************************************************************* +#if ETL_USING_CPP17 #define CHECK_EQUAL_FOR_TYPE(type) CHECK_EQUAL(std::is_enum_v, etl::is_enum_v) +#else + #define CHECK_EQUAL_FOR_TYPE(type) CHECK_EQUAL(std::is_enum::value, etl::is_enum::value) +#endif - TEST(test_is_enum) { + TEST(test_is_enum) + { CHECK_EQUAL_FOR_TYPE(void); CHECK_EQUAL_FOR_TYPE(void*); CHECK_EQUAL_FOR_TYPE(int); @@ -1001,88 +1039,152 @@ namespace //************************************************************************* TEST(test_integral_constants) { +#if ETL_USING_CPP17 + CHECK_EQUAL(1, (etl::integral_constant_v)); + CHECK((std::is_same>)); + + CHECK_EQUAL(false, (etl::bool_constant_v)); + CHECK_EQUAL(true, (etl::bool_constant_v)); + CHECK((std::is_same::value_type>)); + + CHECK_EQUAL(true, etl::negation_v>); + CHECK_EQUAL(false, etl::negation_v>); + CHECK((std::is_same::value_type>)); +#else CHECK_EQUAL(1, (etl::integral_constant::value)); - CHECK((std::is_same_v::value_type>)); + CHECK((std::is_same::value_type>::value)); CHECK_EQUAL(false, (etl::bool_constant::value)); - CHECK_EQUAL(true, (etl::bool_constant::value)); - CHECK((std::is_same_v::value_type>)); + CHECK_EQUAL(true, (etl::bool_constant::value)); + CHECK((std::is_same::value_type>::value)); - CHECK_EQUAL(true, etl::negation_v>); - CHECK_EQUAL(false, etl::negation_v>); - CHECK((std::is_same_v::value_type>)); + CHECK_EQUAL(true, etl::negation>::value); + CHECK_EQUAL(false, etl::negation>::value); + CHECK((std::is_same::value_type>::value)); +#endif } //************************************************************************* TEST(test_are_all_same) { - CHECK((etl::are_all_same::value == true)); +#if ETL_USING_CPP17 + CHECK((etl::are_all_same_v == true)); + CHECK((etl::are_all_same_v == false)); +#else + CHECK((etl::are_all_same::value == true)); CHECK((etl::are_all_same::value == false)); +#endif } //************************************************************************* TEST(test_conjunction) { +#if ETL_USING_CPP17 CHECK((etl::conjunction_v)); CHECK((!etl::conjunction_v)); +#else + CHECK((etl::conjunction::value)); + CHECK((!etl::conjunction::value)); +#endif } //************************************************************************* TEST(test_disjunction) { +#if ETL_USING_CPP17 CHECK((etl::disjunction_v)); CHECK((!etl::disjunction_v)); +#else + CHECK((etl::disjunction::value)); + CHECK((!etl::disjunction::value)); +#endif } //************************************************************************* TEST(test_is_assignable) { +#if ETL_USING_CPP17 CHECK((etl::is_assignable_v) == (std::is_assignable_v)); CHECK((etl::is_assignable_v) == (std::is_assignable_v)); CHECK((etl::is_assignable_v) == (std::is_assignable_v)); +#else + CHECK((etl::is_assignable::value) == (std::is_assignable::value)); + CHECK((etl::is_assignable::value) == (std::is_assignable::value)); + CHECK((etl::is_assignable::value) == (std::is_assignable::value)); +#endif } //************************************************************************* TEST(test_is_lvalue_assignable) { #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_lvalue_assignable_v)); CHECK(!(etl::is_lvalue_assignable_v)); CHECK((etl::is_lvalue_assignable_v)); +#else + CHECK((etl::is_lvalue_assignable::value)); + CHECK(!(etl::is_lvalue_assignable::value)); + CHECK((etl::is_lvalue_assignable::value)); +#endif #endif } //************************************************************************* TEST(test_is_constructible) { +#if ETL_USING_CPP17 CHECK((etl::is_constructible_v) == (std::is_constructible_v)); CHECK((etl::is_constructible_v) == (std::is_constructible_v)); CHECK((etl::is_constructible_v) == (std::is_constructible_v)); +#else + CHECK((etl::is_constructible::value) == (std::is_constructible::value)); + CHECK((etl::is_constructible::value) == (std::is_constructible::value)); + CHECK((etl::is_constructible::value) == (std::is_constructible::value)); +#endif } //************************************************************************* TEST(test_is_copy_constructible) { +#if ETL_USING_CPP17 CHECK((etl::is_copy_constructible_v) == (std::is_copy_constructible_v)); CHECK((etl::is_copy_constructible_v) == (std::is_copy_constructible_v)); CHECK((etl::is_copy_constructible_v) == (std::is_copy_constructible_v)); +#else + CHECK((etl::is_copy_constructible::value) == (std::is_copy_constructible::value)); + CHECK((etl::is_copy_constructible::value) == (std::is_copy_constructible::value)); + CHECK((etl::is_copy_constructible::value) == (std::is_copy_constructible::value)); +#endif } //************************************************************************* TEST(test_is_move_constructible) { +#if ETL_USING_CPP17 CHECK((etl::is_move_constructible_v) == (std::is_move_constructible_v)); CHECK((etl::is_move_constructible_v) == (std::is_move_constructible_v)); CHECK((etl::is_move_constructible_v) == (std::is_move_constructible_v)); +#else + CHECK((etl::is_move_constructible::value) == (std::is_move_constructible::value)); + CHECK((etl::is_move_constructible::value) == (std::is_move_constructible::value)); + CHECK((etl::is_move_constructible::value) == (std::is_move_constructible::value)); +#endif } //************************************************************************* TEST(test_is_trivially_constructible) { #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_trivially_constructible_v) == (std::is_trivially_constructible_v)); CHECK((etl::is_trivially_constructible_v) == (std::is_trivially_constructible_v)); CHECK((etl::is_trivially_constructible_v) == (std::is_trivially_constructible_v)); +#else + CHECK((etl::is_trivially_constructible::value) == (std::is_trivially_constructible::value)); + CHECK((etl::is_trivially_constructible::value) == (std::is_trivially_constructible::value)); + CHECK((etl::is_trivially_constructible::value) == (std::is_trivially_constructible::value)); +#endif #endif } @@ -1090,9 +1192,15 @@ namespace TEST(test_is_trivially_copy_constructible) { #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_trivially_copy_constructible_v) == (std::is_trivially_copy_constructible_v)); CHECK((etl::is_trivially_copy_constructible_v) == (std::is_trivially_copy_constructible_v)); CHECK((etl::is_trivially_copy_constructible_v) == (std::is_trivially_copy_constructible_v)); +#else + CHECK((etl::is_trivially_copy_constructible::value) == (std::is_trivially_copy_constructible::value)); + CHECK((etl::is_trivially_copy_constructible::value) == (std::is_trivially_copy_constructible::value)); + CHECK((etl::is_trivially_copy_constructible::value) == (std::is_trivially_copy_constructible::value)); +#endif #endif } @@ -1100,9 +1208,15 @@ namespace TEST(test_is_trivially_destructible) { #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_trivially_destructible_v) == (std::is_trivially_destructible_v)); CHECK((etl::is_trivially_destructible_v) == (std::is_trivially_destructible_v)); CHECK((etl::is_trivially_destructible_v) == (std::is_trivially_destructible_v)); +#else + CHECK((etl::is_trivially_destructible::value) == (std::is_trivially_destructible::value)); + CHECK((etl::is_trivially_destructible::value) == (std::is_trivially_destructible::value)); + CHECK((etl::is_trivially_destructible::value) == (std::is_trivially_destructible::value)); +#endif #endif } @@ -1111,9 +1225,15 @@ namespace { #if (!(defined(ETL_COMPILER_GCC) && defined(ETL_USE_TYPE_TRAITS_BUILTINS))) #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_trivially_copy_assignable_v) == (std::is_trivially_copy_assignable_v)); CHECK((etl::is_trivially_copy_assignable_v) == (std::is_trivially_copy_assignable_v)); CHECK((etl::is_trivially_copy_assignable_v) == (std::is_trivially_copy_assignable_v)); +#else + CHECK((etl::is_trivially_copy_assignable::value) == (std::is_trivially_copy_assignable::value)); + CHECK((etl::is_trivially_copy_assignable::value) == (std::is_trivially_copy_assignable::value)); + CHECK((etl::is_trivially_copy_assignable::value) == (std::is_trivially_copy_assignable::value)); +#endif #endif #endif } @@ -1123,9 +1243,15 @@ namespace { #if (!(defined(ETL_COMPILER_GCC) && defined(ETL_USE_TYPE_TRAITS_BUILTINS))) #if ETL_USING_STL || defined(ETL_USE_TYPE_TRAITS_BUILTINS) || defined(ETL_USER_DEFINED_TYPE_TRAITS) +#if ETL_USING_CPP17 CHECK((etl::is_trivially_copyable_v) == (std::is_trivially_copyable_v)); CHECK((etl::is_trivially_copyable_v) == (std::is_trivially_copyable_v)); CHECK((etl::is_trivially_copyable_v) == (std::is_trivially_copyable_v)); +#else + CHECK((etl::is_trivially_copyable::value) == (std::is_trivially_copyable::value)); + CHECK((etl::is_trivially_copyable::value) == (std::is_trivially_copyable::value)); + CHECK((etl::is_trivially_copyable::value) == (std::is_trivially_copyable::value)); +#endif #endif #endif } diff --git a/test/test_variant_variadic.cpp b/test/test_variant_variadic.cpp index 456c7737..baee1aa6 100644 --- a/test/test_variant_variadic.cpp +++ b/test/test_variant_variadic.cpp @@ -39,6 +39,8 @@ SOFTWARE. #include #include +#if ETL_USING_CPP17 + namespace { // Test variant_etl types. @@ -1453,3 +1455,5 @@ namespace } }; } + +#endif diff --git a/test/vs2019/etl.sln b/test/vs2019/etl.sln index bc09716a..ca60f523 100644 --- a/test/vs2019/etl.sln +++ b/test/vs2019/etl.sln @@ -33,6 +33,10 @@ Global Debug MSVC - String Truncation Is Error|x64 = Debug MSVC - String Truncation Is Error|x64 Debug MSVC 64|Win32 = Debug MSVC 64|Win32 Debug MSVC 64|x64 = Debug MSVC 64|x64 + Debug MSVC C++14 - No STL|Win32 = Debug MSVC C++14 - No STL|Win32 + Debug MSVC C++14 - No STL|x64 = Debug MSVC C++14 - No STL|x64 + Debug MSVC C++14|Win32 = Debug MSVC C++14|Win32 + Debug MSVC C++14|x64 = Debug MSVC C++14|x64 Debug MSVC C++20 - No STL|Win32 = Debug MSVC C++20 - No STL|Win32 Debug MSVC C++20 - No STL|x64 = Debug MSVC C++20 - No STL|x64 Debug MSVC C++20|Win32 = Debug MSVC C++20|Win32 @@ -101,6 +105,14 @@ Global {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.Build.0 = Debug|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.ActiveCfg = Debug64|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.Build.0 = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|Win32.ActiveCfg = Debug MSVC C++14 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|Win32.Build.0 = Debug MSVC C++14 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|x64.ActiveCfg = Debug MSVC C++14 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|x64.Build.0 = Debug MSVC C++14 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|Win32.ActiveCfg = Debug MSVC C++14|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|Win32.Build.0 = Debug MSVC C++14|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|x64.ActiveCfg = Debug MSVC C++14|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|x64.Build.0 = Debug MSVC C++14|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.ActiveCfg = Debug MSVC C++20 - No STL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.Build.0 = Debug MSVC C++20 - No STL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.ActiveCfg = Debug MSVC C++20 - No STL|x64 diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index c855b06b..61139fef 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -113,6 +113,22 @@ Debug MSVC - No Checks x64 + + Debug MSVC C++14 - No STL + Win32 + + + Debug MSVC C++14 - No STL + x64 + + + Debug MSVC C++14 + Win32 + + + Debug MSVC C++14 + x64 + Debug MSVC C++20 - No STL Win32 @@ -253,6 +269,13 @@ Unicode true + + Application + true + v142 + Unicode + true + Application true @@ -260,6 +283,13 @@ Unicode false + + Application + true + v142 + Unicode + false + Application true @@ -421,12 +451,24 @@ v142 Unicode + + Application + true + v142 + Unicode + Application true v142 Unicode + + Application + true + v142 + Unicode + Application true @@ -609,9 +651,15 @@ + + + + + + @@ -687,9 +735,15 @@ + + + + + + @@ -794,11 +848,21 @@ true $(Configuration)\ + + false + true + $(Configuration)\ + false true $(Configuration)\ + + false + true + $(Configuration)\ + false true @@ -925,10 +989,18 @@ true true + + true + true + true true + + true + true + true true @@ -1159,6 +1231,30 @@ "$(OutDir)\etl.exe" + + + + + Level2 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp14 + EditAndContinue + /Zc:__cplusplus %(AdditionalOptions) + true + + + Console + true + + + "$(OutDir)\etl.exe" + + @@ -1183,6 +1279,30 @@ "$(OutDir)\etl.exe" + + + + + Level2 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp14 + EditAndContinue + /Zc:__cplusplus %(AdditionalOptions) + true + + + Console + true + + + "$(OutDir)\etl.exe" + + @@ -1789,6 +1909,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -1810,6 +1951,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -2696,9 +2858,11 @@ true true true + true true true true + true true true true @@ -2724,9 +2888,11 @@ true true true + true true true true + true true true true @@ -2752,9 +2918,11 @@ true true true + true true true true + true true true true @@ -2780,9 +2948,11 @@ true true true + true true true true + true true true true @@ -2853,9 +3023,11 @@ true true true + true true true true + true true true true @@ -2881,9 +3053,11 @@ true true true + true true true true + true true true true @@ -2909,9 +3083,11 @@ true true true + true true true true + true true true true @@ -2937,9 +3113,11 @@ true true true + true true true true + true true true true @@ -2968,9 +3146,11 @@ true true true + true true true true + true true true true @@ -3012,7 +3192,9 @@ true true true + true true + true true true true @@ -3045,7 +3227,9 @@ true true true + true true + true true true true @@ -3078,7 +3262,9 @@ true true true + true true + true true true true @@ -3111,7 +3297,9 @@ true true true + true true + true true true true @@ -3144,7 +3332,9 @@ true true true + true true + true true true true @@ -3177,7 +3367,9 @@ true true true + true true + true true true true @@ -3210,7 +3402,9 @@ true true true + true true + true true true true @@ -3243,7 +3437,9 @@ true true true + true true + true true true true @@ -3276,7 +3472,9 @@ true true true + true true + true true true true @@ -3309,7 +3507,9 @@ true true true + true true + true true true true @@ -3328,7 +3528,9 @@ true true true + true true + true true true true @@ -3361,8 +3563,10 @@ true true true + true true true + true true true true @@ -3403,7 +3607,9 @@ true true true + true true + true true true true @@ -3421,8 +3627,10 @@ true true true + true true true + true true true true @@ -3464,7 +3672,9 @@ true true true + true true + true true true true @@ -3497,7 +3707,9 @@ true true true + true true + true true true true @@ -3530,7 +3742,9 @@ true true true + true true + true true true true @@ -3563,7 +3777,9 @@ true true true + true true + true true true true @@ -3580,9 +3796,11 @@ true true true + true true true true + true true true true @@ -3611,7 +3829,9 @@ true true true + true true + true true true true @@ -3654,7 +3874,9 @@ true true true + true true + true true true true @@ -3687,7 +3909,9 @@ true true true + true true + true true true true @@ -3720,7 +3944,9 @@ true true true + true true + true true true true @@ -3739,7 +3965,9 @@ true true true + true true + true true true true @@ -3766,9 +3994,11 @@ true true true + true true true true + true true true true @@ -3795,9 +4025,11 @@ true true true + true true true true + true true true true @@ -3840,7 +4072,9 @@ true true true + true true + true true true true @@ -3873,7 +4107,9 @@ true true true + true true + true true true true @@ -3906,7 +4142,9 @@ true true true + true true + true true true true @@ -3923,9 +4161,11 @@ true true true + true true true true + true true true true @@ -3967,7 +4207,9 @@ true true true + true true + true true true true @@ -4000,7 +4242,9 @@ true true true + true true + true true true true @@ -4033,7 +4277,9 @@ true true true + true true + true true true true @@ -4066,7 +4312,9 @@ true true true + true true + true true true true @@ -4099,7 +4347,9 @@ true true true + true true + true true true true @@ -4132,7 +4382,9 @@ true true true + true true + true true true true @@ -4165,7 +4417,9 @@ true true true + true true + true true true true @@ -4198,7 +4452,9 @@ true true true + true true + true true true true @@ -4231,7 +4487,9 @@ true true true + true true + true true true true @@ -4264,7 +4522,9 @@ true true true + true true + true true true true @@ -4297,7 +4557,9 @@ true true true + true true + true true true true @@ -4330,7 +4592,9 @@ true true true + true true + true true true true @@ -4363,7 +4627,9 @@ true true true + true true + true true true true @@ -4396,7 +4662,9 @@ true true true + true true + true true true true @@ -4429,7 +4697,9 @@ true true true + true true + true true true true @@ -4462,7 +4732,9 @@ true true true + true true + true true true true @@ -4495,7 +4767,9 @@ true true true + true true + true true true true @@ -4528,7 +4802,9 @@ true true true + true true + true true true true @@ -4561,7 +4837,9 @@ true true true + true true + true true true true @@ -4594,7 +4872,9 @@ true true true + true true + true true true true @@ -4627,7 +4907,9 @@ true true true + true true + true true true true @@ -4660,7 +4942,9 @@ true true true + true true + true true true true @@ -4693,7 +4977,9 @@ true true true + true true + true true true true @@ -4726,7 +5012,9 @@ true true true + true true + true true true true @@ -4759,7 +5047,9 @@ true true true + true true + true true true true @@ -4792,7 +5082,9 @@ true true true + true true + true true true true @@ -4825,7 +5117,9 @@ true true true + true true + true true true true @@ -4858,7 +5152,9 @@ true true true + true true + true true true true @@ -4891,7 +5187,9 @@ true true true + true true + true true true true @@ -4924,7 +5222,9 @@ true true true + true true + true true true true @@ -4957,7 +5257,9 @@ true true true + true true + true true true true @@ -4990,7 +5292,9 @@ true true true + true true + true true true true @@ -5023,7 +5327,9 @@ true true true + true true + true true true true @@ -5056,7 +5362,9 @@ true true true + true true + true true true true @@ -5089,7 +5397,9 @@ true true true + true true + true true true true @@ -5122,7 +5432,9 @@ true true true + true true + true true true true @@ -5155,7 +5467,9 @@ true true true + true true + true true true true @@ -5188,7 +5502,9 @@ true true true + true true + true true true true @@ -5221,7 +5537,9 @@ true true true + true true + true true true true @@ -5254,7 +5572,9 @@ true true true + true true + true true true true @@ -5287,7 +5607,9 @@ true true true + true true + true true true true @@ -5320,7 +5642,9 @@ true true true + true true + true true true true @@ -5353,7 +5677,9 @@ true true true + true true + true true true true @@ -5386,7 +5712,9 @@ true true true + true true + true true true true @@ -5419,7 +5747,9 @@ true true true + true true + true true true true @@ -5452,7 +5782,9 @@ true true true + true true + true true true true @@ -5485,7 +5817,9 @@ true true true + true true + true true true true @@ -5518,7 +5852,9 @@ true true true + true true + true true true true @@ -5551,7 +5887,9 @@ true true true + true true + true true true true @@ -5584,7 +5922,9 @@ true true true + true true + true true true true @@ -5617,7 +5957,9 @@ true true true + true true + true true true true @@ -5634,9 +5976,11 @@ true true true + true true true true + true true true true @@ -5662,9 +6006,11 @@ true true true + true true true true + true true true true @@ -5706,7 +6052,9 @@ true true true + true true + true true true true @@ -5739,7 +6087,9 @@ true true true + true true + true true true true @@ -5772,7 +6122,9 @@ true true true + true true + true true true true @@ -5805,7 +6157,9 @@ true true true + true true + true true true true @@ -5838,7 +6192,9 @@ true true true + true true + true true true true @@ -5855,9 +6211,11 @@ true true true + true true true true + true true true true @@ -5881,9 +6239,11 @@ true true true + true true true true + true true true true @@ -5925,7 +6285,9 @@ true true true + true true + true true true true @@ -5958,7 +6320,9 @@ true true true + true true + true true true true @@ -5991,7 +6355,9 @@ true true true + true true + true true true true @@ -6024,7 +6390,9 @@ true true true + true true + true true true true @@ -6057,7 +6425,9 @@ true true true + true true + true true true true @@ -6090,7 +6460,9 @@ true true true + true true + true true true true @@ -6123,7 +6495,9 @@ true true true + true true + true true true true @@ -6156,7 +6530,9 @@ true true true + true true + true true true true @@ -6189,7 +6565,9 @@ true true true + true true + true true true true @@ -6222,7 +6600,9 @@ true true true + true true + true true true true @@ -6255,7 +6635,9 @@ true true true + true true + true true true true @@ -6288,7 +6670,9 @@ true true true + true true + true true true true @@ -6321,7 +6705,9 @@ true true true + true true + true true true true @@ -6354,7 +6740,9 @@ true true true + true true + true true true true @@ -6387,7 +6775,9 @@ true true true + true true + true true true true @@ -6420,7 +6810,9 @@ true true true + true true + true true true true @@ -6453,7 +6845,9 @@ true true true + true true + true true true true @@ -6486,7 +6880,9 @@ true true true + true true + true true true true @@ -6519,7 +6915,9 @@ true true true + true true + true true true true @@ -6552,7 +6950,9 @@ true true true + true true + true true true true @@ -6585,7 +6985,9 @@ true true true + true true + true true true true @@ -6618,7 +7020,9 @@ true true true + true true + true true true true @@ -6651,7 +7055,9 @@ true true true + true true + true true true true @@ -6684,7 +7090,9 @@ true true true + true true + true true true true @@ -6717,7 +7125,9 @@ true true true + true true + true true true true @@ -6750,7 +7160,9 @@ true true true + true true + true true true true @@ -6783,7 +7195,9 @@ true true true + true true + true true true true @@ -6816,7 +7230,9 @@ true true true + true true + true true true true @@ -6849,7 +7265,9 @@ true true true + true true + true true true true @@ -6882,7 +7300,9 @@ true true true + true true + true true true true @@ -6901,9 +7321,11 @@ true true true + true true true true + true true true true @@ -6944,7 +7366,9 @@ true true true + true true + true true true true @@ -6977,7 +7401,9 @@ true true true + true true + true true true true @@ -7010,7 +7436,9 @@ true true true + true true + true true true true @@ -7043,7 +7471,9 @@ true true true + true true + true true true true @@ -7076,7 +7506,9 @@ true true true + true true + true true true true @@ -7109,7 +7541,9 @@ true true true + true true + true true true true @@ -7142,7 +7576,9 @@ true true true + true true + true true true true @@ -7175,7 +7611,9 @@ true true true + true true + true true true true @@ -7208,7 +7646,9 @@ true true true + true true + true true true true @@ -7241,7 +7681,9 @@ true true true + true true + true true true true @@ -7274,7 +7716,9 @@ true true true + true true + true true true true @@ -7307,7 +7751,9 @@ true true true + true true + true true true true @@ -7340,7 +7786,9 @@ true true true + true true + true true true true @@ -7373,7 +7821,9 @@ true true true + true true + true true true true @@ -7406,7 +7856,9 @@ true true true + true true + true true true true @@ -7439,7 +7891,9 @@ true true true + true true + true true true true @@ -7472,7 +7926,9 @@ true true true + true true + true true true true @@ -7505,7 +7961,9 @@ true true true + true true + true true true true @@ -7538,7 +7996,9 @@ true true true + true true + true true true true @@ -7571,7 +8031,9 @@ true true true + true true + true true true true @@ -7604,7 +8066,9 @@ true true true + true true + true true true true @@ -7637,7 +8101,9 @@ true true true + true true + true true true true @@ -7670,7 +8136,9 @@ true true true + true true + true true true true @@ -7703,7 +8171,9 @@ true true true + true true + true true true true @@ -7736,7 +8206,9 @@ true true true + true true + true true true true @@ -7769,7 +8241,9 @@ true true true + true true + true true true true @@ -7802,7 +8276,9 @@ true true true + true true + true true true true @@ -7835,7 +8311,9 @@ true true true + true true + true true true true @@ -7868,7 +8346,9 @@ true true true + true true + true true true true @@ -7901,7 +8381,9 @@ true true true + true true + true true true true @@ -7934,7 +8416,9 @@ true true true + true true + true true true true @@ -7953,7 +8437,9 @@ true true true + true true + true true true true @@ -7980,9 +8466,11 @@ true true true + true true true true + true true true true @@ -8009,9 +8497,11 @@ true true true + true true true true + true true true true @@ -8054,7 +8544,9 @@ true true true + true true + true true true true @@ -8087,7 +8579,9 @@ true true true + true true + true true true true @@ -8120,7 +8614,9 @@ true true true + true true + true true true true @@ -8153,7 +8649,9 @@ true true true + true true + true true true true @@ -8186,7 +8684,9 @@ true true true + true true + true true true true @@ -8205,7 +8705,9 @@ true true true + true true + true true true true @@ -8234,7 +8736,9 @@ true true true + true true + true true true true @@ -8277,7 +8781,9 @@ true true true + true true + true true true true @@ -8310,7 +8816,9 @@ true true true + true true + true true true true @@ -8343,7 +8851,9 @@ true true true + true true + true true true true @@ -8362,7 +8872,9 @@ true true true + true true + true true true true @@ -8405,7 +8917,9 @@ true true true + true true + true true true true @@ -8438,7 +8952,9 @@ true true true + true true + true true true true @@ -8471,7 +8987,9 @@ true true true + true true + true true true true @@ -8504,7 +9022,9 @@ true true true + true true + true true true true @@ -8537,7 +9057,9 @@ true true true + true true + true true true true @@ -8570,7 +9092,9 @@ true true true + true true + true true true true @@ -8603,7 +9127,9 @@ true true true + true true + true true true true @@ -8636,7 +9162,9 @@ true true true + true true + true true true true @@ -8669,7 +9197,9 @@ true true true + true true + true true true true @@ -8702,7 +9232,9 @@ true true true + true true + true true true true @@ -8735,7 +9267,9 @@ true true true + true true + true true true true @@ -8768,7 +9302,9 @@ true true true + true true + true true true true @@ -8801,7 +9337,9 @@ true true true + true true + true true true true @@ -8834,7 +9372,9 @@ true true true + true true + true true true true @@ -8867,7 +9407,9 @@ true true true + true true + true true true true @@ -8900,7 +9442,9 @@ true true true + true true + true true true true @@ -8933,7 +9477,9 @@ true true true + true true + true true true true @@ -8966,7 +9512,9 @@ true true true + true true + true true true true @@ -8999,7 +9547,9 @@ true true true + true true + true true true true @@ -9032,7 +9582,9 @@ true true true + true true + true true true true @@ -9065,7 +9617,9 @@ true true true + true true + true true true true @@ -9098,7 +9652,9 @@ true true true + true true + true true true true @@ -9131,7 +9687,9 @@ true true true + true true + true true true true @@ -9164,7 +9722,9 @@ true true true + true true + true true true true @@ -9197,7 +9757,9 @@ true true true + true true + true true true true @@ -9230,7 +9792,9 @@ true true true + true true + true true true true @@ -9263,7 +9827,9 @@ true true true + true true + true true true true @@ -9296,7 +9862,9 @@ true true true + true true + true true true true @@ -9329,7 +9897,9 @@ true true true + true true + true true true true @@ -9362,7 +9932,9 @@ true true true + true true + true true true true @@ -9395,7 +9967,9 @@ true true true + true true + true true true true @@ -9428,7 +10002,9 @@ true true true + true true + true true true true @@ -9461,7 +10037,9 @@ true true true + true true + true true true true @@ -9494,7 +10072,9 @@ true true true + true true + true true true true @@ -9527,7 +10107,9 @@ true true true + true true + true true true true @@ -9560,7 +10142,9 @@ true true true + true true + true true true true @@ -9593,7 +10177,9 @@ true true true + true true + true true true true @@ -9626,7 +10212,9 @@ true true true + true true + true true true true @@ -9659,7 +10247,9 @@ true true true + true true + true true true true @@ -9678,9 +10268,11 @@ true true true + true true true true + true true true true @@ -9721,7 +10313,9 @@ true true true + true true + true true true true @@ -9754,7 +10348,9 @@ true true true + true true + true true true true @@ -9787,7 +10383,9 @@ true true true + true true + true true true true @@ -9820,7 +10418,9 @@ true true true + true true + true true true true @@ -9853,7 +10453,9 @@ true true true + true true + true true true true @@ -9886,7 +10488,9 @@ true true true + true true + true true true true @@ -9919,7 +10523,9 @@ true true true + true true + true true true true @@ -9952,7 +10558,9 @@ true true true + true true + true true true true @@ -9985,7 +10593,9 @@ true true true + true true + true true true true @@ -10018,7 +10628,9 @@ true true true + true true + true true true true @@ -10051,7 +10663,9 @@ true true true + true true + true true true true @@ -10084,7 +10698,9 @@ true true true + true true + true true true true @@ -10117,7 +10733,9 @@ true true true + true true + true true true true @@ -10150,7 +10768,9 @@ true true true + true true + true true true true @@ -10183,7 +10803,9 @@ true true true + true true + true true true true @@ -10200,9 +10822,11 @@ true true true + true true true true + true true true true @@ -10244,7 +10868,9 @@ true true true + true true + true true true true @@ -10277,7 +10903,9 @@ true true true + true true + true true true true @@ -10310,7 +10938,9 @@ true true true + true true + true true true true @@ -10343,7 +10973,9 @@ true true true + true true + true true true true @@ -10376,7 +11008,9 @@ true true true + true true + true true true true @@ -10409,7 +11043,9 @@ true true true + true true + true true true true @@ -10442,7 +11078,9 @@ true true true + true true + true true true true @@ -10475,7 +11113,9 @@ true true true + true true + true true true true @@ -10508,7 +11148,9 @@ true true true + true true + true true true true @@ -10541,7 +11183,9 @@ true true true + true true + true true true true @@ -10574,7 +11218,9 @@ true true true + true true + true true true true @@ -10607,7 +11253,9 @@ true true true + true true + true true true true @@ -10640,7 +11288,9 @@ true true true + true true + true true true true @@ -10673,7 +11323,9 @@ true true true + true true + true true true true @@ -10693,8 +11345,10 @@ true true true + true true true + true true true true @@ -10735,7 +11389,9 @@ true true true + true true + true true true true @@ -10768,7 +11424,9 @@ true true true + true true + true true true true @@ -10801,7 +11459,9 @@ true true true + true true + true true true true @@ -10834,7 +11494,9 @@ true true true + true true + true true true true @@ -10867,7 +11529,9 @@ true true true + true true + true true true true @@ -10900,7 +11564,9 @@ true true true + true true + true true true true @@ -10933,7 +11599,9 @@ true true true + true true + true true true true @@ -10966,7 +11634,9 @@ true true true + true true + true true true true @@ -10999,7 +11669,9 @@ true true true + true true + true true true true @@ -11032,7 +11704,9 @@ true true true + true true + true true true true @@ -11065,7 +11739,9 @@ true true true + true true + true true true true @@ -11098,7 +11774,9 @@ true true true + true true + true true true true @@ -11131,7 +11809,9 @@ true true true + true true + true true true true @@ -11164,7 +11844,9 @@ true true true + true true + true true true true @@ -11197,7 +11879,9 @@ true true true + true true + true true true true @@ -11230,7 +11914,9 @@ true true true + true true + true true true true @@ -11263,7 +11949,9 @@ true true true + true true + true true true true @@ -11296,7 +11984,9 @@ true true true + true true + true true true true @@ -11443,7 +12133,9 @@ false false false + false false + false false false false @@ -11471,7 +12163,9 @@ false false false + false false + false false false false @@ -11518,7 +12212,9 @@ false false false + false false + false false false false @@ -11546,7 +12242,9 @@ false false false + false false + false false false false @@ -11588,7 +12286,9 @@ false false false + false false + false false false false @@ -11616,7 +12316,9 @@ false false false + false false + false false false false @@ -11648,7 +12350,9 @@ false false false + false false + false false false false @@ -11676,7 +12380,9 @@ false false false + false false + false false false false @@ -11708,7 +12414,9 @@ false false false + false false + false false false false @@ -11736,7 +12444,9 @@ false false false + false false + false false false false @@ -11768,7 +12478,9 @@ false false false + false false + false false false false @@ -11796,7 +12508,9 @@ false false false + false false + false false false false @@ -11828,7 +12542,9 @@ false false false + false false + false false false false @@ -11856,7 +12572,9 @@ false false false + false false + false false false false @@ -11893,7 +12611,9 @@ false false false + false false + false false false false @@ -11921,7 +12641,9 @@ false false false + false false + false false false false @@ -11957,7 +12679,9 @@ false false false + false false + false false false false @@ -11985,7 +12709,9 @@ false false false + false false + false false false false @@ -12030,7 +12756,9 @@ false false false + false false + false false false false @@ -12058,7 +12786,9 @@ false false false + false false + false false false false @@ -12161,7 +12891,10 @@ - + + stdcpp14 + stdcpp14 + @@ -12264,9 +12997,11 @@ true true true + true true true true + true true true true @@ -12292,9 +13027,11 @@ true true true + true true true true + true true true true @@ -12320,9 +13057,11 @@ true true true + true true true true + true true true true @@ -12348,9 +13087,11 @@ true true true + true true true true + true true true true From f1a9705d8851cbee470166bd6e5a3ec95c2d01ba Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 26 Jan 2023 11:43:49 +0000 Subject: [PATCH 2/3] Work in progress --- include/etl/type_traits.h | 21 ++++++++++++++++++--- test/test_multi_range.cpp | 4 ++-- test/test_optional.cpp | 2 +- test/test_pseudo_moving_average.cpp | 16 ++++++++-------- test/test_smallest.cpp | 22 ++++++++++++++-------- test/test_string_utilities.cpp | 7 +++++++ test/test_string_utilities_std.cpp | 7 +++++++ test/test_string_utilities_std_u16.cpp | 19 ++++++++++++++----- test/test_string_utilities_std_u32.cpp | 7 +++++++ test/test_string_utilities_std_wchar_t.cpp | 7 +++++++ test/test_string_utilities_u16.cpp | 7 +++++++ test/test_string_utilities_u32.cpp | 7 +++++++ test/test_string_utilities_wchar_t.cpp | 7 +++++++ test/test_type_traits.cpp | 10 +++++----- 14 files changed, 111 insertions(+), 32 deletions(-) diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 4fb6edb5..cf50a3e1 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -105,6 +105,11 @@ namespace etl template const T integral_constant::value; +#if ETL_USING_CPP17 + template + inline constexpr T integral_constant_v = std::integral_constant::value; +#endif + #if ETL_USING_CPP11 template using bool_constant = integral_constant; @@ -113,6 +118,11 @@ namespace etl struct bool_constant : etl::integral_constant { }; #endif +#if ETL_USING_CPP17 + template + inline constexpr bool bool_constant_v = std::bool_constant::value; +#endif + //*************************************************************************** /// negation template @@ -806,7 +816,7 @@ namespace etl //*************************************************************************** /// integral_constant ///\ingroup type_traits - template + template struct integral_constant : std::integral_constant {}; /// integral_constant specialisations @@ -815,8 +825,8 @@ namespace etl typedef integral_constant true_type; #if ETL_USING_CPP17 - template - using integral_constant_v = std::integral_constant::value; + template + inline constexpr T integral_constant_v = std::integral_constant::value; #endif #if ETL_USING_CPP17 @@ -827,6 +837,11 @@ namespace etl struct bool_constant : std::integral_constant { }; #endif +#if ETL_USING_CPP17 + template + inline constexpr bool bool_constant_v = std::bool_constant::value; +#endif + //*************************************************************************** /// negation ///\ingroup type_traits diff --git a/test/test_multi_range.cpp b/test/test_multi_range.cpp index bceb94cb..a72177c5 100644 --- a/test/test_multi_range.cpp +++ b/test/test_multi_range.cpp @@ -290,7 +290,7 @@ namespace std::string inner; }; - std::array results + std::array results { result{ 0, 2, "zero" }, result{ 0, 2, "one" }, result{ 0, 2, "two" }, result{ 0, 2, "three" }, result{ 0, 1, "zero" }, result{ 0, 1, "one" }, result{ 0, 1, "two" }, result{ 0, 1, "three" }, @@ -373,7 +373,7 @@ namespace std::string inner; }; - std::array results + std::array results { result{ 0, 2, "zero" }, result{ 0, 2, "one" }, result{ 0, 2, "two" }, result{ 0, 2, "three" }, result{ 0, 1, "zero" }, result{ 0, 1, "one" }, result{ 0, 1, "two" }, result{ 0, 1, "three" }, diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 9308af27..26412ae4 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -103,7 +103,7 @@ namespace { Data data("Hello"); - etl::optional opt{ data }; + etl::optional opt{ data }; CHECK(opt.has_value()); CHECK(bool(opt)); diff --git a/test/test_pseudo_moving_average.cpp b/test/test_pseudo_moving_average.cpp index 384a7a36..5926eb83 100644 --- a/test/test_pseudo_moving_average.cpp +++ b/test/test_pseudo_moving_average.cpp @@ -65,7 +65,7 @@ namespace //************************************************************************* TEST(integral_signed_average_positive_via_iterator) { - std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; + std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; using CMA = etl::pseudo_moving_average; CMA cma(0); @@ -101,7 +101,7 @@ namespace //************************************************************************* TEST(integral_signed_average_negative_via_iterator) { - std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; + std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; using CMA = etl::pseudo_moving_average; CMA cma(0); @@ -137,7 +137,7 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive_via_iterator) { - std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; + std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; using CMA = etl::pseudo_moving_average; CMA cma(0U); @@ -175,7 +175,7 @@ namespace //************************************************************************* TEST(integral_signed_average_positive_runtime_sample_size_via_iterator) { - std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; + std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; using CMA = etl::pseudo_moving_average; CMA cma(0, SAMPLE_SIZE * 2U); @@ -215,7 +215,7 @@ namespace //************************************************************************* TEST(integral_signed_average_negative_runtime_sample_size_via_iterator) { - std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; + std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; using CMA = etl::pseudo_moving_average; CMA cma(0, SAMPLE_SIZE * 2U); @@ -255,7 +255,7 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive_runtime_sample_size_via_iterator) { - std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; + std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; using CMA = etl::pseudo_moving_average; CMA cma(0U, SAMPLE_SIZE * 2U); @@ -293,7 +293,7 @@ namespace //************************************************************************* TEST(floating_point_average_via_iterator) { - std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; + std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; using CMA = etl::pseudo_moving_average; CMA cma(0); @@ -331,7 +331,7 @@ namespace //************************************************************************* TEST(floating_point_average_runtime_sample_size_via_iterator) { - std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; + std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; using CMA = etl::pseudo_moving_average; CMA cma(0, SAMPLE_SIZE * 2); diff --git a/test/test_smallest.cpp b/test/test_smallest.cpp index 03519934..6b38aae9 100644 --- a/test/test_smallest.cpp +++ b/test/test_smallest.cpp @@ -55,22 +55,24 @@ namespace CHECK(type); } + //************************************************************************* TEST(test_pod_vt) { size_t size; bool type; +#if ETL_USING_CPP17 size = etl::smallest_type_v; - type = etl::is_same>::value; - CHECK_EQUAL(sizeof(char), size); +#endif + type = etl::is_same>::value; CHECK(type); size = etl::smallest_type::size; - type = etl::is_same::type>::value; - CHECK_EQUAL(sizeof(char), size); + + type = etl::is_same::type>::value; CHECK(type); } @@ -107,16 +109,20 @@ namespace struct S2 { char a; short b; char c; }; struct S3 { int a; short b; char c; }; +#if ETL_USING_CPP17 size = etl::smallest_type_v; - type = etl::is_same>::value; - CHECK_EQUAL(sizeof(S1), size); +#endif + + type = etl::is_same>::value; CHECK(type); +#if ETL_USING_CPP17 size = etl::smallest_type_v; - type = etl::is_same>::value; - CHECK_EQUAL(sizeof(S1), size); +#endif + + type = etl::is_same>::value; CHECK(type); } diff --git a/test/test_string_utilities.cpp b/test/test_string_utilities.cpp index f5037168..6b2006a9 100644 --- a/test/test_string_utilities.cpp +++ b/test/test_string_utilities.cpp @@ -38,6 +38,9 @@ SOFTWARE. #undef STR #define STR(x) x +#undef STR_PTR +#define STR_PTR const char* + namespace { SUITE(test_string_utilities_char) @@ -51,7 +54,11 @@ namespace using Vector = etl::vector; using SizeType = etl::istring::size_type; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_std.cpp b/test/test_string_utilities_std.cpp index 27db7e7e..3345e1c8 100644 --- a/test/test_string_utilities_std.cpp +++ b/test/test_string_utilities_std.cpp @@ -40,6 +40,9 @@ SOFTWARE. #undef STR #define STR(x) x +#undef STR_PTR +#define STR_PTR const char* + namespace { SUITE(test_string_utilities_std_char) @@ -50,7 +53,11 @@ namespace using Char = std::string::value_type; using Vector = std::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_std_u16.cpp b/test/test_string_utilities_std_u16.cpp index afff9cef..2c2205aa 100644 --- a/test/test_string_utilities_std_u16.cpp +++ b/test/test_string_utilities_std_u16.cpp @@ -36,7 +36,10 @@ SOFTWARE. #include "etl/string_utilities.h" #undef STR -#define STR(x) L##x +#define STR(x) u##x + +#undef STR_PTR +#define STR_PTR const char16_t* namespace { @@ -50,13 +53,19 @@ namespace SUITE(test_string_utilities_std_u16) { - using String = std::wstring; - using IString = std::wstring; - using StringView = std::wstring_view; - using Char = std::wstring::value_type; + using String = std::u16string; + using IString = std::u16string; +#if ETL_USING_CPP17 + using StringView = std::u16string_view; +#endif + using Char = std::u16string::value_type; using Vector = std::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_std_u32.cpp b/test/test_string_utilities_std_u32.cpp index e7ac9080..6a4a6b81 100644 --- a/test/test_string_utilities_std_u32.cpp +++ b/test/test_string_utilities_std_u32.cpp @@ -38,6 +38,9 @@ SOFTWARE. #undef STR #define STR(x) U##x +#undef STR_PTR +#define STR_PTR const char32_t* + namespace { //*********************************** @@ -56,7 +59,11 @@ namespace using Char = std::u32string::value_type; using Vector = std::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_std_wchar_t.cpp b/test/test_string_utilities_std_wchar_t.cpp index 82fadcc2..7e48e8a6 100644 --- a/test/test_string_utilities_std_wchar_t.cpp +++ b/test/test_string_utilities_std_wchar_t.cpp @@ -38,6 +38,9 @@ SOFTWARE. #undef STR #define STR(x) L##x +#undef STR_PTR +#define STR_PTR const wchar_t* + namespace { //*********************************** @@ -56,7 +59,11 @@ namespace using Char = std::wstring::value_type; using Vector = std::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_u16.cpp b/test/test_string_utilities_u16.cpp index f457b553..55674381 100644 --- a/test/test_string_utilities_u16.cpp +++ b/test/test_string_utilities_u16.cpp @@ -36,6 +36,9 @@ SOFTWARE. #undef STR #define STR(x) u##x +#undef STR_PTR +#define STR_PTR const char16_t* + namespace { //*********************************** @@ -56,7 +59,11 @@ namespace using Char = etl::iu16string::value_type; using Vector = etl::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_u32.cpp b/test/test_string_utilities_u32.cpp index 3c16a1d0..98280105 100644 --- a/test/test_string_utilities_u32.cpp +++ b/test/test_string_utilities_u32.cpp @@ -36,6 +36,9 @@ SOFTWARE. #undef STR #define STR(x) U##x +#undef STR_PTR +#define STR_PTR const char32_t* + namespace { //*********************************** @@ -56,7 +59,11 @@ namespace using Char = etl::iu32string::value_type; using Vector = etl::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_string_utilities_wchar_t.cpp b/test/test_string_utilities_wchar_t.cpp index ba7af84a..8752a9fb 100644 --- a/test/test_string_utilities_wchar_t.cpp +++ b/test/test_string_utilities_wchar_t.cpp @@ -36,6 +36,9 @@ SOFTWARE. #undef STR #define STR(x) L##x +#undef STR_PTR +#define STR_PTR const wchar_t* + namespace { //*********************************** @@ -56,7 +59,11 @@ namespace using Char = etl::iwstring::value_type; using Vector = etl::vector; +#if ETL_USING_CPP17 constexpr auto Whitespace = etl::whitespace_v; +#else + STR_PTR Whitespace = etl::whitespace::value(); +#endif //************************************************************************* TEST(test_trim_whitespace_left_empty) diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 333a5a35..dec68f39 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -1041,15 +1041,15 @@ namespace { #if ETL_USING_CPP17 CHECK_EQUAL(1, (etl::integral_constant_v)); - CHECK((std::is_same>)); + CHECK((std::is_same_v::value_type>)); - CHECK_EQUAL(false, (etl::bool_constant_v)); - CHECK_EQUAL(true, (etl::bool_constant_v)); - CHECK((std::is_same::value_type>)); + CHECK_EQUAL(false, etl::bool_constant_v); + CHECK_EQUAL(true, etl::bool_constant_v); + CHECK((std::is_same_v::value_type>)); CHECK_EQUAL(true, etl::negation_v>); CHECK_EQUAL(false, etl::negation_v>); - CHECK((std::is_same::value_type>)); + CHECK((std::is_same_v::value_type>)); #else CHECK_EQUAL(1, (etl::integral_constant::value)); CHECK((std::is_same::value_type>::value)); From 8eabe5fb26ada7d8eadf8be5a9fb3bdb02d787f9 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 15 Mar 2023 18:20:41 +0000 Subject: [PATCH 3/3] Fix test array sizes C++14 compiler compatibility Updated test run scripts Changed some ETL_ASSERT macros to ETL_ASSERT_OR_RETURN Changed unit test macros for C++20 compaibility Updated test run scripts Updated CMake files to allow C++ standard selection Replaced ETL_ASSERT_AND_RETURN with ETL_ASSERT_OR_RETURN Updated C++14 & C++20 unit test compatibility Changed native char8_t check Added optional optimisation argument to bash script --- .gitignore | 3 + include/etl/bip_buffer_spsc_atomic.h | 8 +- include/etl/bit_stream.h | 63 +- include/etl/callback_timer.h | 4 +- include/etl/callback_timer_atomic.h | 6 +- include/etl/callback_timer_interrupt.h | 4 +- include/etl/callback_timer_locked.h | 4 +- include/etl/char_traits.h | 10 +- include/etl/error_handler.h | 32 +- .../etl/generators/message_packet_generator.h | 36 +- .../etl/generators/message_router_generator.h | 69 +- include/etl/instance_count.h | 2 +- include/etl/message_packet.h | 384 ++++----- include/etl/message_router.h | 407 ++++----- include/etl/message_timer.h | 6 +- include/etl/message_timer_atomic.h | 6 +- include/etl/message_timer_interrupt.h | 4 +- include/etl/message_timer_locked.h | 5 +- include/etl/observer.h | 2 +- include/etl/optional.h | 2 + include/etl/private/bitset_legacy.h | 12 +- include/etl/private/bitset_new.h | 6 +- include/etl/private/pvoidvector.h | 22 +- .../determine_compiler_language_support.h | 36 +- include/etl/shared_message.h | 4 +- include/etl/vector.h | 20 +- test/CMakeLists.txt | 31 +- test/UnitTest++/CheckMacros.h | 11 + test/UnitTest++/Checks.h | 239 +++--- .../exceptions/CMakeLists.txt | 25 +- .../exceptions/test_error_handler.cpp | 4 +- .../log_errors/CMakeLists.txt | 20 + .../log_errors/test_error_handler.cpp | 4 +- .../log_errors_and_exceptions/CMakeLists.txt | 20 + .../test_error_handler.cpp | 4 +- test/{runtests-01.sh => runtests-O1.sh} | 0 test/{runtests-02.sh => runtests-O2.sh} | 0 test/{runtests-03.sh => runtests-O3.sh} | 0 test/runtests-c++14.sh | 348 ++++++++ test/runtests.sh | 25 +- test/test_algorithm.cpp | 4 +- test/test_array.cpp | 4 +- test/test_bit_stream_reader_big_endian.cpp | 64 +- test/test_byte_stream.cpp | 10 +- test/test_callback_timer_interrupt.cpp | 6 +- test/test_char_traits.cpp | 88 +- test/test_circular_iterator.cpp | 12 +- test/test_compiler_settings.cpp | 48 -- test/test_container.cpp | 4 +- test/test_expected.cpp | 1 - test/test_flat_map.cpp | 2 +- test/test_flat_multimap.cpp | 2 +- test/test_flat_multiset.cpp | 2 +- test/test_flat_set.cpp | 2 +- test/test_forward_list.cpp | 2 +- test/test_fsm.cpp | 6 +- test/test_hfsm.cpp | 16 +- test/test_list.cpp | 2 +- test/test_map.cpp | 2 +- test/test_message_timer_interrupt.cpp | 4 +- test/test_multimap.cpp | 2 +- test/test_multiset.cpp | 2 +- test/test_nth_type.cpp | 6 +- test/test_optional.cpp | 2 - test/test_parameter_pack.cpp | 18 +- test/test_poly_span_dynamic_extent.cpp | 26 +- test/test_poly_span_fixed_extent.cpp | 26 +- test/test_pseudo_moving_average.cpp | 80 +- test/test_set.cpp | 2 +- test/test_singleton.cpp | 2 +- test/test_span_dynamic_extent.cpp | 104 +-- test/test_span_fixed_extent.cpp | 96 +-- test/test_string_char_external_buffer.cpp | 12 +- test/test_string_u16.cpp | 13 +- test/test_string_u16_external_buffer.cpp | 23 +- test/test_string_u32.cpp | 19 +- test/test_string_u32_external_buffer.cpp | 24 +- test/test_string_utilities_std.cpp | 5 + test/test_string_utilities_std_u16.cpp | 5 + test/test_string_utilities_std_u32.cpp | 5 + test/test_string_utilities_std_wchar_t.cpp | 5 + test/test_string_wchar_t.cpp | 18 +- test/test_string_wchar_t_external_buffer.cpp | 18 +- test/test_task_scheduler.cpp | 10 +- test/test_unordered_map.cpp | 2 +- test/test_unordered_multimap.cpp | 2 +- test/test_unordered_multiset.cpp | 2 +- test/test_unordered_set.cpp | 2 +- test/test_utility.cpp | 4 +- test/test_variant_variadic.cpp | 6 +- test/test_vector.cpp | 2 +- test/test_vector_pointer_external_buffer.cpp | 14 + test/vs2022/etl.sln | 180 ++-- test/vs2022/etl.vcxproj | 772 +++++++++++++++++- test/vs2022/etl.vcxproj.filters | 8 +- 95 files changed, 2463 insertions(+), 1223 deletions(-) rename test/{runtests-01.sh => runtests-O1.sh} (100%) rename test/{runtests-02.sh => runtests-O2.sh} (100%) rename test/{runtests-03.sh => runtests-O3.sh} (100%) create mode 100644 test/runtests-c++14.sh delete mode 100644 test/test_compiler_settings.cpp diff --git a/.gitignore b/.gitignore index d33fd50b..5c8a2e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -376,3 +376,6 @@ test/vs2022/Debug MSVC C++20 test/vs2022/Debug MSVC - Force C++03 test/vs2022/Debug MSVC - No STL - Built-ins test/vs2022/Debug MSVC - No STL - Force Built-ins +test/temp +test/vs2022/Debug MSVC C++14 +test/vs2022/Debug MSVC C++20 - No STL diff --git a/include/etl/bip_buffer_spsc_atomic.h b/include/etl/bip_buffer_spsc_atomic.h index dad24114..6b67ae4b 100644 --- a/include/etl/bip_buffer_spsc_atomic.h +++ b/include/etl/bip_buffer_spsc_atomic.h @@ -267,12 +267,12 @@ namespace etl // Wrapped around already if (write_index < read_index) { - ETL_ASSERT_AND_RETURN((windex == write_index) && ((wsize + 1) <= read_index), ETL_ERROR(bip_buffer_reserve_invalid)); + ETL_ASSERT_OR_RETURN((windex == write_index) && ((wsize + 1) <= read_index), ETL_ERROR(bip_buffer_reserve_invalid)); } // No wraparound so far, also not wrapping around with this block else if (windex == write_index) { - ETL_ASSERT_AND_RETURN(wsize <= (capacity() - write_index), ETL_ERROR(bip_buffer_reserve_invalid)); + ETL_ASSERT_OR_RETURN(wsize <= (capacity() - write_index), ETL_ERROR(bip_buffer_reserve_invalid)); // Move both indexes forward last.store(windex + wsize, etl::memory_order_release); @@ -280,7 +280,7 @@ namespace etl // Wrapping around now else { - ETL_ASSERT_AND_RETURN((windex == 0) && ((wsize + 1) <= read_index), ETL_ERROR(bip_buffer_reserve_invalid)); + ETL_ASSERT_OR_RETURN((windex == 0) && ((wsize + 1) <= read_index), ETL_ERROR(bip_buffer_reserve_invalid)); } // Always update write index @@ -330,7 +330,7 @@ namespace etl if (rsize > 0) { size_type rsize_checker = rsize; - ETL_ASSERT_AND_RETURN((rindex == get_read_reserve(&rsize_checker)) && (rsize == rsize_checker), ETL_ERROR(bip_buffer_reserve_invalid)); + ETL_ASSERT_OR_RETURN((rindex == get_read_reserve(&rsize_checker)) && (rsize == rsize_checker), ETL_ERROR(bip_buffer_reserve_invalid)); read.store(rindex + rsize, etl::memory_order_release); } diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 5135cab5..21d95d36 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -48,33 +48,6 @@ SOFTWARE. namespace etl { - //*************************************************************************** - /// Exception base for bit streams - //*************************************************************************** - class bit_stream_exception : public etl::exception - { - public: - - bit_stream_exception(string_type reason_, string_type file_name_, numeric_type line_number_) - : exception(reason_, file_name_, line_number_) - { - } - }; - - //*************************************************************************** - ///\ingroup string - /// String empty exception. - //*************************************************************************** - class bit_stream_overflow : public etl::bit_stream_exception - { - public: - - bit_stream_overflow(string_type file_name_, numeric_type line_number_) - : bit_stream_exception(ETL_ERROR_TEXT("bit_stream:overflow", ETL_BIT_STREAM_FILE_ID"A"), file_name_, line_number_) - { - } - }; - //*************************************************************************** /// Encodes and decodes bitstreams. /// Data must be stored in the stream in network order. @@ -89,8 +62,8 @@ namespace etl /// Default constructor. //*************************************************************************** bit_stream() - : pdata(ETL_NULLPTR), - length_chars(0U) + : pdata(ETL_NULLPTR) + , length_chars(0U) { restart(); } @@ -99,8 +72,8 @@ namespace etl /// Construct from range. //*************************************************************************** bit_stream(void* begin_, void* end_) - : pdata(reinterpret_cast(begin_)), - length_chars(etl::distance(reinterpret_cast(begin_), reinterpret_cast(end_))) + : pdata(reinterpret_cast(begin_)) + , length_chars(etl::distance(reinterpret_cast(begin_), reinterpret_cast(end_))) { restart(); } @@ -109,8 +82,8 @@ namespace etl /// Construct from begin and length. //*************************************************************************** bit_stream(void* begin_, size_t length_) - : pdata(reinterpret_cast(begin_)), - length_chars(length_) + : pdata(reinterpret_cast(begin_)) + , length_chars(length_) { restart(); } @@ -667,10 +640,6 @@ namespace etl { write_unchecked(value); } - else - { - ETL_ASSERT_FAIL(ETL_ERROR(etl::bit_stream_overflow)); - } return success; } @@ -700,10 +669,6 @@ namespace etl { write_unchecked(value, nbits); } - else - { - ETL_ASSERT_FAIL(ETL_ERROR(etl::bit_stream_overflow)); - } return success; } @@ -730,10 +695,6 @@ namespace etl step(static_cast(nbits)); } } - else - { - ETL_ASSERT_FAIL(ETL_ERROR(etl::bit_stream_overflow)); - } return success; } @@ -1144,10 +1105,6 @@ namespace etl { result = read_unchecked(); } - else - { - ETL_ASSERT_FAIL(ETL_ERROR(etl::bit_stream_overflow)); - } return result; } @@ -1180,10 +1137,6 @@ namespace etl { result = read_unchecked(nbits); } - else - { - ETL_ASSERT_FAIL(ETL_ERROR(etl::bit_stream_overflow)); - } return result; } @@ -1266,10 +1219,6 @@ namespace etl step(static_cast(nbits)); } } - else - { - ETL_ASSERT_FAIL_AND_RETURN_VALUE(ETL_ERROR(etl::bit_stream_overflow), false); - } return success; } diff --git a/include/etl/callback_timer.h b/include/etl/callback_timer.h index 12acb1f0..7f16bffe 100644 --- a/include/etl/callback_timer.h +++ b/include/etl/callback_timer.h @@ -744,9 +744,9 @@ namespace etl #endif #endif - volatile etl::timer_semaphore_t process_semaphore; + etl::timer_semaphore_t process_semaphore; #endif - volatile uint_least8_t registered_timers; + uint_least8_t registered_timers; public: diff --git a/include/etl/callback_timer_atomic.h b/include/etl/callback_timer_atomic.h index 650d8ae3..860901dd 100644 --- a/include/etl/callback_timer_atomic.h +++ b/include/etl/callback_timer_atomic.h @@ -562,9 +562,9 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - volatile TSemaphore process_semaphore; - volatile uint_least8_t number_of_registered_timers; + bool enabled; + TSemaphore process_semaphore; + uint_least8_t number_of_registered_timers; public: diff --git a/include/etl/callback_timer_interrupt.h b/include/etl/callback_timer_interrupt.h index 02ebd933..11658707 100644 --- a/include/etl/callback_timer_interrupt.h +++ b/include/etl/callback_timer_interrupt.h @@ -564,8 +564,8 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - volatile uint_least8_t number_of_registered_timers; + bool enabled; + uint_least8_t number_of_registered_timers; public: diff --git a/include/etl/callback_timer_locked.h b/include/etl/callback_timer_locked.h index ad6eacd9..ab4dfa0e 100644 --- a/include/etl/callback_timer_locked.h +++ b/include/etl/callback_timer_locked.h @@ -573,8 +573,8 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - volatile uint_least8_t number_of_registered_timers; + bool enabled; + uint_least8_t number_of_registered_timers; try_lock_type try_lock; ///< The callback that tries to lock. lock_type lock; ///< The callback that locks. diff --git a/include/etl/char_traits.h b/include/etl/char_traits.h index 8f4261a6..de34230f 100644 --- a/include/etl/char_traits.h +++ b/include/etl/char_traits.h @@ -58,11 +58,11 @@ namespace etl template<> struct char_traits_types { - typedef wchar_t char_type; - typedef wchar_t int_type; - typedef long long off_type; - typedef size_t pos_type; - typedef char state_type; + typedef wchar_t char_type; + typedef uint_least16_t int_type; + typedef long long off_type; + typedef size_t pos_type; + typedef char state_type; }; #if ETL_USING_CPP20 diff --git a/include/etl/error_handler.h b/include/etl/error_handler.h index a904fd77..13897057 100644 --- a/include/etl/error_handler.h +++ b/include/etl/error_handler.h @@ -269,8 +269,8 @@ namespace etl //*************************************************************************** #if defined(ETL_NO_CHECKS) #define ETL_ASSERT(b, e) // Does nothing. - #define ETL_ASSERT_AND_RETURN(b, e) // Does nothing. - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) // Does nothing. + #define ETL_ASSERT_OR_RETURN(b, e) // Does nothing. + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) // Does nothing. #define ETL_ASSERT_FAIL(e) // Does nothing. #define ETL_ASSERT_FAIL_AND_RETURN(e) // Does nothing. @@ -278,27 +278,27 @@ namespace etl #elif ETL_USING_EXCEPTIONS #if defined(ETL_LOG_ERRORS) #define ETL_ASSERT(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e));}} // If the condition fails, calls the error handler then throws an exception. - #define ETL_ASSERT_AND_RETURN(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return;}} // If the condition fails, calls the error handler then throws an exception. - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return(v);}} // If the condition fails, calls the error handler then throws an exception. + #define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return;}} // If the condition fails, calls the error handler then throws an exception. + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return(v);}} // If the condition fails, calls the error handler then throws an exception. #define ETL_ASSERT_FAIL(e) {etl::error_handler::error((e)); throw((e));} // Calls the error handler then throws an exception. #define ETL_ASSERT_FAIL_AND_RETURN(e) {etl::error_handler::error((e)); throw((e)); return;} // Calls the error handler then throws an exception. #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {etl::error_handler::error((e)); throw((e)); return(v);} // Calls the error handler then throws an exception. #else - #define ETL_ASSERT(b, e) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception. - #define ETL_ASSERT_AND_RETURN(b, e) {if (!(b)) {throw((e)); return;}} // If the condition fails, throws an exception. - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) {if (!(b)) {throw((e)); return(v);}} // If the condition fails, throws an exception. + #define ETL_ASSERT(b, e) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception. + #define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception. + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception. - #define ETL_ASSERT_FAIL(e) {throw((e));} // Throws an exception. - #define ETL_ASSERT_FAIL_AND_RETURN(e) {throw((e)); return;} // Throws an exception. - #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {throw((e)); return(v);} // Throws an exception. + #define ETL_ASSERT_FAIL(e) {throw((e));} // Throws an exception. + #define ETL_ASSERT_FAIL_AND_RETURN(e) {throw((e));} // Throws an exception. + #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {throw((e));} // Throws an exception. #endif #else #if defined(ETL_LOG_ERRORS) #define ETL_ASSERT(b, e) {if(!(b)) {etl::error_handler::error((e));}} // If the condition fails, calls the error handler - #define ETL_ASSERT_AND_RETURN(b, e) {if(!(b)) {etl::error_handler::error((e)); return;}} // If the condition fails, calls the error handler and return - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) {if(!(b)) {etl::error_handler::error((e)); return (v);}} // If the condition fails, calls the error handler and return a value + #define ETL_ASSERT_OR_RETURN(b, e) {if(!(b)) {etl::error_handler::error((e)); return;}} // If the condition fails, calls the error handler and return + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if(!(b)) {etl::error_handler::error((e)); return (v);}} // If the condition fails, calls the error handler and return a value #define ETL_ASSERT_FAIL(e) {etl::error_handler::error((e));} // Calls the error handler #define ETL_ASSERT_FAIL_AND_RETURN(e) {etl::error_handler::error((e)); return;} // Calls the error handler and return @@ -306,16 +306,16 @@ namespace etl #else #if ETL_IS_DEBUG_BUILD #define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts. - #define ETL_ASSERT_AND_RETURN(b, e) {if (!(b)) {assert(false); return;}} // If the condition fails, asserts and return. - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) {if (!(b)) {assert(false); return(v);}} // If the condition fails, asserts and return a value. + #define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {assert(false); return;}} // If the condition fails, asserts and return. + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {assert(false); return(v);}} // If the condition fails, asserts and return a value. #define ETL_ASSERT_FAIL(e) assert(false) // Asserts. #define ETL_ASSERT_FAIL_AND_RETURN(e) {assert(false); return;} // Asserts. #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {assert(false); return(v);} // Asserts. #else #define ETL_ASSERT(b, e) // Does nothing. - #define ETL_ASSERT_AND_RETURN(b, e) {if (!(b)) return;} // Returns. - #define ETL_ASSERT_AND_RETURN_VALUE(b, e, v) {if (!(b)) return(v);} // Returns a value. + #define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) return;} // Returns. + #define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) return(v);} // Returns a value. #define ETL_ASSERT_FAIL(e) // Does nothing. #define ETL_ASSERT_FAIL_AND_RETURN(e) {return;} // Returns. diff --git a/include/etl/generators/message_packet_generator.h b/include/etl/generators/message_packet_generator.h index d300c7fe..6ada9acd 100644 --- a/include/etl/generators/message_packet_generator.h +++ b/include/etl/generators/message_packet_generator.h @@ -380,12 +380,12 @@ namespace etl ################################################ def generate_static_assert_cpp03(n): cog.outl(" // Not etl::message_packet, not etl::imessage and in typelist.") - cog.out(" static const bool Enabled = (!etl::is_same::type, etl::message_packet<") + cog.out(" static const bool Enabled = (!etl::is_same::type, etl::message_packet<") for i in range(1, n): cog.out("T%d, " % i) cog.outl("T%s> >::value &&" % n) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" etl::is_one_of::type,") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" etl::is_one_of::type,") for i in range(1, n): cog.out("T%d, " % i) cog.outl("T%s>::value);" % n) @@ -395,12 +395,12 @@ namespace etl ################################################ def generate_static_assert_cpp11(n): cog.outl(" // Not etl::message_packet, not etl::imessage and in typelist.") - cog.out(" static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet<") + cog.out(" static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet<") for i in range(1, n): cog.out("T%d, " % i) cog.outl("T%s> >::value &&" % n) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" etl::is_one_of::type,") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" etl::is_one_of::type,") for i in range(1, n): cog.out("T%d, " % i) cog.outl("T%s>::value);" % n) @@ -474,12 +474,12 @@ namespace etl cog.outl("#if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS)") cog.outl(" //********************************************") cog.outl("#include \"etl/private/diagnostic_uninitialized_push.h\"") - cog.out(" template ::type, etl::message_packet<") + cog.out(" template ::type, etl::message_packet<") for n in range(1, int(Handlers)): cog.out("T%s, " % n) cog.outl("T%s> >::value &&" % int(Handlers)) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" !etl::is_one_of::type, ") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" !etl::is_one_of::type, ") for n in range(1, int(Handlers)): cog.out("T%s, " % n) cog.outl("T%s>::value, int>::type>" % int(Handlers)) @@ -493,12 +493,12 @@ namespace etl cog.outl(" //********************************************") cog.outl("#include \"etl/private/diagnostic_uninitialized_push.h\"") cog.outl(" template ") - cog.out(" explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet<") + cog.out(" explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet<") for n in range(1, int(Handlers)): cog.out("T%s, " % n) cog.outl("T%s> >::value &&" % int(Handlers)) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" !etl::is_one_of::type, ") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" !etl::is_one_of::type, ") for n in range(1, int(Handlers)): cog.out("T%s, " % n) cog.outl("T%s>::value, int>::type = 0)" % int(Handlers)) @@ -758,12 +758,12 @@ namespace etl cog.outl("#if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS)") cog.outl(" //********************************************") cog.outl("#include \"etl/private/diagnostic_uninitialized_push.h\"") - cog.out(" template ::type, etl::message_packet<") + cog.out(" template ::type, etl::message_packet<") for t in range(1, n): cog.out("T%s, " % t) cog.outl("T%s> >::value &&" % n) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" !etl::is_one_of::type, ") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" !etl::is_one_of::type, ") for t in range(1, n): cog.out("T%s, " % t) cog.outl("T%s>::value, int>::type>" % n) @@ -777,12 +777,12 @@ namespace etl cog.outl(" //********************************************") cog.outl("#include \"etl/private/diagnostic_uninitialized_push.h\"") cog.outl(" template ") - cog.out(" explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet<") + cog.out(" explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet<") for t in range(1, n): cog.out("T%s, " % t) cog.outl("T%s> >::value &&" % n) - cog.outl(" !etl::is_same::type, etl::imessage>::value &&") - cog.out(" !etl::is_one_of::type, ") + cog.outl(" !etl::is_same::type, etl::imessage>::value &&") + cog.out(" !etl::is_one_of::type, ") for t in range(1, n): cog.out("T%s, " % t) cog.outl("T%s>::value, int>::type = 0)" % n) diff --git a/include/etl/generators/message_router_generator.h b/include/etl/generators/message_router_generator.h index 1bfe767a..50c7f5a9 100644 --- a/include/etl/generators/message_router_generator.h +++ b/include/etl/generators/message_router_generator.h @@ -620,28 +620,29 @@ namespace etl cog.outl(" }") cog.outl("") cog.outl(" template ") - cog.outl(" void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0)") - cog.outl(" {") - cog.out(" if ETL_IF_CONSTEXPR (etl::is_one_of::value && etl::is_one_of::value)" % int(Handlers)) - cog.outl(" {") - cog.outl(" static_cast(this)->on_receive(msg);") + cog.outl("T%s>::value, void>::type" % int(Handlers)) + cog.outl(" receive(const TMessage& msg)") + cog.outl(" {") + cog.outl(" static_cast(this)->on_receive(msg);") + cog.outl(" }") + cog.outl("") + cog.outl(" template ") + cog.out(" typename etl::enable_if::value && !etl::is_one_of::value, void>::type" % int(Handlers)) + cog.outl(" receive(const TMessage& msg)") + cog.outl(" {") + cog.outl(" if (has_successor())") + cog.outl(" {") + cog.outl(" get_successor().receive(msg);") cog.outl(" }") cog.outl(" else") cog.outl(" {") - cog.outl(" if (has_successor())") - cog.outl(" {") - cog.outl(" get_successor().receive(msg);") - cog.outl(" }") - cog.outl(" else") - cog.outl(" {") - cog.outl(" static_cast(this)->on_receive_unknown(msg);") - cog.outl(" }") + cog.outl(" static_cast(this)->on_receive_unknown(msg);") cog.outl(" }") cog.outl(" }") cog.outl("") @@ -787,31 +788,33 @@ namespace etl cog.outl(" }") cog.outl("") cog.outl(" template ") - cog.outl(" void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0)") - cog.outl(" {") - cog.out(" if ETL_IF_CONSTEXPR (etl::is_one_of::value && etl::is_one_of::value)" % n) + cog.outl("T%s>::value, void>::type" % n) + cog.outl(" receive(const TMessage& msg)") + cog.outl(" {") + cog.outl(" static_cast(this)->on_receive(msg);") + cog.outl(" }") + cog.outl("") + cog.outl(" template ") + cog.out(" typename etl::enable_if::value && !etl::is_one_of::value, void>::type" % n) + cog.outl(" receive(const TMessage& msg)") + cog.outl(" {") + cog.outl(" if (has_successor())") cog.outl(" {") - cog.outl(" static_cast(this)->on_receive(msg);") + cog.outl(" get_successor().receive(msg);") cog.outl(" }") cog.outl(" else") cog.outl(" {") - cog.outl(" if (has_successor())") - cog.outl(" {") - cog.outl(" get_successor().receive(msg);") - cog.outl(" }") - cog.outl(" else") - cog.outl(" {") - cog.outl(" static_cast(this)->on_receive_unknown(msg);") - cog.outl(" }") + cog.outl(" static_cast(this)->on_receive_unknown(msg);") cog.outl(" }") cog.outl(" }") cog.outl("") + cog.outl("") cog.outl(" //**********************************************") cog.outl(" using imessage_router::accepts;") cog.outl("") diff --git a/include/etl/instance_count.h b/include/etl/instance_count.h index 608ec3c9..da66edb5 100644 --- a/include/etl/instance_count.h +++ b/include/etl/instance_count.h @@ -107,7 +107,7 @@ namespace etl //************************************************************************* static counter_type& current_instance_count() { - static counter_type counter = 0; + static counter_type counter = { 0 }; return counter; } }; diff --git a/include/etl/message_packet.h b/include/etl/message_packet.h index 248e2daa..cf5e4442 100644 --- a/include/etl/message_packet.h +++ b/include/etl/message_packet.h @@ -384,16 +384,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -402,15 +402,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -677,16 +677,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -695,15 +695,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -968,16 +968,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -986,15 +986,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1257,16 +1257,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1275,15 +1275,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1543,16 +1543,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1561,15 +1561,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1824,16 +1824,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -1842,15 +1842,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2103,16 +2103,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2121,15 +2121,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2380,16 +2380,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2398,15 +2398,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8, T9>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2654,16 +2654,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2672,15 +2672,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7, T8>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7, T8>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2923,16 +2923,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -2941,15 +2941,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6, T7>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6, T7>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3190,16 +3190,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3208,15 +3208,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5, T6>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5, T6>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5, T6>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5, T6>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3455,16 +3455,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3473,15 +3473,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4, T5>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4, T5>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4, T5>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4, T5>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3717,16 +3717,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3735,15 +3735,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3, T4>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3, T4>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3, T4>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3, T4>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3974,16 +3974,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -3992,15 +3992,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2, T3>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2, T3>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2, T3>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2, T3>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -4229,16 +4229,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -4247,15 +4247,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1, T2>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1, T2>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1, T2>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1, T2>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -4482,16 +4482,16 @@ namespace etl #if ETL_USING_CPP11 && !defined(ETL_MESSAGE_PACKET_FORCE_CPP03_IMPLEMENTATION) && !defined(ETL_COMPILER_GREEN_HILLS) //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" - template ::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1>::value, int>::type> + template ::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1>::value, int>::type> explicit message_packet(TMessage&& msg) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1>::value); + static constexpr bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } @@ -4500,15 +4500,15 @@ namespace etl //******************************************** #include "etl/private/diagnostic_uninitialized_push.h" template - explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - !etl::is_one_of::type, T1>::value, int>::type = 0) + explicit message_packet(const TMessage& /*msg*/, typename etl::enable_if::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + !etl::is_one_of::type, T1>::value, int>::type = 0) : valid(true) { // Not etl::message_packet, not etl::imessage and in typelist. - static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && - !etl::is_same::type, etl::imessage>::value && - etl::is_one_of::type,T1>::value); + static const bool Enabled = (!etl::is_same::type, etl::message_packet >::value && + !etl::is_same::type, etl::imessage>::value && + etl::is_one_of::type,T1>::value); ETL_STATIC_ASSERT(Enabled, "Message not in packet type list"); } diff --git a/include/etl/message_router.h b/include/etl/message_router.h index e5f9e12c..75172e72 100644 --- a/include/etl/message_router.h +++ b/include/etl/message_router.h @@ -607,25 +607,23 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } @@ -753,28 +751,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -898,28 +895,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1042,28 +1038,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1184,27 +1179,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1324,27 +1319,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1463,27 +1458,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1601,27 +1596,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1737,26 +1732,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -1871,26 +1867,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2003,26 +2000,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2134,26 +2132,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2263,25 +2262,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2390,25 +2391,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2516,25 +2519,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; @@ -2641,25 +2646,27 @@ namespace etl } template - void receive(const TMessage& msg, typename etl::enable_if::value, int>::type = 0) + typename etl::enable_if::value && etl::is_one_of::value, void>::type + receive(const TMessage& msg) { - if ETL_IF_CONSTEXPR (etl::is_one_of::value) + static_cast(this)->on_receive(msg); + } + + template + typename etl::enable_if::value && !etl::is_one_of::value, void>::type + receive(const TMessage& msg) + { + if (has_successor()) { - static_cast(this)->on_receive(msg); + get_successor().receive(msg); } else { - if (has_successor()) - { - get_successor().receive(msg); - } - else - { - static_cast(this)->on_receive_unknown(msg); - } + static_cast(this)->on_receive_unknown(msg); } } + //********************************************** using imessage_router::accepts; diff --git a/include/etl/message_timer.h b/include/etl/message_timer.h index 97d0bd76..4655f1ab 100644 --- a/include/etl/message_timer.h +++ b/include/etl/message_timer.h @@ -615,7 +615,7 @@ namespace etl // The list of active timers. private_message_timer::list active_list; - volatile bool enabled; + bool enabled; #if defined(ETL_MESSAGE_TIMER_USE_ATOMIC_LOCK) @@ -629,9 +629,9 @@ namespace etl #endif #endif - volatile etl::timer_semaphore_t process_semaphore; + etl::timer_semaphore_t process_semaphore; #endif - volatile uint_least8_t registered_timers; + uint_least8_t registered_timers; public: diff --git a/include/etl/message_timer_atomic.h b/include/etl/message_timer_atomic.h index e8ba0555..4f79904b 100644 --- a/include/etl/message_timer_atomic.h +++ b/include/etl/message_timer_atomic.h @@ -580,9 +580,9 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - volatile TSemaphore process_semaphore; - volatile uint_least8_t registered_timers; + bool enabled; + TSemaphore process_semaphore; + uint_least8_t registered_timers; public: diff --git a/include/etl/message_timer_interrupt.h b/include/etl/message_timer_interrupt.h index 2390f3f2..e7a5a404 100644 --- a/include/etl/message_timer_interrupt.h +++ b/include/etl/message_timer_interrupt.h @@ -588,8 +588,8 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - volatile uint_least8_t number_of_registered_timers; + bool enabled; + uint_least8_t number_of_registered_timers; public: diff --git a/include/etl/message_timer_locked.h b/include/etl/message_timer_locked.h index 731df313..cd9f7e78 100644 --- a/include/etl/message_timer_locked.h +++ b/include/etl/message_timer_locked.h @@ -595,9 +595,8 @@ namespace etl // The list of active timers. timer_list active_list; - volatile bool enabled; - - volatile uint_least8_t number_of_registered_timers; + bool enabled; + uint_least8_t number_of_registered_timers; try_lock_type try_lock; ///< The callback that tries to lock. lock_type lock; ///< The callback that locks. diff --git a/include/etl/observer.h b/include/etl/observer.h index ef0d12ee..c09180c0 100644 --- a/include/etl/observer.h +++ b/include/etl/observer.h @@ -154,7 +154,7 @@ namespace etl if (i_observer_item == observer_list.end()) { // Is there enough room? - ETL_ASSERT_AND_RETURN(!observer_list.full(), ETL_ERROR(etl::observer_list_full)); + ETL_ASSERT_OR_RETURN(!observer_list.full(), ETL_ERROR(etl::observer_list_full)); // Add it. observer_list.push_back(observer_item(observer)); diff --git a/include/etl/optional.h b/include/etl/optional.h index ee563969..875cda7b 100644 --- a/include/etl/optional.h +++ b/include/etl/optional.h @@ -133,6 +133,7 @@ namespace etl { } +#include "etl/private/diagnostic_uninitialized_push.h" //*************************************************************************** /// Copy constructor. //*************************************************************************** @@ -144,6 +145,7 @@ namespace etl storage.construct(other.value()); } } +#include "etl/private/diagnostic_pop.h" #if ETL_USING_CPP11 //*************************************************************************** diff --git a/include/etl/private/bitset_legacy.h b/include/etl/private/bitset_legacy.h index 53aa3829..775012b7 100644 --- a/include/etl/private/bitset_legacy.h +++ b/include/etl/private/bitset_legacy.h @@ -457,7 +457,7 @@ namespace etl const bool OK = (sizeof(T) * CHAR_BIT) >= (Number_Of_Elements * Bits_Per_Element); - ETL_ASSERT_AND_RETURN_VALUE(OK, ETL_ERROR(etl::bitset_type_too_small), T(0)); + ETL_ASSERT_OR_RETURN_VALUE(OK, ETL_ERROR(etl::bitset_type_too_small), T(0)); if (OK) { @@ -1170,7 +1170,7 @@ namespace etl //************************************************************************* bitset& set(const char* text) { - ETL_ASSERT_AND_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); + ETL_ASSERT_OR_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); etl::ibitset::set(text); return *this; @@ -1181,7 +1181,7 @@ namespace etl //************************************************************************* bitset& set(const wchar_t* text) { - ETL_ASSERT_AND_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); + ETL_ASSERT_OR_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); etl::ibitset::set(text); return *this; @@ -1192,7 +1192,7 @@ namespace etl //************************************************************************* bitset& set(const char16_t* text) { - ETL_ASSERT_AND_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); + ETL_ASSERT_OR_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); etl::ibitset::set(text); return *this; @@ -1203,7 +1203,7 @@ namespace etl //************************************************************************* bitset& set(const char32_t* text) { - ETL_ASSERT_AND_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); + ETL_ASSERT_OR_RETURN_VALUE(text != 0, ETL_ERROR(bitset_nullptr), *this); etl::ibitset::set(text); return *this; @@ -1312,7 +1312,7 @@ namespace etl result.resize(MaxN, '\0'); - ETL_ASSERT_AND_RETURN_VALUE((result.size() == MaxN), ETL_ERROR(etl::bitset_overflow), result); + ETL_ASSERT_OR_RETURN_VALUE((result.size() == MaxN), ETL_ERROR(etl::bitset_overflow), result); for (size_t i = MaxN; i > 0; --i) { diff --git a/include/etl/private/bitset_new.h b/include/etl/private/bitset_new.h index fc387cd7..d636ce60 100644 --- a/include/etl/private/bitset_new.h +++ b/include/etl/private/bitset_new.h @@ -565,7 +565,7 @@ namespace etl result.resize(active_bits, '\0'); // Check that the string type can contain the digits. - ETL_ASSERT_AND_RETURN_VALUE(result.size() == active_bits, ETL_ERROR(etl::bitset_string_too_small), result); + ETL_ASSERT_OR_RETURN_VALUE(result.size() == active_bits, ETL_ERROR(etl::bitset_string_too_small), result); for (size_t i = active_bits; i > 0; --i) { @@ -1429,7 +1429,7 @@ namespace etl result.resize(Active_Bits, '\0'); // Check that the string type can contain the digits. - ETL_ASSERT_AND_RETURN_VALUE(result.size() == Active_Bits, ETL_ERROR(etl::bitset_string_too_small), result); + ETL_ASSERT_OR_RETURN_VALUE(result.size() == Active_Bits, ETL_ERROR(etl::bitset_string_too_small), result); for (size_t i = Active_Bits; i > 0; --i) { @@ -3078,7 +3078,7 @@ namespace etl result.resize(Active_Bits, '\0'); // Check that the string type can contain the digits. - ETL_ASSERT_AND_RETURN_VALUE(result.size() == Active_Bits, ETL_ERROR(etl::bitset_string_too_small), result); + ETL_ASSERT_OR_RETURN_VALUE(result.size() == Active_Bits, ETL_ERROR(etl::bitset_string_too_small), result); for (size_t i = Active_Bits; i > 0; --i) { diff --git a/include/etl/private/pvoidvector.h b/include/etl/private/pvoidvector.h index 558b9584..0561082e 100644 --- a/include/etl/private/pvoidvector.h +++ b/include/etl/private/pvoidvector.h @@ -185,7 +185,7 @@ namespace etl //********************************************************************* void resize(size_t new_size) { - ETL_ASSERT(new_size <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full)); p_end = p_buffer + new_size; } @@ -199,7 +199,7 @@ namespace etl //********************************************************************* void resize(size_t new_size, value_type value) { - ETL_ASSERT(new_size <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full)); pointer p_new_end = p_buffer + new_size; @@ -218,7 +218,7 @@ namespace etl //********************************************************************* void uninitialized_resize(size_t new_size) { - ETL_ASSERT(new_size <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full)); p_end = p_buffer + new_size; } @@ -334,7 +334,7 @@ namespace etl { #if ETL_IS_DEBUG_BUILD difference_type d = etl::distance(first, last); - ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif initialise(); @@ -359,7 +359,7 @@ namespace etl { #if ETL_IS_DEBUG_BUILD difference_type d = etl::distance(first, last); - ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif initialise(); @@ -378,7 +378,7 @@ namespace etl //********************************************************************* void assign(size_t n, value_type value) { - ETL_ASSERT(n <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(n <= CAPACITY, ETL_ERROR(vector_full)); initialise(); @@ -401,7 +401,7 @@ namespace etl void push_back(value_type value) { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full)); #endif *p_end++ = value; } @@ -414,7 +414,7 @@ namespace etl void emplace_back(value_type value) { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full)); #endif * p_end++ = value; } @@ -426,7 +426,7 @@ namespace etl void pop_back() { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() > 0, ETL_ERROR(vector_empty)); + ETL_ASSERT_OR_RETURN(size() > 0, ETL_ERROR(vector_empty)); #endif --p_end; } @@ -496,7 +496,7 @@ namespace etl //********************************************************************* void insert(const_iterator position, size_t n, value_type value) { - ETL_ASSERT((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); iterator position_ = to_iterator(position); @@ -521,7 +521,7 @@ namespace etl iterator position_ = to_iterator(position); - ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); etl::copy_backward(position_, p_end, p_end + count); etl::copy(first, last, position_); diff --git a/include/etl/profiles/determine_compiler_language_support.h b/include/etl/profiles/determine_compiler_language_support.h index 23083e13..827bb713 100644 --- a/include/etl/profiles/determine_compiler_language_support.h +++ b/include/etl/profiles/determine_compiler_language_support.h @@ -145,22 +145,6 @@ SOFTWARE. #define ETL_CPP20_NOT_SUPPORTED (!ETL_CPP20_SUPPORTED) #define ETL_CPP23_NOT_SUPPORTED (!ETL_CPP23_SUPPORTED) -#if !defined(ETL_NO_NULLPTR_SUPPORT) - #define ETL_NO_NULLPTR_SUPPORT ETL_CPP11_NOT_SUPPORTED -#endif - -#if !defined(ETL_NO_SMALL_CHAR_SUPPORT) - #define ETL_NO_SMALL_CHAR_SUPPORT ETL_CPP20_NOT_SUPPORTED -#endif - -#if !defined(ETL_NO_LARGE_CHAR_SUPPORT) -#define ETL_NO_LARGE_CHAR_SUPPORT ETL_CPP11_NOT_SUPPORTED -#endif - -#if !defined(ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) - #define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_CPP14_SUPPORTED -#endif - // 'Using' macros #define ETL_USING_CPP11 (ETL_CPP11_SUPPORTED == 1) #define ETL_USING_CPP14 (ETL_CPP14_SUPPORTED == 1) @@ -174,6 +158,26 @@ SOFTWARE. #define ETL_NOT_USING_CPP20 (ETL_CPP20_SUPPORTED == 0) #define ETL_NOT_USING_CPP23 (ETL_CPP23_SUPPORTED == 0) +#if !defined(ETL_NO_NULLPTR_SUPPORT) + #define ETL_NO_NULLPTR_SUPPORT ETL_NOT_USING_CPP11 +#endif + +#if !defined(ETL_NO_SMALL_CHAR_SUPPORT) + #if ETL_USING_CPP20 + #define ETL_NO_SMALL_CHAR_SUPPORT 0 + #else + #define ETL_NO_SMALL_CHAR_SUPPORT 1 + #endif +#endif + +#if !defined(ETL_NO_LARGE_CHAR_SUPPORT) + #define ETL_NO_LARGE_CHAR_SUPPORT ETL_NOT_USING_CPP11 +#endif + +#if !defined(ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) + #define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_USING_CPP14 +#endif + // Language standard #if ETL_USING_CPP23 #define ETL_LANGUAGE_STANDARD 23 diff --git a/include/etl/shared_message.h b/include/etl/shared_message.h index 00ec6d10..013ea887 100644 --- a/include/etl/shared_message.h +++ b/include/etl/shared_message.h @@ -89,7 +89,7 @@ namespace etl //************************************************************************* /// Move constructor //************************************************************************* - shared_message(etl::shared_message&& other) + shared_message(etl::shared_message&& other) ETL_NOEXCEPT : p_rcmessage(etl::move(other.p_rcmessage)) { other.p_rcmessage = ETL_NULLPTR; @@ -121,7 +121,7 @@ namespace etl //************************************************************************* /// Move assignment operator //************************************************************************* - shared_message& operator =(etl::shared_message&& other) + shared_message& operator =(etl::shared_message&& other) ETL_NOEXCEPT { if (&other != this) { diff --git a/include/etl/vector.h b/include/etl/vector.h index dde676bb..bada15ba 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -221,7 +221,7 @@ namespace etl //********************************************************************* void resize(size_t new_size, const_reference value) { - ETL_ASSERT(new_size <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full)); const size_t current_size = size(); size_t delta = (current_size < new_size) ? new_size - current_size : current_size - new_size; @@ -246,7 +246,7 @@ namespace etl //********************************************************************* void uninitialized_resize(size_t new_size) { - ETL_ASSERT(new_size <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full)); #if defined(ETL_DEBUG_COUNT) if (size() < new_size) @@ -383,7 +383,7 @@ namespace etl #if ETL_IS_DEBUG_BUILD difference_type d = etl::distance(first, last); - ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif initialise(); @@ -400,7 +400,7 @@ namespace etl //********************************************************************* void assign(size_t n, parameter_t value) { - ETL_ASSERT(n <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(n <= CAPACITY, ETL_ERROR(vector_full)); initialise(); @@ -432,7 +432,7 @@ namespace etl void push_back(const_reference value) { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full)); #endif create_back(value); } @@ -446,7 +446,7 @@ namespace etl void push_back(rvalue_reference value) { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full)); #endif create_back(etl::move(value)); } @@ -546,7 +546,7 @@ namespace etl void pop_back() { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(size() > 0, ETL_ERROR(vector_empty)); + ETL_ASSERT_OR_RETURN(size() > 0, ETL_ERROR(vector_empty)); #endif destroy_back(); } @@ -754,7 +754,7 @@ namespace etl //********************************************************************* void insert(const_iterator position, size_t n, parameter_t value) { - ETL_ASSERT((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); iterator position_ = to_iterator(position); @@ -813,7 +813,7 @@ namespace etl { size_t count = etl::distance(first, last); - ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); + ETL_ASSERT_OR_RETURN((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); size_t insert_n = count; size_t insert_begin = etl::distance(cbegin(), position); @@ -1335,7 +1335,7 @@ namespace etl ETL_OVERRIDE #endif { - ETL_ASSERT(etl::is_trivially_copyable::value, ETL_ERROR(etl::vector_incompatible_type)); + ETL_ASSERT_OR_RETURN(etl::is_trivially_copyable::value, ETL_ERROR(etl::vector_incompatible_type)); etl::ivector::repair_buffer(buffer); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0cc34109..07a2e8d2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,15 @@ cmake_minimum_required(VERSION 3.5.0) project(etl_unit_tests LANGUAGES CXX) +#include(FetchContent) +#FetchContent_Declare( +# googletest +# URL https://github.com/google/googletest/archive/refs/heads/main.zip +#) + +#set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +#FetchContent_MakeAvailable(googletest) + add_executable(etl_tests main.cpp murmurhash3.cpp @@ -40,7 +49,6 @@ add_executable(etl_tests test_circular_buffer_external_buffer.cpp test_circular_iterator.cpp test_compare.cpp - test_compiler_settings.cpp test_constant.cpp test_container.cpp test_correlation.cpp @@ -276,6 +284,26 @@ target_compile_definitions(etl_tests PRIVATE -DETL_DEBUG) option(ETL_NO_STL "No STL" OFF) +if (ETL_CXX_STANDARD MATCHES "98") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "03") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "11") + message(STATUS "Compiling for C++11") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 11) +elseif (ETL_CXX_STANDARD MATCHES "14") + message(STATUS "Compiling for C++14") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 14) +elseif (ETL_CXX_STANDARD MATCHES "17") + message(STATUS "Compiling for C++17") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) +else() + message(STATUS "Compiling for C++20") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 20) +endif() + if (NO_STL OR ETL_NO_STL) message(STATUS "Compiling for No STL") target_compile_definitions(etl_tests PRIVATE -DETL_NO_STL) @@ -343,5 +371,4 @@ add_test(etl_unit_tests etl_tests) # as they appear from UnitTest++ add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) -set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) \ No newline at end of file diff --git a/test/UnitTest++/CheckMacros.h b/test/UnitTest++/CheckMacros.h index 0ee75dfd..4cb5767c 100644 --- a/test/UnitTest++/CheckMacros.h +++ b/test/UnitTest++/CheckMacros.h @@ -341,5 +341,16 @@ if (caught_) \ #endif #endif +#define CHECK_MESSAGE(m1) std::cerr << (m1) << "\n"; +#define CHECK_MESSAGE1(m1) std::cerr << (m1) << "\n"; +#define CHECK_MESSAGE2(m1, m2) std::cerr << (m1) << (m2) << "\n"; +#define CHECK_MESSAGE3(m1, m2, m3) std::cerr << (m1) << (m2) << (m3) << "\n"; +#define CHECK_MESSAGE4(m1, m2, m3, m4) std::cerr << (m1) << (m2) << (m3) << (m4) << "\n"; + +#define CHECK_MESSAGE_IF(b, m1) { if (b) std::cerr << (m1) << "\n"; } +#define CHECK_MESSAGE1_IF(m1) { if (b) std::cerr << (m1) << "\n"; } +#define CHECK_MESSAGE2_IF(m1, m2) { if (b) std::cerr << (m1) << (m2) << "\n"; } +#define CHECK_MESSAGE3_IF(m1, m2, m3) { if (b) std::cerr << (m1) << (m2) << (m3) << "\n"; } +#define CHECK_MESSAGE4_IF(m1, m2, m3, m4) { if (b) std::cerr << (m1) << (m2) << (m3) << (m4) << "\n"; } #endif diff --git a/test/UnitTest++/Checks.h b/test/UnitTest++/Checks.h index 0cf552df..72326a07 100644 --- a/test/UnitTest++/Checks.h +++ b/test/UnitTest++/Checks.h @@ -16,8 +16,146 @@ #include "MemoryOutStream.h" #include -namespace UnitTest { +namespace UnitTest +{ + template + typename std::enable_if::value, std::string>::type + DisplayValue(const TChar& c) + { + std::ostringstream oss; + oss << c; + + return oss.str(); + } + + template <> + inline std::string DisplayValue(const char& c) + { + using type = std::char_traits::int_type; + + std::ostringstream oss; + + oss << type(c) << " ('" << c << "')"; + + return oss.str(); + } + +#if (__cplusplus >= 202002L) + template <> + inline std::string DisplayValue(const char8_t& c) + { + using type = std::char_traits::int_type; + + std::ostringstream oss; + + oss << type(c); + + return oss.str(); + } +#endif + + template <> + inline std::string DisplayValue(const wchar_t& c) + { + using type = std::char_traits::int_type; + + std::ostringstream oss; + + oss << type(c); + + return oss.str(); + } + +#if (__cplusplus >= 201103L) + template <> + inline std::string DisplayValue(const char16_t& c) + { + using type = std::char_traits::int_type; + + std::ostringstream oss; + + oss << type(c); + + return oss.str(); + } + + template <> + inline std::string DisplayValue(const char32_t& c) + { + using type = std::char_traits::int_type; + + std::ostringstream oss; + + oss << type(c); + + return oss.str(); + } +#endif + + template + std::string DisplayValue(const TChar* c) + { + std::ostringstream oss; + + oss << c; + + return oss.str(); + } + + template <> + inline std::string DisplayValue(const char* c) + { + std::ostringstream oss; + + oss << c; + + return oss.str(); + } + +#if (__cplusplus >= 202002L) + template <> + inline std::string DisplayValue(const char8_t* c) + { + std::ostringstream oss; + + oss << static_cast(c); + + return oss.str(); + } +#endif + + template <> + inline std::string DisplayValue(const wchar_t* c) + { + std::ostringstream oss; + + oss << static_cast(c); + + return oss.str(); + } + +#if (__cplusplus >= 201103L) + template <> + inline std::string DisplayValue(const char16_t* c) + { + std::ostringstream oss; + + oss << static_cast(c); + + return oss.str(); + } + + template <> + inline std::string DisplayValue(const char32_t* c) + { + std::ostringstream oss; + + oss << static_cast(c); + + return oss.str(); + } +#endif template< typename Value > bool Check(Value const& value) @@ -31,55 +169,18 @@ namespace UnitTest { return !value; } -#if __cplusplus >= 202002L - template< typename Expected, typename Actual > - std::enable_if_t>> || std::is_same_v>> || - - std::is_same_v>> || std::is_same_v>> || - std::is_same_v>> || std::is_same_v>> || - std::is_same_v>> || std::is_same_v>>), void> - CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details) - { - if (!(expected == actual)) - { - UnitTest::MemoryOutStream stream; - stream << "Expected " << expected << " but was " << actual; - - results.OnTestFailure(details, stream.GetText()); - } - } - - template< typename Expected, typename Actual > - std::enable_if_t<(std::is_same_v>> || std::is_same_v>> || - std::is_same_v>> || std::is_same_v>> || - std::is_same_v>> || std::is_same_v>> || - std::is_same_v>> || std::is_same_v>>), void> - CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details) - { - if (!(expected == actual)) - { - using int_type_expected = std::char_traits::int_type; - using int_type_actual = std::char_traits::int_type; - - UnitTest::MemoryOutStream stream; - stream << "Expected " << int_type_expected(expected) << " but was " << int_type_actual(actual); - - 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 " << expected << " but was " << actual; + 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) @@ -144,59 +245,6 @@ namespace UnitTest { } } -#if __cplusplus >= 202002L - template< typename Expected, typename Actual > - void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual, - size_t const count, TestDetails const& details) - { - bool equal = true; - for (size_t i = 0; i < count; ++i) - equal &= (expected[i] == actual[i]); - - if (!equal) - { - UnitTest::MemoryOutStream stream; - - stream << "Expected [ "; - - using expected_type = std::remove_cvref_t; - using actual_type = std::remove_cvref_t; - - if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v || std::is_same_v || - std::is_same_v || std::is_same_v || - std::is_same_v || std::is_same_v) - { - using int_type_expected = std::char_traits::int_type; - using int_type_actual = std::char_traits::int_type; - - for (size_t expectedIndex = 0; expectedIndex < count; ++expectedIndex) - stream << int_type_expected(expected[expectedIndex]) << " "; - - stream << "] but was [ "; - - for (size_t actualIndex = 0; actualIndex < count; ++actualIndex) - stream << int_type_actual(actual[actualIndex]) << " "; - - stream << "]"; - } - else - { - for (size_t expectedIndex = 0; expectedIndex < count; ++expectedIndex) - stream << expected[expectedIndex] << " "; - - stream << "] but was [ "; - - for (size_t actualIndex = 0; actualIndex < count; ++actualIndex) - stream << actual[actualIndex] << " "; - - stream << "]"; - } - - results.OnTestFailure(details, stream.GetText()); - } - } -#else template< typename Expected, typename Actual > void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual, size_t const count, TestDetails const& details) @@ -212,19 +260,18 @@ namespace UnitTest { stream << "Expected [ "; for (size_t expectedIndex = 0; expectedIndex < count; ++expectedIndex) - stream << expected[expectedIndex] << " "; + stream << DisplayValue(expected[expectedIndex]) << " "; stream << "] but was [ "; for (size_t actualIndex = 0; actualIndex < count; ++actualIndex) - stream << actual[actualIndex] << " "; + stream << DisplayValue(actual[actualIndex]) << " "; stream << "]"; results.OnTestFailure(details, stream.GetText()); } } -#endif template< typename Expected, typename Actual, typename Tolerance > bool ArrayAreClose(Expected const& expected, Actual const& actual, size_t const count, Tolerance const& tolerance) diff --git a/test/etl_error_handler/exceptions/CMakeLists.txt b/test/etl_error_handler/exceptions/CMakeLists.txt index 77962471..3eb91a71 100644 --- a/test/etl_error_handler/exceptions/CMakeLists.txt +++ b/test/etl_error_handler/exceptions/CMakeLists.txt @@ -14,6 +14,26 @@ add_executable(etl_tests ${TEST_SOURCE_FILES} ) +if (ETL_CXX_STANDARD MATCHES "98") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "03") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "11") + message(STATUS "Compiling for C++11") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 11) +elseif (ETL_CXX_STANDARD MATCHES "14") + message(STATUS "Compiling for C++14") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 14) +elseif (ETL_CXX_STANDARD MATCHES "17") + message(STATUS "Compiling for C++17") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) +else() + message(STATUS "Compiling for C++20") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 20) +endif() + if (ETL_OPTIMISATION MATCHES "-O1") message(STATUS "Compiling with -O1 optimisations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1") @@ -41,7 +61,7 @@ if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Cla -fno-omit-frame-pointer -Wall -Wextra - -Werror + -Werror ) target_link_options(etl_tests PRIVATE @@ -58,6 +78,3 @@ add_test(etl_error_handler_unit_tests etl_tests) add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) -#RSG -set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) - diff --git a/test/etl_error_handler/exceptions/test_error_handler.cpp b/test/etl_error_handler/exceptions/test_error_handler.cpp index fe83d0d3..44f46efa 100644 --- a/test/etl_error_handler/exceptions/test_error_handler.cpp +++ b/test/etl_error_handler/exceptions/test_error_handler.cpp @@ -72,7 +72,7 @@ void AssertFail() //***************************************************************************** void AssertAndReturn(bool state) { - ETL_ASSERT_AND_RETURN(state, ETL_ERROR(test_exception_1)); + ETL_ASSERT_OR_RETURN(state, ETL_ERROR(test_exception_1)); ++return_count; } @@ -88,7 +88,7 @@ void AssertFailAndReturn() //***************************************************************************** bool AssertAndReturnValue(bool state) { - ETL_ASSERT_AND_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); + ETL_ASSERT_OR_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); ++return_count; return false; diff --git a/test/etl_error_handler/log_errors/CMakeLists.txt b/test/etl_error_handler/log_errors/CMakeLists.txt index 296ffe58..cbea8e44 100644 --- a/test/etl_error_handler/log_errors/CMakeLists.txt +++ b/test/etl_error_handler/log_errors/CMakeLists.txt @@ -14,6 +14,26 @@ add_executable(etl_tests ${TEST_SOURCE_FILES} ) +if (ETL_CXX_STANDARD MATCHES "98") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "03") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "11") + message(STATUS "Compiling for C++11") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 11) +elseif (ETL_CXX_STANDARD MATCHES "14") + message(STATUS "Compiling for C++14") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 14) +elseif (ETL_CXX_STANDARD MATCHES "17") + message(STATUS "Compiling for C++17") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) +else() + message(STATUS "Compiling for C++20") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 20) +endif() + if (ETL_OPTIMISATION MATCHES "-O1") message(STATUS "Compiling with -O1 optimisations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1") diff --git a/test/etl_error_handler/log_errors/test_error_handler.cpp b/test/etl_error_handler/log_errors/test_error_handler.cpp index b395dca7..ade19548 100644 --- a/test/etl_error_handler/log_errors/test_error_handler.cpp +++ b/test/etl_error_handler/log_errors/test_error_handler.cpp @@ -88,7 +88,7 @@ void AssertFail() //***************************************************************************** void AssertAndReturn(bool state) { - ETL_ASSERT_AND_RETURN(state, ETL_ERROR(test_exception_1)); + ETL_ASSERT_OR_RETURN(state, ETL_ERROR(test_exception_1)); ++assert_return_count; } @@ -104,7 +104,7 @@ void AssertFailAndReturn() //***************************************************************************** bool AssertAndReturnValue(bool state) { - ETL_ASSERT_AND_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); + ETL_ASSERT_OR_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); ++assert_return_count; return false; diff --git a/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt b/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt index 9112d519..6ef1fa64 100644 --- a/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt +++ b/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt @@ -15,6 +15,26 @@ add_executable(etl_tests ${TEST_SOURCE_FILES} ) +if (ETL_CXX_STANDARD MATCHES "98") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "03") + message(STATUS "Compiling for C++98") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 98) +elseif (ETL_CXX_STANDARD MATCHES "11") + message(STATUS "Compiling for C++11") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 11) +elseif (ETL_CXX_STANDARD MATCHES "14") + message(STATUS "Compiling for C++14") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 14) +elseif (ETL_CXX_STANDARD MATCHES "17") + message(STATUS "Compiling for C++17") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) +else() + message(STATUS "Compiling for C++20") + set_property(TARGET etl_tests PROPERTY CXX_STANDARD 20) +endif() + if (ETL_OPTIMISATION MATCHES "-O1") message(STATUS "Compiling with -O1 optimisations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1") diff --git a/test/etl_error_handler/log_errors_and_exceptions/test_error_handler.cpp b/test/etl_error_handler/log_errors_and_exceptions/test_error_handler.cpp index ce8a996b..97392a81 100644 --- a/test/etl_error_handler/log_errors_and_exceptions/test_error_handler.cpp +++ b/test/etl_error_handler/log_errors_and_exceptions/test_error_handler.cpp @@ -89,7 +89,7 @@ void AssertFail() //***************************************************************************** void AssertAndReturn(bool state) { - ETL_ASSERT_AND_RETURN(state, ETL_ERROR(test_exception_1)); + ETL_ASSERT_OR_RETURN(state, ETL_ERROR(test_exception_1)); ++return_count; } @@ -105,7 +105,7 @@ void AssertFailAndReturn() //***************************************************************************** bool AssertAndReturnValue(bool state) { - ETL_ASSERT_AND_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); + ETL_ASSERT_OR_RETURN_VALUE(state, ETL_ERROR(test_exception_1), true); ++return_count; return false; diff --git a/test/runtests-01.sh b/test/runtests-O1.sh similarity index 100% rename from test/runtests-01.sh rename to test/runtests-O1.sh diff --git a/test/runtests-02.sh b/test/runtests-O2.sh similarity index 100% rename from test/runtests-02.sh rename to test/runtests-O2.sh diff --git a/test/runtests-03.sh b/test/runtests-O3.sh similarity index 100% rename from test/runtests-03.sh rename to test/runtests-O3.sh diff --git a/test/runtests-c++14.sh b/test/runtests-c++14.sh new file mode 100644 index 00000000..4dea9034 --- /dev/null +++ b/test/runtests-c++14.sh @@ -0,0 +1,348 @@ +#!/bin/sh +clear + +mkdir -p build-make || exit 1 +cd build-make || exit 1 + +echo "ETL Tests" > log.txt + +opt="-O0" +cxx_standard="14" + +#****************************************************************************** +# GCC +#****************************************************************************** +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - STL - Force C++03" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - No STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +#****************************************************************************** +# CLANG +#****************************************************************************** +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - STL - Force C++03" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - No STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../etl_initializer_list/ +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +cd ../.. + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " All Tests Completed OK" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt diff --git a/test/runtests.sh b/test/runtests.sh index 6ad9f190..249a44b8 100644 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -6,7 +6,16 @@ cd build-make || exit 1 echo "ETL Tests" > log.txt -opt="-O0" +# Set the optimisation level +if [ "$1" = "1" ]; then + opt="-O1" +elif [ "$1" = "2" ]; then + opt="-O2" +elif [ "$1" = "3" ]; then + opt="-O3" +else + opt="-O0" +fi #****************************************************************************** # GCC @@ -17,6 +26,7 @@ echo " GCC - STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -38,6 +48,7 @@ echo " GCC - STL - Force C++03" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -59,6 +70,7 @@ echo " GCC - No STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -84,6 +96,7 @@ echo " Clang - STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -105,6 +118,7 @@ echo " Clang - STL - Force C++03" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -126,6 +140,7 @@ echo " Clang - No STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -151,6 +166,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -173,6 +189,7 @@ echo " Clang - Initializer list test" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -198,6 +215,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -223,6 +241,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -248,6 +267,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf gcc --version | grep gcc | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -273,6 +293,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -298,6 +319,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then @@ -323,6 +345,7 @@ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf clang --version | grep clang | tee -a log.txt +echo "Using optimisation" $opt | tee -a log.txt cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. make -j4 if [ $? -eq 0 ]; then diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index 23fb819f..d68e6b48 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -1601,7 +1601,7 @@ namespace etl::transform_s(std::begin(input), std::end(input), std::begin(output), - std::begin(output) + (std::size(output) / 2), + std::begin(output) + (ETL_OR_STD::size(output) / 2), std::bind(std::multiplies(), std::placeholders::_1, 2)); bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare)); @@ -1610,7 +1610,7 @@ namespace std::fill(std::begin(output), std::end(output), 0); etl::transform_s(std::begin(input), - std::begin(input) + (std::size(input) / 2), + std::begin(input) + (ETL_OR_STD::size(input) / 2), std::begin(output), std::end(output), std::bind(std::multiplies(), std::placeholders::_1, 2)); diff --git a/test/test_array.cpp b/test/test_array.cpp index fc8de4e2..1806af64 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -701,7 +701,7 @@ namespace auto data = etl::make_array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK_EQUAL(0, data[0]); CHECK_EQUAL(1, data[1]); @@ -723,7 +723,7 @@ namespace auto data = etl::make_array(Moveable(0), Moveable(1), Moveable(2), Moveable(3), Moveable(4), Moveable(5), Moveable(6), Moveable(7), Moveable(8), Moveable(9)); using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK_EQUAL(Moveable(0), data[0]); CHECK_EQUAL(Moveable(1), data[1]); diff --git a/test/test_bit_stream_reader_big_endian.cpp b/test/test_bit_stream_reader_big_endian.cpp index c8544eba..068f8371 100644 --- a/test/test_bit_stream_reader_big_endian.cpp +++ b/test/test_bit_stream_reader_big_endian.cpp @@ -147,7 +147,7 @@ namespace CHECK_EQUAL(false, result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -202,7 +202,7 @@ namespace CHECK_EQUAL(false, result.value()); // One too many. - CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); + CHECK_FALSE(etl::read(bit_stream)); } //************************************************************************* @@ -238,7 +238,7 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -274,7 +274,7 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(etl::read(bit_stream), etl::bit_stream_overflow); + CHECK_FALSE(etl::read(bit_stream)); } //************************************************************************* @@ -305,7 +305,7 @@ namespace //************************************************************************* TEST(test_read_int8_t_5bits) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -335,13 +335,13 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(5U)); } //************************************************************************* TEST(test_read_int8_t_5bits_with_skip) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -369,13 +369,13 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(5U)); } //************************************************************************* TEST(test_read_checked_int8_t_5bits_using_non_member_function) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -405,13 +405,13 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(etl::read(bit_stream, 5U), etl::bit_stream_overflow); + CHECK_FALSE(etl::read(bit_stream, 5U)); } //************************************************************************* TEST(test_read_unchecked_int8_t_5bits_using_non_member_function) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; std::array expected = { int8_t(0x01), int8_t(0xFA), int8_t(0x05), int8_t(0xFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -466,13 +466,13 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* TEST(test_read_uint8_t_5bits) { - std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; + std::array storage = { char(0x0E), char(0x8B), char(0xF0) }; std::array expected = { uint8_t(0x01), uint8_t(0x1A), uint8_t(0x05), uint8_t(0x1F) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -502,7 +502,7 @@ namespace CHECK_EQUAL(int(expected[3]), int(result.value())); // One too many. - CHECK_THROW(bit_stream.read(5U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(5U)); } //************************************************************************* @@ -538,7 +538,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -574,7 +574,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(10U)); } //************************************************************************* @@ -610,7 +610,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -646,7 +646,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(10U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(10U)); } //************************************************************************* @@ -685,15 +685,15 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* TEST(test_read_int32_t_22bits) { - std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), - char(0x55), char(0xA9), char(0x56), char(0xA9), - char(0x7F), char(0xFF), char(0xFF) }; + std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), + char(0x55), char(0xA9), char(0x56), char(0xA9), + char(0x7F), char(0xFF), char(0xFF) }; std::array expected = { int32_t(0x00000001), int32_t(0x001AA55A), int32_t(0xFFE55AA5), int32_t(0xFFFFFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -723,7 +723,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(22U)); } //************************************************************************* @@ -762,15 +762,15 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* TEST(test_read_uint32_t_22bits) { - std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), - char(0x55), char(0xA9), char(0x56), char(0xA9), - char(0x7F), char(0xFF), char(0xFF) }; + std::array storage = { char(0x00), char(0x00), char(0x05), char(0xAA), + char(0x55), char(0xA9), char(0x56), char(0xA9), + char(0x7F), char(0xFF), char(0xFF) }; std::array expected = { uint32_t(0x00000001), uint32_t(0x001AA55A), uint32_t(0x00255AA5), uint32_t(0x003FFFFF) }; etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::endian::big); @@ -800,7 +800,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(22U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(22U)); } //************************************************************************* @@ -839,7 +839,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -877,7 +877,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(47U)); } //************************************************************************* @@ -916,7 +916,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read()); } //************************************************************************* @@ -954,7 +954,7 @@ namespace CHECK_EQUAL(expected[3], result.value()); // One too many. - CHECK_THROW(bit_stream.read(47U), etl::bit_stream_overflow); + CHECK_FALSE(bit_stream.read(47U)); } //************************************************************************* diff --git a/test/test_byte_stream.cpp b/test/test_byte_stream.cpp index 8bd55036..3f8e8296 100644 --- a/test/test_byte_stream.cpp +++ b/test/test_byte_stream.cpp @@ -109,7 +109,7 @@ namespace { char storage[7]; - etl::byte_stream_writer writer(storage, std::size(storage), etl::endian::big); + etl::byte_stream_writer writer(storage, ETL_OR_STD::size(storage), etl::endian::big); etl::byte_stream_reader reader(storage, writer.size_bytes(), etl::endian::big); // Capacity is zero. CHECK(writer.empty()); @@ -120,7 +120,7 @@ namespace CHECK_EQUAL(0U, writer.size_bytes()); CHECK_EQUAL(0U, reader.size_bytes()); - CHECK_EQUAL(std::size(storage), writer.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(storage), writer.capacity()); CHECK_EQUAL(0U, reader.available()); @@ -136,9 +136,9 @@ namespace { char storage[8]; - etl::byte_stream_writer writer(storage, std::size(storage), etl::endian::big); + etl::byte_stream_writer writer(storage, ETL_OR_STD::size(storage), etl::endian::big); - etl::span storage_span(storage, storage + std::size(storage)); + etl::span storage_span(storage, storage + ETL_OR_STD::size(storage)); etl::span writer_span = writer.data(); CHECK(writer_span.begin() == storage_span.begin()); CHECK(writer_span.end() == storage_span.end()); @@ -150,7 +150,7 @@ namespace etl::span free_span = writer.free_data(); CHECK_EQUAL(sizeof(uint8_t) + sizeof(uint16_t), (std::distance(used_span.begin(), used_span.end()))); - CHECK_EQUAL(std::size(storage) - sizeof(uint8_t) - sizeof(uint16_t), (std::distance(free_span.begin(), free_span.end()))); + CHECK_EQUAL(ETL_OR_STD::size(storage) - sizeof(uint8_t) - sizeof(uint16_t), (std::distance(free_span.begin(), free_span.end()))); CHECK(writer.write(uint32_t(0x12345678U))); // 4 more written. CHECK_FALSE(writer.write(uint32_t(0x12345678U))); // Can't write 4 more. diff --git a/test/test_callback_timer_interrupt.cpp b/test/test_callback_timer_interrupt.cpp index f695239d..70fc6f72 100644 --- a/test/test_callback_timer_interrupt.cpp +++ b/test/test_callback_timer_interrupt.cpp @@ -50,10 +50,10 @@ namespace --guard_count; } - volatile static int guard_count; + static int guard_count; }; - volatile int ScopedGuard::guard_count = 0; + int ScopedGuard::guard_count = 0; //*************************************************************************** struct TimerLogEntry @@ -791,7 +791,7 @@ namespace } // Check the results log. - for (auto t : timer_log) + for (auto& t : timer_log) { switch (t.id) { diff --git a/test/test_char_traits.cpp b/test/test_char_traits.cpp index 283e0f80..1963c767 100644 --- a/test/test_char_traits.cpp +++ b/test/test_char_traits.cpp @@ -74,7 +74,7 @@ namespace char_type r = 'A'; char_type c = 'B'; char_type src[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - char_type dst[std::size(src)]; + char_type dst[ETL_OR_STD::size(src)]; char_type filled[] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; const char_type* p_src; char_type* p_dst; @@ -96,18 +96,18 @@ namespace CHECK_EQUAL(-1, char_traits::compare("ABCDEE", "ABCDEF", 6U)); CHECK_EQUAL(1, char_traits::compare("ABCDEF", "ABCDEE", 6U)); - p_dst = char_traits::assign(dst, std::size(dst), 9); - CHECK_ARRAY_EQUAL(filled, p_dst, std::size(filled)); + p_dst = char_traits::assign(dst, ETL_OR_STD::size(dst), 9); + CHECK_ARRAY_EQUAL(filled, p_dst, ETL_OR_STD::size(filled)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::copy(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::copy(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::move(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::move(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - p_src = char_traits::find(src, std::size(src), 4); + p_src = char_traits::find(src, ETL_OR_STD::size(src), 4); CHECK_EQUAL(src[4], *p_src); CHECK_EQUAL(127, char_traits::to_char_type(int_type(127))); @@ -130,7 +130,7 @@ namespace char_type r = L'A'; char_type c = L'B'; char_type src[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - char_type dst[std::size(src)]; + char_type dst[ETL_OR_STD::size(src)]; char_type filled[] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; const char_type* p_src; char_type* p_dst; @@ -152,22 +152,22 @@ namespace CHECK_EQUAL(-1, char_traits::compare(L"ABCDEE", L"ABCDEF", 6U)); CHECK_EQUAL(1, char_traits::compare(L"ABCDEF", L"ABCDEE", 6U)); - p_dst = char_traits::assign(dst, std::size(dst), 9); - CHECK_ARRAY_EQUAL(filled, p_dst, std::size(filled)); + p_dst = char_traits::assign(dst, ETL_OR_STD::size(dst), 9); + CHECK_ARRAY_EQUAL(filled, p_dst, ETL_OR_STD::size(filled)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::copy(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::copy(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::move(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::move(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - p_src = char_traits::find(src, std::size(src), 4); + p_src = char_traits::find(src, ETL_OR_STD::size(src), 4); CHECK_EQUAL(src[4], *p_src); - CHECK_EQUAL(127, char_traits::to_char_type(int_type(127))); - CHECK_EQUAL(127, char_traits::to_int_type(char_type(127))); + CHECK_TRUE(127 == char_traits::to_char_type(int_type(127))); + CHECK_TRUE(127 == char_traits::to_int_type(char_type(127))); CHECK(!char_traits::eq_int_type(0, 1)); CHECK(char_traits::eq_int_type(1, 1)); @@ -186,7 +186,7 @@ namespace char_type r = u'A'; char_type c = u'B'; char_type src[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - char_type dst[std::size(src)]; + char_type dst[ETL_OR_STD::size(src)]; char_type filled[] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; const char_type* p_src; char_type* p_dst; @@ -208,22 +208,21 @@ namespace CHECK_EQUAL(-1, char_traits::compare(u"ABCDEE", u"ABCDEF", 6U)); CHECK_EQUAL(1, char_traits::compare(u"ABCDEF", u"ABCDEE", 6U)); - p_dst = char_traits::assign(dst, std::size(dst), 9); - CHECK_ARRAY_EQUAL(filled, p_dst, std::size(filled)); + p_dst = char_traits::assign(dst, ETL_OR_STD::size(dst), 9); + CHECK_ARRAY_EQUAL(filled, p_dst, ETL_OR_STD::size(filled)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::copy(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::copy(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::move(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::move(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - p_src = char_traits::find(src, std::size(src), 4); + p_src = char_traits::find(src, ETL_OR_STD::size(src), 4); CHECK_EQUAL(src[4], *p_src); - CHECK_EQUAL(127, char_traits::to_char_type(int_type(127))); - CHECK_EQUAL(127, char_traits::to_int_type(char_type(127))); + CHECK_EQUAL(127, char_type(127)); CHECK(!char_traits::eq_int_type(0, 1)); CHECK(char_traits::eq_int_type(1, 1)); @@ -242,7 +241,7 @@ namespace char_type r = U'A'; char_type c = U'B'; char_type src[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - char_type dst[std::size(src)]; + char_type dst[ETL_OR_STD::size(src)]; char_type filled[] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; const char_type* p_src; char_type* p_dst; @@ -264,21 +263,20 @@ namespace CHECK_EQUAL(-1, char_traits::compare(U"ABCDEE", U"ABCDEF", 6U)); CHECK_EQUAL(1, char_traits::compare(U"ABCDEF", U"ABCDEE", 6U)); - p_dst = char_traits::assign(dst, std::size(dst), 9); - CHECK_ARRAY_EQUAL(filled, p_dst, std::size(filled)); + p_dst = char_traits::assign(dst, ETL_OR_STD::size(dst), 9); + CHECK_ARRAY_EQUAL(filled, p_dst, ETL_OR_STD::size(filled)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::copy(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::copy(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - std::fill_n(dst, std::size(dst), 0); - p_dst = char_traits::move(dst, src, std::size(src)); - CHECK_ARRAY_EQUAL(src, p_dst, std::size(src)); + std::fill_n(dst, ETL_OR_STD::size(dst), 0); + p_dst = char_traits::move(dst, src, ETL_OR_STD::size(src)); + CHECK_ARRAY_EQUAL(src, p_dst, ETL_OR_STD::size(src)); - p_src = char_traits::find(src, std::size(src), 4); + p_src = char_traits::find(src, ETL_OR_STD::size(src), 4); CHECK_EQUAL(src[4], *p_src); - CHECK_EQUAL(127, char_traits::to_char_type(int_type(127))); CHECK_EQUAL(127, char_traits::to_int_type(char_type(127))); CHECK(!char_traits::eq_int_type(0, 1)); diff --git a/test/test_circular_iterator.cpp b/test/test_circular_iterator.cpp index 04983aba..2888d3a9 100644 --- a/test/test_circular_iterator.cpp +++ b/test/test_circular_iterator.cpp @@ -63,8 +63,8 @@ namespace CHECK(std::begin(data) == ci.begin()); CHECK(std::end(data) == ci.end()); CHECK(std::begin(data) == ci.current()); - CHECK_EQUAL(std::size(data), size_t(std::distance(ci.begin(), ci.end()))); - CHECK_EQUAL(std::size(data), ci.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), size_t(std::distance(ci.begin(), ci.end()))); + CHECK_EQUAL(ETL_OR_STD::size(data), ci.size()); } //************************************************************************* @@ -80,8 +80,8 @@ namespace CHECK(std::begin(data) == ci.begin()); CHECK(std::end(data) == ci.end()); CHECK(start == ci.current()); - CHECK_EQUAL(std::size(data), size_t(std::distance(ci.begin(), ci.end()))); - CHECK_EQUAL(std::size(data), ci.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), size_t(std::distance(ci.begin(), ci.end()))); + CHECK_EQUAL(ETL_OR_STD::size(data), ci.size()); } //************************************************************************* @@ -645,7 +645,7 @@ namespace for (int i = 0; i < 20; i += step) { - CHECK_EQUAL(expected[i % std::size(data)], *ci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(data)], *ci); ci -= step; } } @@ -663,7 +663,7 @@ namespace for (int i = 0; i < 20; i += step) { - CHECK_EQUAL(expected[i % std::size(data)], *ci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(data)], *ci); ci = ci - step; } } diff --git a/test/test_compiler_settings.cpp b/test/test_compiler_settings.cpp deleted file mode 100644 index 72e0a011..00000000 --- a/test/test_compiler_settings.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2019 John Wellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#include "unit_test_framework.h" - -#include "etl/platform.h" - -namespace -{ - const bool cpp11_supported = ETL_USING_CPP11; - const bool cpp14_supported = ETL_USING_CPP14; - const bool cpp17_supported = ETL_USING_CPP17; - - SUITE(test_compiler_settings) - { - TEST(test_cpp) - { - CHECK(cpp11_supported); - CHECK(cpp14_supported); - CHECK(cpp17_supported); - } - }; -} diff --git a/test/test_container.cpp b/test/test_container.cpp index 8bfcccbd..bb28bb8c 100644 --- a/test/test_container.cpp +++ b/test/test_container.cpp @@ -129,7 +129,7 @@ namespace const size_t SIZE = 10UL; std::list data(SIZE); - size_t runtime_size = etl::size(data); + size_t runtime_size = ETL_OR_STD::size(data); CHECK_EQUAL(SIZE, runtime_size); } @@ -139,7 +139,7 @@ namespace const size_t SIZE = 10UL; int data[SIZE]; - size_t runtime_size = etl::size(data); + size_t runtime_size = ETL_OR_STD::size(data); CHECK_EQUAL(SIZE, runtime_size); size_t compiletime_size = sizeof(etl::array_size(data)); diff --git a/test/test_expected.cpp b/test/test_expected.cpp index b5a44db4..b97346e5 100644 --- a/test/test_expected.cpp +++ b/test/test_expected.cpp @@ -32,7 +32,6 @@ SOFTWARE. #include "etl/type_traits.h" #include -#include namespace { diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index 3b1e0c2c..6550f274 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -1525,7 +1525,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK_EQUAL(NDC("A"), data.at(0)); CHECK_EQUAL(NDC("B"), data.at(1)); diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index c9fa25de..9be71afb 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -1326,7 +1326,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index e6e57c92..fbeba5c1 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -1273,7 +1273,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index 14718176..931972e2 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -1196,7 +1196,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index 43c85bde..8d9f85a3 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -1403,7 +1403,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_fsm.cpp b/test/test_fsm.cpp index cbf58e61..a057a055 100644 --- a/test/test_fsm.cpp +++ b/test/test_fsm.cpp @@ -341,7 +341,7 @@ namespace CHECK(motorControl.is_producer()); CHECK(motorControl.is_consumer()); - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -480,7 +480,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -529,7 +529,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); diff --git a/test/test_hfsm.cpp b/test/test_hfsm.cpp index dc1e3459..d7361c08 100644 --- a/test/test_hfsm.cpp +++ b/test/test_hfsm.cpp @@ -474,9 +474,9 @@ namespace CHECK(motorControl.is_producer()); CHECK(motorControl.is_consumer()); - running.set_child_states(childStates, std::size(childStates)); + running.set_child_states(childStates, ETL_OR_STD::size(childStates)); - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -647,7 +647,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -700,7 +700,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -754,7 +754,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -809,7 +809,7 @@ namespace { etl::null_message_router nmr; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -902,7 +902,7 @@ namespace { MotorControl mc; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); @@ -941,7 +941,7 @@ namespace { MotorControl mc; - motorControl.Initialise(stateList, std::size(stateList)); + motorControl.Initialise(stateList, ETL_OR_STD::size(stateList)); motorControl.reset(); motorControl.ClearStatistics(); diff --git a/test/test_list.cpp b/test/test_list.cpp index d65623ce..a24ac735 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -2166,7 +2166,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_map.cpp b/test/test_map.cpp index c4e11b69..4845e52b 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -1599,7 +1599,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK_EQUAL(0, data.at("0")); CHECK_EQUAL(1, data.at("1")); diff --git a/test/test_message_timer_interrupt.cpp b/test/test_message_timer_interrupt.cpp index ee02cb44..1d8fe5d5 100644 --- a/test/test_message_timer_interrupt.cpp +++ b/test/test_message_timer_interrupt.cpp @@ -55,10 +55,10 @@ namespace --guard_count; } - volatile static int guard_count; + static int guard_count; }; - volatile int ScopedGuard::guard_count = 0; + int ScopedGuard::guard_count = 0; //*************************************************************************** struct TimerLogEntry diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 1d580e54..c44ffb1c 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -1620,7 +1620,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index 3ac3eeb3..7e8b1851 100644 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -1608,7 +1608,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_nth_type.cpp b/test/test_nth_type.cpp index 1258d235..a5339292 100644 --- a/test/test_nth_type.cpp +++ b/test/test_nth_type.cpp @@ -38,9 +38,9 @@ namespace //************************************************************************* TEST(test_nth_type) { - CHECK((std::is_same_v, int>)); - CHECK((std::is_same_v, long>)); - CHECK((std::is_same_v, double>)); + CHECK((std::is_same, int>::value)); + CHECK((std::is_same, long>::value)); + CHECK((std::is_same, double>::value)); } } } diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 2b032f43..0ade0e9d 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -31,8 +31,6 @@ SOFTWARE. #include #include -#include - #include "etl/optional.h" #include "etl/vector.h" #include "data.h" diff --git a/test/test_parameter_pack.cpp b/test/test_parameter_pack.cpp index fce7c1e3..4c8adf8b 100644 --- a/test/test_parameter_pack.cpp +++ b/test/test_parameter_pack.cpp @@ -61,9 +61,9 @@ namespace // Static assert //CHECK_EQUAL(0U, Pack::index_of_type_v); - CHECK_EQUAL(0U, (etl::parameter_pack::index_of_type::value)); - CHECK_EQUAL(1U, (etl::parameter_pack::index_of_type::value)); - CHECK_EQUAL(2U, (etl::parameter_pack::index_of_type::value)); + CHECK_EQUAL(0U, (etl::parameter_pack::index_of_type::value)); + CHECK_EQUAL(1U, (etl::parameter_pack::index_of_type::value)); + CHECK_EQUAL(2U, (etl::parameter_pack::index_of_type::value)); // Static assert //CHECK_EQUAL(0U, (etl::parameter_pack_v)); @@ -73,16 +73,16 @@ namespace //************************************************************************* TEST(test_type_from_index) { - CHECK((std::is_same_v>)); - CHECK((std::is_same_v>)); - CHECK((std::is_same_v>)); + CHECK((std::is_same>::value)); + CHECK((std::is_same>::value)); + CHECK((std::is_same>::value)); // Static assert //CHECK((std::is_same_v>)); - CHECK((std::is_same_v>)); - CHECK((std::is_same_v>)); - CHECK((std::is_same_v>)); + CHECK((std::is_same>::value)); + CHECK((std::is_same>::value)); + CHECK((std::is_same>::value)); // Static assert //CHECK((std::is_same_v>)); diff --git a/test/test_poly_span_dynamic_extent.cpp b/test/test_poly_span_dynamic_extent.cpp index d9ab34e9..2378f564 100644 --- a/test/test_poly_span_dynamic_extent.cpp +++ b/test/test_poly_span_dynamic_extent.cpp @@ -158,7 +158,7 @@ namespace etl::poly_span s(data); CHECK_EQUAL(sizeof(Derived), s.size_of_element()); CHECK(!s.empty()); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK_EQUAL(s.size() * sizeof(Derived), s.size_bytes()); CHECK_EQUAL(data[0].value(), s[0].value()); CHECK_EQUAL(data[1].value(), s[1].value()); @@ -173,7 +173,7 @@ namespace etl::poly_span s(data); CHECK_EQUAL(sizeof(Derived), s.size_of_element()); CHECK(!s.empty()); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK_EQUAL(s.size() * sizeof(Derived), s.size_bytes()); CHECK_EQUAL(data[0].value(), s[0].value()); CHECK_EQUAL(data[1].value(), s[1].value()); @@ -185,7 +185,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_std_array) { - std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -199,7 +199,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_const_std_array) { - const std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + const std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -214,7 +214,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_etl_array) { - etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -228,7 +228,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_const_etl_array) { - const etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + const etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -483,6 +483,7 @@ namespace CHECK_EQUAL(hashdata, hashview); } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_template_deduction_guide_for_c_array) { @@ -490,8 +491,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -503,8 +504,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } #endif @@ -516,8 +517,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -544,5 +545,6 @@ namespace CHECK_EQUAL(4U, s.size()); CHECK((std::is_same_v>)); } +#endif } } diff --git a/test/test_poly_span_fixed_extent.cpp b/test/test_poly_span_fixed_extent.cpp index 0c73eb17..3c51ddb3 100644 --- a/test/test_poly_span_fixed_extent.cpp +++ b/test/test_poly_span_fixed_extent.cpp @@ -158,7 +158,7 @@ namespace etl::poly_span s(data); CHECK_EQUAL(sizeof(Derived), s.size_of_element()); CHECK(!s.empty()); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK_EQUAL(s.size() * sizeof(Derived), s.size_bytes()); CHECK_EQUAL(data[0].value(), s[0].value()); CHECK_EQUAL(data[1].value(), s[1].value()); @@ -173,7 +173,7 @@ namespace etl::poly_span s(data); CHECK_EQUAL(sizeof(Derived), s.size_of_element()); CHECK(!s.empty()); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK_EQUAL(s.size() * sizeof(Derived), s.size_bytes()); CHECK_EQUAL(data[0].value(), s[0].value()); CHECK_EQUAL(data[1].value(), s[1].value()); @@ -185,7 +185,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_std_array) { - std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -199,7 +199,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_const_std_array) { - const std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + const std::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -214,7 +214,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_etl_array) { - etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -228,7 +228,7 @@ namespace //************************************************************************* TEST(test_poly_span_construct_from_const_etl_array) { - const etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; + const etl::array data{ Derived(1), Derived(2), Derived(3), Derived(4) }; etl::poly_span s(data); CHECK(!s.empty()); CHECK_EQUAL(data.size(), s.size()); @@ -502,6 +502,7 @@ namespace CHECK_EQUAL(hashdata, hashview); } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_template_deduction_guide_for_c_array) { @@ -509,8 +510,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -522,8 +523,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } #endif @@ -535,8 +536,8 @@ namespace etl::poly_span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -563,5 +564,6 @@ namespace CHECK_EQUAL(4U, s.size()); CHECK((std::is_same_v>)); } +#endif } } diff --git a/test/test_pseudo_moving_average.cpp b/test/test_pseudo_moving_average.cpp index 5926eb83..b640762b 100644 --- a/test/test_pseudo_moving_average.cpp +++ b/test/test_pseudo_moving_average.cpp @@ -44,8 +44,8 @@ namespace //************************************************************************* TEST(integral_signed_average_positive) { - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0, cma.value()); @@ -65,10 +65,10 @@ namespace //************************************************************************* TEST(integral_signed_average_positive_via_iterator) { - std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; + std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0, cma.value()); @@ -80,8 +80,8 @@ namespace //************************************************************************* TEST(integral_signed_average_negative) { - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0, cma.value()); @@ -101,10 +101,10 @@ namespace //************************************************************************* TEST(integral_signed_average_negative_via_iterator) { - std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; + std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0, cma.value()); @@ -116,8 +116,8 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive) { - using CMA = etl::pseudo_moving_average; - CMA cma(0U); + using PMA = etl::pseudo_moving_average; + PMA cma(0U); CHECK_EQUAL(0U, cma.value()); @@ -137,10 +137,10 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive_via_iterator) { - std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; + std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; - using CMA = etl::pseudo_moving_average; - CMA cma(0U); + using PMA = etl::pseudo_moving_average; + PMA cma(0U); CHECK_EQUAL(0U, cma.value()); @@ -152,8 +152,8 @@ namespace //************************************************************************* TEST(integral_signed_average_positive_runtime_sample_size) { - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2U); CHECK_EQUAL(0, cma.value()); @@ -175,10 +175,10 @@ namespace //************************************************************************* TEST(integral_signed_average_positive_runtime_sample_size_via_iterator) { - std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; + std::array data{ 9, 1, 8, 2, 7, 3, 6, 4, 5 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2U); CHECK_EQUAL(0, cma.value()); @@ -192,8 +192,8 @@ namespace //************************************************************************* TEST(integral_signed_average_negative_runtime_sample_size) { - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2U); CHECK_EQUAL(0, cma.value()); @@ -215,10 +215,10 @@ namespace //************************************************************************* TEST(integral_signed_average_negative_runtime_sample_size_via_iterator) { - std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; + std::array data{ -9, -1, -8, -2, -7, -3, -6, -4, -5 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2U); CHECK_EQUAL(0, cma.value()); @@ -232,8 +232,8 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive_runtime_sample_size) { - using CMA = etl::pseudo_moving_average; - CMA cma(0U, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0U, SAMPLE_SIZE * 2U); CHECK_EQUAL(0U, cma.value()); @@ -255,10 +255,10 @@ namespace //************************************************************************* TEST(integral_unsigned_average_positive_runtime_sample_size_via_iterator) { - std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; + std::array data{ 9U, 1U, 8U, 2U, 7U, 3U, 6U, 4U, 5U }; - using CMA = etl::pseudo_moving_average; - CMA cma(0U, SAMPLE_SIZE * 2U); + using PMA = etl::pseudo_moving_average; + PMA cma(0U, SAMPLE_SIZE * 2U); CHECK_EQUAL(0U, cma.value()); @@ -272,8 +272,8 @@ namespace //************************************************************************* TEST(floating_point_average) { - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0.0, cma.value()); @@ -293,10 +293,10 @@ namespace //************************************************************************* TEST(floating_point_average_via_iterator) { - std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; + std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0); + using PMA = etl::pseudo_moving_average; + PMA cma(0); CHECK_EQUAL(0.0, cma.value()); @@ -308,8 +308,8 @@ namespace //************************************************************************* TEST(floating_point_average_runtime_sample_size) { - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2); CHECK_EQUAL(0.0, cma.value()); @@ -331,10 +331,10 @@ namespace //************************************************************************* TEST(floating_point_average_runtime_sample_size_via_iterator) { - std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; + std::array data{ 9.0, 1.0, 8.0, 2.0, 7.0, 3.0, 6.0, 4.0, 5.0 }; - using CMA = etl::pseudo_moving_average; - CMA cma(0, SAMPLE_SIZE * 2); + using PMA = etl::pseudo_moving_average; + PMA cma(0, SAMPLE_SIZE * 2); CHECK_EQUAL(0.0, cma.value()); diff --git a/test/test_set.cpp b/test/test_set.cpp index 7a3595a6..752d6e13 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -1417,7 +1417,7 @@ namespace auto v = *data.begin(); using Type = decltype(v); - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); decltype(data)::const_iterator itr = data.begin(); diff --git a/test/test_singleton.cpp b/test/test_singleton.cpp index 01f99ce3..46b747bd 100644 --- a/test/test_singleton.cpp +++ b/test/test_singleton.cpp @@ -62,7 +62,7 @@ namespace //************************************************************************* TEST(test1) { - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK(!Test_Singleton::is_valid()); CHECK_THROW(Test_Singleton::instance(), etl::singleton_not_created); diff --git a/test/test_span_dynamic_extent.cpp b/test/test_span_dynamic_extent.cpp index d26178d1..48fc6566 100644 --- a/test/test_span_dynamic_extent.cpp +++ b/test/test_span_dynamic_extent.cpp @@ -630,6 +630,7 @@ namespace CHECK_EQUAL(hashdata, hashcview); } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_template_deduction_guide_for_c_array) { @@ -637,8 +638,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -650,8 +651,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } #endif @@ -663,8 +664,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -691,6 +692,7 @@ namespace CHECK_EQUAL(4U, s.size()); CHECK((std::is_same_v>)); } +#endif //************************************************************************* void f_issue_481(etl::span) @@ -761,8 +763,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_pre_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; View view{ data }; @@ -777,8 +779,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_pre_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2 }; View view{ data }; View subspan = view.subspan<2, 4>(); @@ -794,8 +796,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_post_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -803,15 +805,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_circular_iterator_post_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5 }; View view{ data }; View subspan = view.subspan<2, 4>(); @@ -827,8 +829,8 @@ namespace //************************************************************************* TEST(test_circular_reverse_iterator_pre_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9 }; View view{ data }; @@ -836,15 +838,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *++sci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *++sci); } } //************************************************************************* TEST(test_circular_reverse_iterator_pre_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5 }; View view{ data }; View subspan = view.subspan<2, 4>(); @@ -853,15 +855,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *++sci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *++sci); } } //************************************************************************* TEST(test_circular_reverse_iterator_post_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; View view{ data }; @@ -869,15 +871,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_circular_reverse_iterator_post_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2 }; View view{ data }; View subspan = view.subspan<2, 4>(); @@ -886,15 +888,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_operator_plus_equals) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -913,8 +915,8 @@ namespace //************************************************************************* TEST(test_operator_plus) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -933,8 +935,8 @@ namespace //************************************************************************* TEST(test_operator_minus_equals) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; View view{ data }; @@ -953,8 +955,8 @@ namespace //************************************************************************* TEST(test_operator_minus) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; View view{ data }; @@ -973,10 +975,10 @@ namespace //************************************************************************* TEST(test_operator_equality) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; - etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; int i; @@ -1011,10 +1013,10 @@ namespace //************************************************************************* TEST(test_operator_equality_one_is_const) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; - etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; int i; @@ -1049,10 +1051,10 @@ namespace //************************************************************************* TEST(test_operator_not_equal) { - etl::array data1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - etl::array data2{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; - etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; int i; @@ -1087,10 +1089,10 @@ namespace //************************************************************************* TEST(test_operator_not_equal_one_is_const) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; - etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data4{ 0, 1, 2, 3, 5, 6, 7, 8, 9 }; int i; diff --git a/test/test_span_fixed_extent.cpp b/test/test_span_fixed_extent.cpp index 7e6e327a..185f85af 100644 --- a/test/test_span_fixed_extent.cpp +++ b/test/test_span_fixed_extent.cpp @@ -620,6 +620,7 @@ namespace CHECK_EQUAL(hashdata, hashcview); } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_template_deduction_guide_for_c_array) { @@ -627,8 +628,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -640,8 +641,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } #endif @@ -653,8 +654,8 @@ namespace etl::span s = data; - CHECK_EQUAL(std::size(data), s.extent); - CHECK_EQUAL(std::size(data), s.size()); + CHECK_EQUAL(ETL_OR_STD::size(data), s.extent); + CHECK_EQUAL(ETL_OR_STD::size(data), s.size()); CHECK((std::is_same_v>)); } @@ -681,6 +682,7 @@ namespace CHECK_EQUAL(4U, s.size()); CHECK((std::is_same_v>)); } +#endif //************************************************************************* void f_issue_481(etl::span) @@ -751,8 +753,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_pre_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; View view{ data }; @@ -767,8 +769,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_pre_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2 }; View view{ data }; etl::span subspan = view.subspan<2, 4>(); @@ -784,8 +786,8 @@ namespace //************************************************************************* TEST(test_circular_iterator_post_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -793,15 +795,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_circular_iterator_post_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5 }; View view{ data }; etl::span subspan = view.subspan<2, 4>(); @@ -817,8 +819,8 @@ namespace //************************************************************************* TEST(test_circular_reverse_iterator_pre_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9 }; View view{ data }; @@ -826,15 +828,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *++sci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *++sci); } } //************************************************************************* TEST(test_circular_reverse_iterator_pre_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5 }; View view{ data }; etl::span subspan = view.subspan<2, 4>(); @@ -843,15 +845,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *++sci); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *++sci); } } //************************************************************************* TEST(test_circular_reverse_iterator_post_increment) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; View view{ data }; @@ -859,15 +861,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_circular_reverse_iterator_post_increment_for_subspan) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2 }; View view{ data }; etl::span subspan = view.subspan<2, 4>(); @@ -876,15 +878,15 @@ namespace for (int i = 0; i < 20; ++i) { - CHECK_EQUAL(expected[i % std::size(expected)], *sci++); + CHECK_EQUAL(expected[i % ETL_OR_STD::size(expected)], *sci++); } } //************************************************************************* TEST(test_operator_plus_equals) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -903,8 +905,8 @@ namespace //************************************************************************* TEST(test_operator_plus) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; View view{ data }; @@ -923,8 +925,8 @@ namespace //************************************************************************* TEST(test_operator_minus_equals) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; View view{ data }; @@ -943,8 +945,8 @@ namespace //************************************************************************* TEST(test_operator_minus) { - etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + etl::array data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array expected{ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; View view{ data }; @@ -963,9 +965,9 @@ namespace //************************************************************************* TEST(test_operator_equality) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; View view1{ data1 }; View view2{ data1 }; @@ -990,9 +992,9 @@ namespace //************************************************************************* TEST(test_operator_equality_one_is_const) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; View view1{ data1 }; CView view2{ data1 }; @@ -1017,9 +1019,9 @@ namespace //************************************************************************* TEST(test_operator_not_equal) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; View view1{ data1 }; View view2{ data1 }; @@ -1044,9 +1046,9 @@ namespace //************************************************************************* TEST(test_operator_not_equal_one_is_const) { - etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; + etl::array data1{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data2{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::array data3{ 0, 1, 2, 3, 4, 4, 6, 7, 8, 9 }; View view1{ data1 }; CView view2{ data1 }; diff --git a/test/test_string_char_external_buffer.cpp b/test/test_string_char_external_buffer.cpp index bb20ef7e..ec49a3de 100644 --- a/test/test_string_char_external_buffer.cpp +++ b/test/test_string_char_external_buffer.cpp @@ -152,12 +152,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer) { - Text text(array_text, std::size(array_text)); + Text text(array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(0U, text.size()); CHECK(text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -167,12 +167,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text) { - Text text(array_text, array_text, std::size(array_text)); + Text text(array_text, array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(text.size(), etl::strlen(array_text)); CHECK(!text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 63d24b34..b9951fe6 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -66,12 +66,12 @@ namespace { static const size_t SIZE = 11; - typedef etl::u16string Text; - typedef etl::iu16string IText; - typedef std::u16string Compare_Text; - typedef Text::value_type value_t; - typedef etl::u16string<52> TextL; - typedef etl::u16string<4> TextS; + using Text = etl::u16string; + using IText = etl::iu16string; + using Compare_Text = std::u16string; + using value_t = Text::value_type; + using TextL = etl::u16string<52>; + using TextS = etl::u16string<4>; Compare_Text initial_text; Compare_Text less_text; @@ -601,7 +601,6 @@ namespace CHECK_EQUAL(&constText[0], constText.begin()); } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { diff --git a/test/test_string_u16_external_buffer.cpp b/test/test_string_u16_external_buffer.cpp index c4f72c12..b013f52c 100644 --- a/test/test_string_u16_external_buffer.cpp +++ b/test/test_string_u16_external_buffer.cpp @@ -74,10 +74,9 @@ namespace using TextT = etl::u16string; using Compare_Text = std::u16string; using value_t = Text::value_type; - - using TextBuffer = std::array; - using TextBufferL = std::array; - using TextBufferS = std::array; + using TextBuffer = std::array; + using TextBufferL = std::array; + using TextBufferS = std::array; Compare_Text initial_text; Compare_Text less_text; @@ -168,12 +167,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer) { - Text text(array_text, std::size(array_text)); + Text text(array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(0U, text.size()); CHECK(text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -183,12 +182,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text) { - Text text(array_text, array_text, std::size(array_text)); + Text text(array_text, array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(text.size(), etl::strlen(array_text)); CHECK(!text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -735,7 +734,7 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } @@ -749,7 +748,7 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 266a8f3d..a9ce49d8 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -66,12 +66,12 @@ namespace { static const size_t SIZE = 11; - typedef etl::u32string Text; - typedef etl::iu32string IText; - typedef std::u32string Compare_Text; - typedef Text::value_type value_t; - typedef etl::u32string<52> TextL; - typedef etl::u32string<4> TextS; + using Text = etl::u32string; + using IText = etl::iu32string; + using Compare_Text = std::u32string; + using value_t = Text::value_type; + using TextL = etl::u32string<52>; + using TextS = etl::u32string<4>; Compare_Text initial_text; Compare_Text less_text; @@ -595,20 +595,19 @@ namespace TEST_FIXTURE(SetupFixture, test_begin) { Text text(initial_text.c_str()); - const Text constText(initial_text.c_str()); + const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } diff --git a/test/test_string_u32_external_buffer.cpp b/test/test_string_u32_external_buffer.cpp index 0d9b9d9b..133f2231 100644 --- a/test/test_string_u32_external_buffer.cpp +++ b/test/test_string_u32_external_buffer.cpp @@ -74,10 +74,9 @@ namespace using TextT = etl::u32string; using Compare_Text = std::u32string; using value_t = Text::value_type; - - using TextBuffer = std::array; - using TextBufferL = std::array; - using TextBufferS = std::array; + using TextBuffer = std::array; + using TextBufferL = std::array; + using TextBufferS = std::array; Compare_Text initial_text; Compare_Text less_text; @@ -168,12 +167,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer) { - Text text(array_text, std::size(array_text)); + Text text(array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(0U, text.size()); CHECK(text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -183,12 +182,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text) { - Text text(array_text, array_text, std::size(array_text)); + Text text(array_text, array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(text.size(), etl::strlen(array_text)); CHECK(!text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -735,11 +734,10 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { @@ -749,7 +747,7 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } diff --git a/test/test_string_utilities_std.cpp b/test/test_string_utilities_std.cpp index 3345e1c8..bdc3fe72 100644 --- a/test/test_string_utilities_std.cpp +++ b/test/test_string_utilities_std.cpp @@ -26,6 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include "etl/platform.h" +#if ETL_USING_CPP17 + #include "unit_test_framework.h" #include @@ -1613,3 +1616,5 @@ namespace } }; } + +#endif diff --git a/test/test_string_utilities_std_u16.cpp b/test/test_string_utilities_std_u16.cpp index 2c2205aa..20da6ee4 100644 --- a/test/test_string_utilities_std_u16.cpp +++ b/test/test_string_utilities_std_u16.cpp @@ -26,6 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include "etl/platform.h" +#if ETL_USING_CPP17 + #include "unit_test_framework.h" #include @@ -1588,3 +1591,5 @@ namespace } }; } + +#endif diff --git a/test/test_string_utilities_std_u32.cpp b/test/test_string_utilities_std_u32.cpp index 6a4a6b81..fe0e68fa 100644 --- a/test/test_string_utilities_std_u32.cpp +++ b/test/test_string_utilities_std_u32.cpp @@ -26,6 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include "etl/platform.h" +#if ETL_USING_CPP17 + #include "unit_test_framework.h" #include @@ -1586,3 +1589,5 @@ namespace } }; } + +#endif diff --git a/test/test_string_utilities_std_wchar_t.cpp b/test/test_string_utilities_std_wchar_t.cpp index 7e48e8a6..994a35a7 100644 --- a/test/test_string_utilities_std_wchar_t.cpp +++ b/test/test_string_utilities_std_wchar_t.cpp @@ -26,6 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include "etl/platform.h" +#if ETL_USING_CPP17 + #include "unit_test_framework.h" #include @@ -1586,3 +1589,5 @@ namespace } }; } + +#endif diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index a1add733..82f3a8f0 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -66,12 +66,12 @@ namespace { static const size_t SIZE = 11; - typedef etl::wstring Text; - typedef etl::iwstring IText; - typedef std::wstring Compare_Text; - typedef Text::value_type value_t; - typedef etl::wstring<52> TextL; - typedef etl::wstring<4> TextS; + using Text = etl::wstring; + using IText = etl::iwstring; + using Compare_Text = std::wstring; + using value_t = Text::value_type; + using TextL = etl::wstring<52>; + using TextS = etl::wstring<4>; Compare_Text initial_text; Compare_Text less_text; @@ -596,8 +596,8 @@ namespace { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - - CHECK_EQUAL(&text[0], text.begin()); + + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } @@ -607,7 +607,7 @@ namespace Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } diff --git a/test/test_string_wchar_t_external_buffer.cpp b/test/test_string_wchar_t_external_buffer.cpp index 9d240997..7c092548 100644 --- a/test/test_string_wchar_t_external_buffer.cpp +++ b/test/test_string_wchar_t_external_buffer.cpp @@ -168,12 +168,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer) { - Text text(array_text, std::size(array_text)); + Text text(array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(0U, text.size()); CHECK(text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -183,12 +183,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text) { - Text text(array_text, array_text, std::size(array_text)); + Text text(array_text, array_text, ETL_OR_STD::size(array_text)); CHECK_EQUAL(text.size(), etl::strlen(array_text)); CHECK(!text.empty()); - CHECK_EQUAL(std::size(array_text) - 1, text.capacity()); - CHECK_EQUAL(std::size(array_text) - 1, text.max_size()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.capacity()); + CHECK_EQUAL(ETL_OR_STD::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!text.is_truncated()); @@ -734,8 +734,8 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - - CHECK_EQUAL(&text[0], text.begin()); + + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } @@ -749,7 +749,7 @@ namespace TextBuffer buffer2; const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } diff --git a/test/test_task_scheduler.cpp b/test/test_task_scheduler.cpp index 4e5e95eb..76350e9b 100644 --- a/test/test_task_scheduler.cpp +++ b/test/test_task_scheduler.cpp @@ -181,7 +181,7 @@ namespace common.Clear(); - s.add_task_list(taskList, std::size(taskList)); + s.add_task_list(taskList, ETL_OR_STD::size(taskList)); CHECK(task1.task_added); CHECK(task2.task_added); @@ -204,7 +204,7 @@ namespace s.set_idle_callback(common.idle_callback); s.set_watchdog_callback(common.watchdog_callback); - s.add_task_list(taskList, std::size(taskList)); + s.add_task_list(taskList, ETL_OR_STD::size(taskList)); s.start(); // If 'start' returns then the idle callback was successfully called. WorkList_t expected = { "T3W1", "T2W1", "T1W1", "T3W2", "T2W2", "T1W2", "T3W3", "T2W3", "T1W3", "T2W4" }; @@ -229,7 +229,7 @@ namespace s.set_idle_callback(common.idle_callback); s.set_watchdog_callback(common.watchdog_callback); - s.add_task_list(taskList, std::size(taskList)); + s.add_task_list(taskList, ETL_OR_STD::size(taskList)); s.start(); // If 'start' returns then the idle callback was successfully called. WorkList_t expected = { "T3W1", "T3W2", "T2W1", "T2W2", "T2W3", "T2W4", "T1W1", "T1W2", "T1W3", "T3W3" }; @@ -254,7 +254,7 @@ namespace s.set_idle_callback(common.idle_callback); s.set_watchdog_callback(common.watchdog_callback); - s.add_task_list(taskList, std::size(taskList)); + s.add_task_list(taskList, ETL_OR_STD::size(taskList)); s.start(); // If 'start' returns then the idle callback was successfully called. WorkList_t expected = { "T3W1", "T3W2", "T2W1", "T2W2", "T3W3", "T2W3", "T2W4", "T1W1", "T1W2", "T1W3" }; @@ -279,7 +279,7 @@ namespace s.set_idle_callback(common.idle_callback); s.set_watchdog_callback(common.watchdog_callback); - s.add_task_list(taskList, std::size(taskList)); + s.add_task_list(taskList, ETL_OR_STD::size(taskList)); s.start(); // If 'start' returns then the idle callback was successfully called. WorkList_t expected = { "T2W1", "T2W2", "T1W1", "T3W1", "T2W3", "T3W2", "T1W2", "T3W3", "T2W4", "T1W3" }; diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 4e9c347a..9a587941 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -1190,7 +1190,7 @@ namespace TEST(test_iterator_value_types_bug_584) { using Map = etl::unordered_map; - CHECK((!std::is_same_v)); + CHECK((!std::is_same::value)); } }; } diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index ac339e7d..99c2bae1 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -1026,7 +1026,7 @@ namespace TEST(test_iterator_value_types_bug_584) { using Map = etl::unordered_multimap; - CHECK((!std::is_same_v)); + CHECK((!std::is_same::value)); } TEST(test_parameterized_eq) diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 5c9d6d23..012f5b4f 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -902,7 +902,7 @@ namespace TEST(test_iterator_value_types_bug_584) { using Set = etl::unordered_multiset; - CHECK((!std::is_same_v)); + CHECK((!std::is_same::value)); } TEST(test_parameterized_eq) diff --git a/test/test_unordered_set.cpp b/test/test_unordered_set.cpp index d560585a..8ad22206 100644 --- a/test/test_unordered_set.cpp +++ b/test/test_unordered_set.cpp @@ -861,7 +861,7 @@ namespace TEST(test_iterator_value_types_bug_584) { using Set = etl::unordered_set; - CHECK((!std::is_same_v)); + CHECK((!std::is_same::value)); } }; } diff --git a/test/test_utility.cpp b/test/test_utility.cpp index fcb16bd9..5b42d9d6 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -101,6 +101,7 @@ namespace CHECK_EQUAL(2.3, p1.second); } +#if ETL_USING_CPP17 //************************************************************************* TEST(test_cpp17_deduced_pair_construct) { @@ -112,6 +113,7 @@ namespace CHECK_EQUAL(1, p1.first); CHECK_EQUAL(2.3, p1.second); } +#endif //************************************************************************* TEST(test_pair_move_parameter_construct) @@ -411,7 +413,7 @@ namespace //************************************************************************* TEST(test_functor) { - constexpr etl::functor fw1(TestGlobal); + constexpr etl::functor fw1(TestGlobal); CHECK_EQUAL(2, fw1(1)); } diff --git a/test/test_variant_variadic.cpp b/test/test_variant_variadic.cpp index baee1aa6..305e8f9a 100644 --- a/test/test_variant_variadic.cpp +++ b/test/test_variant_variadic.cpp @@ -32,14 +32,14 @@ SOFTWARE. #include "etl/visitor.h" #include "etl/overload.h" +#if ETL_USING_CPP17 + #include #include #include #include -#include #include - -#if ETL_USING_CPP17 +#include namespace { diff --git a/test/test_vector.cpp b/test/test_vector.cpp index a31e3ea6..aaa46997 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -1380,7 +1380,7 @@ namespace auto data = etl::make_vector(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + CHECK((std::is_same::value)); CHECK_EQUAL(0, data[0]); CHECK_EQUAL(1, data[1]); diff --git a/test/test_vector_pointer_external_buffer.cpp b/test/test_vector_pointer_external_buffer.cpp index 65afe8ea..cfec1877 100644 --- a/test/test_vector_pointer_external_buffer.cpp +++ b/test/test_vector_pointer_external_buffer.cpp @@ -33,6 +33,8 @@ SOFTWARE. #include #include +#include + #include "etl/vector.h" namespace @@ -200,6 +202,7 @@ namespace CHECK(is_equal); } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_excess) { @@ -211,6 +214,7 @@ namespace { CHECK_THROW(CData data(SIZE + 1, buffer1, SIZE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_range) @@ -518,6 +522,7 @@ namespace CHECK(is_equal); } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_excess) { @@ -539,6 +544,7 @@ namespace CHECK_THROW(data.resize(NEW_SIZE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down) @@ -916,6 +922,7 @@ namespace CHECK(is_equal); } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value_excess) { @@ -943,6 +950,7 @@ namespace CHECK_THROW(data.assign(EXCESS_SIZE, &INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back) @@ -990,6 +998,7 @@ namespace CHECK(is_equal); } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back_excess) { @@ -1019,6 +1028,7 @@ namespace CHECK_THROW(data.push_back(&d), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_emplace_back) @@ -1258,6 +1268,7 @@ namespace } } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value_excess) { @@ -1309,6 +1320,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, INSERT_SIZE, &INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range) @@ -1356,6 +1368,7 @@ namespace } } +#include "etl/private/diagnostic_array_bounds_push.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_excess) { @@ -1405,6 +1418,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, initial_data.begin(), initial_data.end()), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_single) diff --git a/test/vs2022/etl.sln b/test/vs2022/etl.sln index 75fa0503..ce2d8dcb 100644 --- a/test/vs2022/etl.sln +++ b/test/vs2022/etl.sln @@ -7,38 +7,42 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "etl", "etl.vcxproj", "{C21D EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug Intel - No STL|Win32 = Debug Intel - No STL|Win32 - Debug Intel - No STL|x64 = Debug Intel - No STL|x64 - Debug Intel|Win32 = Debug Intel|Win32 - Debug Intel|x64 = Debug Intel|x64 - Debug LLVM - No STL - Force Built-ins|Win32 = Debug LLVM - No STL - Force Built-ins|Win32 - Debug LLVM - No STL - Force Built-ins|x64 = Debug LLVM - No STL - Force Built-ins|x64 - Debug LLVM - No STL|Win32 = Debug LLVM - No STL|Win32 - Debug LLVM - No STL|x64 = Debug LLVM - No STL|x64 - Debug LLVM|Win32 = Debug LLVM|Win32 - Debug LLVM|x64 = Debug LLVM|x64 - Debug MSVC - Force C++03|Win32 = Debug MSVC - Force C++03|Win32 - Debug MSVC - Force C++03|x64 = Debug MSVC - Force C++03|x64 - Debug MSVC - No STL - Auto Built-ins|Win32 = Debug MSVC - No STL - Auto Built-ins|Win32 - Debug MSVC - No STL - Auto Built-ins|x64 = Debug MSVC - No STL - Auto Built-ins|x64 - Debug MSVC - No STL - Force Built-ins|Win32 = Debug MSVC - No STL - Force Built-ins|Win32 - Debug MSVC - No STL - Force Built-ins|x64 = Debug MSVC - No STL - Force Built-ins|x64 - Debug MSVC - No STL|Win32 = Debug MSVC - No STL|Win32 - Debug MSVC - No STL|x64 = Debug MSVC - No STL|x64 - Debug MSVC - No Tests|Win32 = Debug MSVC - No Tests|Win32 - Debug MSVC - No Tests|x64 = Debug MSVC - No Tests|x64 - Debug MSVC - Small Strings|Win32 = Debug MSVC - Small Strings|Win32 - Debug MSVC - Small Strings|x64 = Debug MSVC - Small Strings|x64 - Debug MSVC - String Truncation Is Error|Win32 = Debug MSVC - String Truncation Is Error|Win32 - Debug MSVC - String Truncation Is Error|x64 = Debug MSVC - String Truncation Is Error|x64 - Debug MSVC 64|Win32 = Debug MSVC 64|Win32 - Debug MSVC 64|x64 = Debug MSVC 64|x64 + Debug Intel C++17 - No STL|Win32 = Debug Intel C++17 - No STL|Win32 + Debug Intel C++17 - No STL|x64 = Debug Intel C++17 - No STL|x64 + Debug Intel C++17|Win32 = Debug Intel C++17|Win32 + Debug Intel C++17|x64 = Debug Intel C++17|x64 + Debug LLVM C++17 - No STL - Force Built-ins|Win32 = Debug LLVM C++17 - No STL - Force Built-ins|Win32 + Debug LLVM C++17 - No STL - Force Built-ins|x64 = Debug LLVM C++17 - No STL - Force Built-ins|x64 + Debug LLVM C++17 - No STL|Win32 = Debug LLVM C++17 - No STL|Win32 + Debug LLVM C++17 - No STL|x64 = Debug LLVM C++17 - No STL|x64 + Debug LLVM C++17|Win32 = Debug LLVM C++17|Win32 + Debug LLVM C++17|x64 = Debug LLVM C++17|x64 + Debug MSVC C++14 - No STL|Win32 = Debug MSVC C++14 - No STL|Win32 + Debug MSVC C++14 - No STL|x64 = Debug MSVC C++14 - No STL|x64 + Debug MSVC C++14|Win32 = Debug MSVC C++14|Win32 + Debug MSVC C++14|x64 = Debug MSVC C++14|x64 + Debug MSVC C++17 - 64|Win32 = Debug MSVC C++17 - 64|Win32 + Debug MSVC C++17 - 64|x64 = Debug MSVC C++17 - 64|x64 + Debug MSVC C++17 - Force C++03|Win32 = Debug MSVC C++17 - Force C++03|Win32 + Debug MSVC C++17 - Force C++03|x64 = Debug MSVC C++17 - Force C++03|x64 + Debug MSVC C++17 - No STL - Auto Built-ins|Win32 = Debug MSVC C++17 - No STL - Auto Built-ins|Win32 + Debug MSVC C++17 - No STL - Auto Built-ins|x64 = Debug MSVC C++17 - No STL - Auto Built-ins|x64 + Debug MSVC C++17 - No STL - Force Built-ins|Win32 = Debug MSVC C++17 - No STL - Force Built-ins|Win32 + Debug MSVC C++17 - No STL - Force Built-ins|x64 = Debug MSVC C++17 - No STL - Force Built-ins|x64 + Debug MSVC C++17 - No STL|Win32 = Debug MSVC C++17 - No STL|Win32 + Debug MSVC C++17 - No STL|x64 = Debug MSVC C++17 - No STL|x64 + Debug MSVC C++17 - No Tests|Win32 = Debug MSVC C++17 - No Tests|Win32 + Debug MSVC C++17 - No Tests|x64 = Debug MSVC C++17 - No Tests|x64 + Debug MSVC C++17 - Small Strings|Win32 = Debug MSVC C++17 - Small Strings|Win32 + Debug MSVC C++17 - Small Strings|x64 = Debug MSVC C++17 - Small Strings|x64 + Debug MSVC C++17 - String Truncation Is Error|Win32 = Debug MSVC C++17 - String Truncation Is Error|Win32 + Debug MSVC C++17 - String Truncation Is Error|x64 = Debug MSVC C++17 - String Truncation Is Error|x64 + Debug MSVC C++17|Win32 = Debug MSVC C++17|Win32 + Debug MSVC C++17|x64 = Debug MSVC C++17|x64 Debug MSVC C++20 - No STL|Win32 = Debug MSVC C++20 - No STL|Win32 Debug MSVC C++20 - No STL|x64 = Debug MSVC C++20 - No STL|x64 Debug MSVC C++20|Win32 = Debug MSVC C++20|Win32 Debug MSVC C++20|x64 = Debug MSVC C++20|x64 - Debug MSVC|Win32 = Debug MSVC|Win32 - Debug MSVC|x64 = Debug MSVC|x64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 MSVC Debug Appveyor|Win32 = MSVC Debug Appveyor|Win32 @@ -49,58 +53,70 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel - No STL|Win32.ActiveCfg = Debug Intel - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel - No STL|Win32.Build.0 = Debug Intel - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel - No STL|x64.ActiveCfg = Debug Intel - No STL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel - No STL|x64.Build.0 = Debug Intel - No STL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel|Win32.ActiveCfg = Debug Intel|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel|Win32.Build.0 = Debug Intel|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel|x64.ActiveCfg = Debug Intel|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel|x64.Build.0 = Debug Intel|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL - Force Built-ins|Win32.ActiveCfg = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL - Force Built-ins|Win32.Build.0 = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL - Force Built-ins|x64.ActiveCfg = Test2|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL - Force Built-ins|x64.Build.0 = Test2|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|Win32.ActiveCfg = Debug LLVM - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|Win32.Build.0 = Debug LLVM - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|x64.ActiveCfg = DebugLLVMNoSTL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|x64.Build.0 = DebugLLVMNoSTL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|Win32.ActiveCfg = Debug LLVM|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|Win32.Build.0 = Debug LLVM|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.ActiveCfg = Debug LLVM|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.Build.0 = Debug LLVM|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Force C++03|Win32.ActiveCfg = Debug MSVC - Force C++03|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Force C++03|Win32.Build.0 = Debug MSVC - Force C++03|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Force C++03|x64.ActiveCfg = Debug MSVC - Force C++03|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Force C++03|x64.Build.0 = Debug MSVC - Force C++03|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Auto Built-ins|Win32.ActiveCfg = Debug MSVC - No STL - Built-ins|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Auto Built-ins|Win32.Build.0 = Debug MSVC - No STL - Built-ins|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Auto Built-ins|x64.ActiveCfg = Test1|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Auto Built-ins|x64.Build.0 = Test1|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force Built-ins|Win32.ActiveCfg = Debug MSVC - No STL - Force Built-ins|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force Built-ins|Win32.Build.0 = Debug MSVC - No STL - Force Built-ins|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force Built-ins|x64.ActiveCfg = Debug MSVC - No STL - Force Built-ins|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force Built-ins|x64.Build.0 = Debug MSVC - No STL - Force Built-ins|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|Win32.ActiveCfg = Debug - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|Win32.Build.0 = Debug - No STL|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|x64.ActiveCfg = DebugNoSTL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|x64.Build.0 = DebugNoSTL|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Tests|Win32.ActiveCfg = Debug MSVC - No Tests|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Tests|Win32.Build.0 = Debug MSVC - No Tests|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Tests|x64.ActiveCfg = Debug MSVC - No Tests|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Tests|x64.Build.0 = Debug MSVC - No Tests|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|Win32.ActiveCfg = DebugMSVCSmallStrings|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|Win32.Build.0 = DebugMSVCSmallStrings|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|x64.ActiveCfg = DebugMSVCSmallStrings|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|x64.Build.0 = DebugMSVCSmallStrings|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|Win32.ActiveCfg = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|Win32.Build.0 = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|x64.ActiveCfg = DebugStringTruncationIsError|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|x64.Build.0 = DebugStringTruncationIsError|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.ActiveCfg = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.Build.0 = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.ActiveCfg = Debug64|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.Build.0 = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17 - No STL|Win32.ActiveCfg = Debug Intel - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17 - No STL|Win32.Build.0 = Debug Intel - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17 - No STL|x64.ActiveCfg = Debug Intel - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17 - No STL|x64.Build.0 = Debug Intel - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17|Win32.ActiveCfg = Debug Intel|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17|Win32.Build.0 = Debug Intel|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17|x64.ActiveCfg = Debug Intel|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Intel C++17|x64.Build.0 = Debug Intel|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL - Force Built-ins|Win32.ActiveCfg = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL - Force Built-ins|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL - Force Built-ins|x64.ActiveCfg = Test2|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL - Force Built-ins|x64.Build.0 = Test2|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL|Win32.ActiveCfg = Debug LLVM - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL|Win32.Build.0 = Debug LLVM - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL|x64.ActiveCfg = DebugLLVMNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17 - No STL|x64.Build.0 = DebugLLVMNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17|Win32.ActiveCfg = Debug LLVM|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17|Win32.Build.0 = Debug LLVM|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17|x64.ActiveCfg = Debug LLVM|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM C++17|x64.Build.0 = Debug LLVM|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|Win32.ActiveCfg = Debug MSVC C++14 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|Win32.Build.0 = Debug MSVC C++14 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|x64.ActiveCfg = Debug MSVC C++14 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14 - No STL|x64.Build.0 = Debug MSVC C++14 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|Win32.ActiveCfg = Debug MSVC C++14|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|Win32.Build.0 = Debug MSVC C++14|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|x64.ActiveCfg = Debug MSVC C++14|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++14|x64.Build.0 = Debug MSVC C++14|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - 64|Win32.ActiveCfg = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - 64|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - 64|x64.ActiveCfg = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - 64|x64.Build.0 = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Force C++03|Win32.ActiveCfg = Debug MSVC - Force C++03|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Force C++03|Win32.Build.0 = Debug MSVC - Force C++03|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Force C++03|x64.ActiveCfg = Debug MSVC - Force C++03|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Force C++03|x64.Build.0 = Debug MSVC - Force C++03|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Auto Built-ins|Win32.ActiveCfg = Debug MSVC - No STL - Built-ins|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Auto Built-ins|Win32.Build.0 = Debug MSVC - No STL - Built-ins|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Auto Built-ins|x64.ActiveCfg = Test1|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Auto Built-ins|x64.Build.0 = Test1|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Force Built-ins|Win32.ActiveCfg = Debug MSVC - No STL - Force Built-ins|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Force Built-ins|Win32.Build.0 = Debug MSVC - No STL - Force Built-ins|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Force Built-ins|x64.ActiveCfg = Debug MSVC - No STL - Force Built-ins|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL - Force Built-ins|x64.Build.0 = Debug MSVC - No STL - Force Built-ins|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL|Win32.ActiveCfg = Debug - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL|Win32.Build.0 = Debug - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL|x64.ActiveCfg = DebugNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No STL|x64.Build.0 = DebugNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No Tests|Win32.ActiveCfg = Debug MSVC - No Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No Tests|Win32.Build.0 = Debug MSVC - No Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No Tests|x64.ActiveCfg = Debug MSVC - No Tests|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - No Tests|x64.Build.0 = Debug MSVC - No Tests|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Small Strings|Win32.ActiveCfg = DebugMSVCSmallStrings|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Small Strings|Win32.Build.0 = DebugMSVCSmallStrings|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Small Strings|x64.ActiveCfg = DebugMSVCSmallStrings|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - Small Strings|x64.Build.0 = DebugMSVCSmallStrings|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - String Truncation Is Error|Win32.ActiveCfg = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - String Truncation Is Error|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - String Truncation Is Error|x64.ActiveCfg = DebugStringTruncationIsError|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17 - String Truncation Is Error|x64.Build.0 = DebugStringTruncationIsError|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17|Win32.ActiveCfg = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17|x64.ActiveCfg = Debug|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++17|x64.Build.0 = Debug|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.ActiveCfg = Debug MSVC C++20 - No STL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.Build.0 = Debug MSVC C++20 - No STL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.ActiveCfg = Debug MSVC C++20 - No STL|x64 @@ -109,10 +125,6 @@ Global {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|Win32.Build.0 = Debug MSVC C++20|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|x64.ActiveCfg = Debug MSVC C++20|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|x64.Build.0 = Debug MSVC C++20|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|Win32.ActiveCfg = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|Win32.Build.0 = Debug|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|x64.ActiveCfg = Debug|x64 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|x64.Build.0 = Debug|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|Win32.ActiveCfg = Debug|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|Win32.Build.0 = Debug|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/test/vs2022/etl.vcxproj b/test/vs2022/etl.vcxproj index 4674ea2d..7db39d34 100644 --- a/test/vs2022/etl.vcxproj +++ b/test/vs2022/etl.vcxproj @@ -113,6 +113,22 @@ Debug MSVC - No Checks x64 + + Debug MSVC C++14 - No STL + Win32 + + + Debug MSVC C++14 - No STL + x64 + + + Debug MSVC C++14 + Win32 + + + Debug MSVC C++14 + x64 + Debug MSVC C++20 - No STL Win32 @@ -261,6 +277,13 @@ Unicode true + + Application + true + v143 + Unicode + true + Application true @@ -319,6 +342,13 @@ Unicode true + + Application + true + v143 + Unicode + true + Application true @@ -436,6 +466,12 @@ v143 Unicode + + Application + true + v143 + Unicode + Application true @@ -490,6 +526,12 @@ v143 Unicode + + Application + true + v143 + Unicode + Application true @@ -630,6 +672,9 @@ + + + @@ -657,6 +702,9 @@ + + + @@ -711,6 +759,9 @@ + + + @@ -738,6 +789,9 @@ + + + @@ -821,6 +875,11 @@ true $(Configuration)\ + + false + true + $(Configuration)\ + false true @@ -867,6 +926,11 @@ true $(Configuration)\ + + false + true + $(Configuration)\ + false true @@ -957,6 +1021,10 @@ true true + + true + true + true true @@ -993,6 +1061,10 @@ true true + + true + true + true true @@ -1183,7 +1255,31 @@ true stdcpp20 - EditAndContinue + ProgramDatabase + /Zc:__cplusplus %(AdditionalOptions) + true + + + Console + true + + + "$(OutDir)\etl.exe" + + + + + + + Level2 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp14 + ProgramDatabase /Zc:__cplusplus %(AdditionalOptions) true @@ -1404,6 +1500,30 @@ "$(OutDir)etl.exe" + + + + + Level2 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions) + ./;../../../unittest-cpp/;../../include;../../test + + + true + stdcpp14 + ProgramDatabase + /Zc:__cplusplus %(AdditionalOptions) + true + + + Console + true + + + "$(OutDir)etl.exe" + + @@ -1849,6 +1969,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -2038,6 +2179,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -2779,8 +2941,10 @@ true true true + true true true + true true true true @@ -2808,8 +2972,10 @@ true true true + true true true + true true true true @@ -2837,9 +3003,11 @@ true true true + true true true true + true true true true @@ -2866,8 +3034,10 @@ true true true + true true true + true true true true @@ -2940,8 +3110,10 @@ true true true + true true true + true true true true @@ -2969,8 +3141,10 @@ true true true + true true true + true true true true @@ -2998,9 +3172,11 @@ true true true + true true true true + true true true true @@ -3027,8 +3203,10 @@ true true true + true true true + true true true true @@ -3059,8 +3237,10 @@ true true true + true true true + true true true true @@ -3096,6 +3276,7 @@ true true true + true true true true @@ -3105,6 +3286,7 @@ true true true + true true true true @@ -3130,6 +3312,7 @@ true true true + true true true true @@ -3139,6 +3322,7 @@ true true true + true true true true @@ -3164,6 +3348,7 @@ true true true + true true true true @@ -3173,6 +3358,7 @@ true true true + true true true true @@ -3198,6 +3384,7 @@ true true true + true true true true @@ -3207,6 +3394,7 @@ true true true + true true true true @@ -3232,6 +3420,7 @@ true true true + true true true true @@ -3241,6 +3430,7 @@ true true true + true true true true @@ -3266,6 +3456,7 @@ true true true + true true true true @@ -3275,6 +3466,7 @@ true true true + true true true true @@ -3300,6 +3492,7 @@ true true true + true true true true @@ -3309,6 +3502,7 @@ true true true + true true true true @@ -3334,6 +3528,7 @@ true true true + true true true true @@ -3343,6 +3538,7 @@ true true true + true true true true @@ -3368,6 +3564,7 @@ true true true + true true true true @@ -3377,6 +3574,7 @@ true true true + true true true true @@ -3402,6 +3600,7 @@ true true true + true true true true @@ -3411,6 +3610,7 @@ true true true + true true true true @@ -3430,6 +3630,7 @@ true true true + true true true true @@ -3445,6 +3646,7 @@ true true true + true true true true @@ -3464,7 +3666,9 @@ true true true + true true + true true true true @@ -3499,6 +3703,7 @@ true true true + true true true true @@ -3508,6 +3713,7 @@ true true true + true true true true @@ -3523,10 +3729,12 @@ true + true true true true true + true true true true @@ -3562,6 +3770,7 @@ true true true + true true true true @@ -3571,6 +3780,7 @@ true true true + true true true true @@ -3596,6 +3806,7 @@ true true true + true true true true @@ -3605,6 +3816,7 @@ true true true + true true true true @@ -3630,6 +3842,7 @@ true true true + true true true true @@ -3639,6 +3852,7 @@ true true true + true true true true @@ -3664,6 +3878,7 @@ true true true + true true true true @@ -3673,6 +3888,7 @@ true true true + true true true true @@ -3690,8 +3906,10 @@ true true true + true true true + true true true true @@ -3722,9 +3940,11 @@ true true true + true true true true + true true true true @@ -3758,6 +3978,7 @@ true true true + true true true true @@ -3767,6 +3988,7 @@ true true true + true true true true @@ -3792,6 +4014,7 @@ true true true + true true true true @@ -3801,6 +4024,7 @@ true true true + true true true true @@ -3826,6 +4050,7 @@ true true true + true true true true @@ -3835,6 +4060,7 @@ true true true + true true true true @@ -3854,9 +4080,11 @@ true true true + true true true true + true true true true @@ -3882,8 +4110,10 @@ true true true + true true true + true true true true @@ -3912,8 +4142,10 @@ true true true + true true true + true true true true @@ -3950,6 +4182,7 @@ true true true + true true true true @@ -3959,6 +4192,7 @@ true true true + true true true true @@ -3984,6 +4218,7 @@ true true true + true true true true @@ -3993,6 +4228,7 @@ true true true + true true true true @@ -4018,6 +4254,7 @@ true true true + true true true true @@ -4027,6 +4264,7 @@ true true true + true true true true @@ -4044,8 +4282,10 @@ true true true + true true true + true true true true @@ -4081,6 +4321,7 @@ true true true + true true true true @@ -4090,6 +4331,7 @@ true true true + true true true true @@ -4115,6 +4357,7 @@ true true true + true true true true @@ -4124,6 +4367,7 @@ true true true + true true true true @@ -4149,6 +4393,7 @@ true true true + true true true true @@ -4158,6 +4403,7 @@ true true true + true true true true @@ -4183,6 +4429,7 @@ true true true + true true true true @@ -4192,6 +4439,7 @@ true true true + true true true true @@ -4217,6 +4465,7 @@ true true true + true true true true @@ -4226,6 +4475,7 @@ true true true + true true true true @@ -4251,6 +4501,7 @@ true true true + true true true true @@ -4260,6 +4511,7 @@ true true true + true true true true @@ -4285,6 +4537,7 @@ true true true + true true true true @@ -4294,6 +4547,7 @@ true true true + true true true true @@ -4319,6 +4573,7 @@ true true true + true true true true @@ -4328,6 +4583,7 @@ true true true + true true true true @@ -4353,6 +4609,7 @@ true true true + true true true true @@ -4362,6 +4619,7 @@ true true true + true true true true @@ -4387,6 +4645,7 @@ true true true + true true true true @@ -4396,6 +4655,7 @@ true true true + true true true true @@ -4421,6 +4681,7 @@ true true true + true true true true @@ -4430,6 +4691,7 @@ true true true + true true true true @@ -4455,6 +4717,7 @@ true true true + true true true true @@ -4464,6 +4727,7 @@ true true true + true true true true @@ -4489,6 +4753,7 @@ true true true + true true true true @@ -4498,6 +4763,7 @@ true true true + true true true true @@ -4523,6 +4789,7 @@ true true true + true true true true @@ -4532,6 +4799,7 @@ true true true + true true true true @@ -4557,6 +4825,7 @@ true true true + true true true true @@ -4566,6 +4835,7 @@ true true true + true true true true @@ -4591,6 +4861,7 @@ true true true + true true true true @@ -4600,6 +4871,7 @@ true true true + true true true true @@ -4625,6 +4897,7 @@ true true true + true true true true @@ -4634,6 +4907,7 @@ true true true + true true true true @@ -4659,6 +4933,7 @@ true true true + true true true true @@ -4668,6 +4943,7 @@ true true true + true true true true @@ -4693,6 +4969,7 @@ true true true + true true true true @@ -4702,6 +4979,7 @@ true true true + true true true true @@ -4727,6 +5005,7 @@ true true true + true true true true @@ -4736,6 +5015,7 @@ true true true + true true true true @@ -4753,8 +5033,10 @@ true true true + true true true + true true true true @@ -4789,6 +5071,7 @@ true true true + true true true true @@ -4798,6 +5081,7 @@ true true true + true true true true @@ -4823,6 +5107,7 @@ true true true + true true true true @@ -4832,6 +5117,7 @@ true true true + true true true true @@ -4857,6 +5143,7 @@ true true true + true true true true @@ -4866,6 +5153,7 @@ true true true + true true true true @@ -4891,6 +5179,7 @@ true true true + true true true true @@ -4900,6 +5189,7 @@ true true true + true true true true @@ -4925,6 +5215,7 @@ true true true + true true true true @@ -4934,6 +5225,7 @@ true true true + true true true true @@ -4959,6 +5251,7 @@ true true true + true true true true @@ -4968,6 +5261,7 @@ true true true + true true true true @@ -4993,6 +5287,7 @@ true true true + true true true true @@ -5002,6 +5297,7 @@ true true true + true true true true @@ -5027,6 +5323,7 @@ true true true + true true true true @@ -5036,6 +5333,7 @@ true true true + true true true true @@ -5061,6 +5359,7 @@ true true true + true true true true @@ -5070,6 +5369,7 @@ true true true + true true true true @@ -5095,6 +5395,7 @@ true true true + true true true true @@ -5104,6 +5405,7 @@ true true true + true true true true @@ -5129,6 +5431,7 @@ true true true + true true true true @@ -5138,6 +5441,7 @@ true true true + true true true true @@ -5163,6 +5467,7 @@ true true true + true true true true @@ -5172,6 +5477,7 @@ true true true + true true true true @@ -5197,6 +5503,7 @@ true true true + true true true true @@ -5206,6 +5513,7 @@ true true true + true true true true @@ -5231,6 +5539,7 @@ true true true + true true true true @@ -5240,6 +5549,7 @@ true true true + true true true true @@ -5265,6 +5575,7 @@ true true true + true true true true @@ -5274,6 +5585,7 @@ true true true + true true true true @@ -5299,6 +5611,7 @@ true true true + true true true true @@ -5308,6 +5621,7 @@ true true true + true true true true @@ -5333,6 +5647,7 @@ true true true + true true true true @@ -5342,6 +5657,7 @@ true true true + true true true true @@ -5367,6 +5683,7 @@ true true true + true true true true @@ -5376,6 +5693,7 @@ true true true + true true true true @@ -5401,6 +5719,7 @@ true true true + true true true true @@ -5410,6 +5729,7 @@ true true true + true true true true @@ -5435,6 +5755,7 @@ true true true + true true true true @@ -5444,6 +5765,7 @@ true true true + true true true true @@ -5469,6 +5791,7 @@ true true true + true true true true @@ -5478,6 +5801,7 @@ true true true + true true true true @@ -5503,6 +5827,7 @@ true true true + true true true true @@ -5512,6 +5837,7 @@ true true true + true true true true @@ -5537,6 +5863,7 @@ true true true + true true true true @@ -5546,6 +5873,7 @@ true true true + true true true true @@ -5571,6 +5899,7 @@ true true true + true true true true @@ -5580,6 +5909,7 @@ true true true + true true true true @@ -5605,6 +5935,7 @@ true true true + true true true true @@ -5614,6 +5945,7 @@ true true true + true true true true @@ -5639,6 +5971,7 @@ true true true + true true true true @@ -5648,6 +5981,7 @@ true true true + true true true true @@ -5673,6 +6007,7 @@ true true true + true true true true @@ -5682,6 +6017,7 @@ true true true + true true true true @@ -5707,6 +6043,7 @@ true true true + true true true true @@ -5716,6 +6053,7 @@ true true true + true true true true @@ -5741,6 +6079,7 @@ true true true + true true true true @@ -5750,6 +6089,7 @@ true true true + true true true true @@ -5775,6 +6115,7 @@ true true true + true true true true @@ -5784,6 +6125,7 @@ true true true + true true true true @@ -5809,6 +6151,7 @@ true true true + true true true true @@ -5818,6 +6161,7 @@ true true true + true true true true @@ -5835,8 +6179,10 @@ true true true + true true true + true true true true @@ -5863,8 +6209,10 @@ true true true + true true true + true true true true @@ -5892,8 +6240,10 @@ true true true + true true true + true true true true @@ -5929,6 +6279,7 @@ true true true + true true true true @@ -5938,6 +6289,7 @@ true true true + true true true true @@ -5963,6 +6315,7 @@ true true true + true true true true @@ -5972,6 +6325,7 @@ true true true + true true true true @@ -5997,6 +6351,7 @@ true true true + true true true true @@ -6006,6 +6361,7 @@ true true true + true true true true @@ -6031,6 +6387,7 @@ true true true + true true true true @@ -6040,6 +6397,7 @@ true true true + true true true true @@ -6065,6 +6423,7 @@ true true true + true true true true @@ -6074,6 +6433,7 @@ true true true + true true true true @@ -6091,8 +6451,10 @@ true true true + true true true + true true true true @@ -6118,8 +6480,10 @@ true true true + true true true + true true true true @@ -6155,6 +6519,7 @@ true true true + true true true true @@ -6164,6 +6529,7 @@ true true true + true true true true @@ -6189,6 +6555,7 @@ true true true + true true true true @@ -6198,6 +6565,7 @@ true true true + true true true true @@ -6223,6 +6591,7 @@ true true true + true true true true @@ -6232,6 +6601,7 @@ true true true + true true true true @@ -6257,6 +6627,7 @@ true true true + true true true true @@ -6266,6 +6637,7 @@ true true true + true true true true @@ -6291,6 +6663,7 @@ true true true + true true true true @@ -6300,6 +6673,7 @@ true true true + true true true true @@ -6325,6 +6699,7 @@ true true true + true true true true @@ -6334,6 +6709,7 @@ true true true + true true true true @@ -6359,6 +6735,7 @@ true true true + true true true true @@ -6368,6 +6745,7 @@ true true true + true true true true @@ -6393,6 +6771,7 @@ true true true + true true true true @@ -6402,6 +6781,7 @@ true true true + true true true true @@ -6427,6 +6807,7 @@ true true true + true true true true @@ -6436,6 +6817,7 @@ true true true + true true true true @@ -6461,6 +6843,7 @@ true true true + true true true true @@ -6470,6 +6853,7 @@ true true true + true true true true @@ -6495,6 +6879,7 @@ true true true + true true true true @@ -6504,6 +6889,7 @@ true true true + true true true true @@ -6529,6 +6915,7 @@ true true true + true true true true @@ -6538,6 +6925,7 @@ true true true + true true true true @@ -6563,6 +6951,7 @@ true true true + true true true true @@ -6572,6 +6961,7 @@ true true true + true true true true @@ -6597,6 +6987,7 @@ true true true + true true true true @@ -6606,6 +6997,7 @@ true true true + true true true true @@ -6631,6 +7023,7 @@ true true true + true true true true @@ -6640,6 +7033,7 @@ true true true + true true true true @@ -6665,6 +7059,7 @@ true true true + true true true true @@ -6674,6 +7069,7 @@ true true true + true true true true @@ -6699,6 +7095,7 @@ true true true + true true true true @@ -6708,6 +7105,7 @@ true true true + true true true true @@ -6733,6 +7131,7 @@ true true true + true true true true @@ -6742,6 +7141,7 @@ true true true + true true true true @@ -6767,6 +7167,7 @@ true true true + true true true true @@ -6776,6 +7177,7 @@ true true true + true true true true @@ -6801,6 +7203,7 @@ true true true + true true true true @@ -6810,6 +7213,7 @@ true true true + true true true true @@ -6835,6 +7239,7 @@ true true true + true true true true @@ -6844,6 +7249,7 @@ true true true + true true true true @@ -6869,6 +7275,7 @@ true true true + true true true true @@ -6878,6 +7285,7 @@ true true true + true true true true @@ -6903,6 +7311,7 @@ true true true + true true true true @@ -6912,6 +7321,7 @@ true true true + true true true true @@ -6937,6 +7347,7 @@ true true true + true true true true @@ -6946,6 +7357,7 @@ true true true + true true true true @@ -6971,6 +7383,7 @@ true true true + true true true true @@ -6980,6 +7393,7 @@ true true true + true true true true @@ -7005,6 +7419,7 @@ true true true + true true true true @@ -7014,6 +7429,7 @@ true true true + true true true true @@ -7039,6 +7455,7 @@ true true true + true true true true @@ -7048,6 +7465,7 @@ true true true + true true true true @@ -7073,6 +7491,7 @@ true true true + true true true true @@ -7082,6 +7501,7 @@ true true true + true true true true @@ -7107,6 +7527,7 @@ true true true + true true true true @@ -7116,6 +7537,7 @@ true true true + true true true true @@ -7141,6 +7563,7 @@ true true true + true true true true @@ -7150,6 +7573,7 @@ true true true + true true true true @@ -7169,8 +7593,10 @@ true true true + true true true + true true true true @@ -7205,6 +7631,7 @@ true true true + true true true true @@ -7214,6 +7641,7 @@ true true true + true true true true @@ -7239,6 +7667,7 @@ true true true + true true true true @@ -7248,6 +7677,7 @@ true true true + true true true true @@ -7273,6 +7703,7 @@ true true true + true true true true @@ -7282,6 +7713,7 @@ true true true + true true true true @@ -7307,6 +7739,7 @@ true true true + true true true true @@ -7316,6 +7749,7 @@ true true true + true true true true @@ -7341,6 +7775,7 @@ true true true + true true true true @@ -7350,6 +7785,7 @@ true true true + true true true true @@ -7375,6 +7811,7 @@ true true true + true true true true @@ -7384,6 +7821,7 @@ true true true + true true true true @@ -7409,6 +7847,7 @@ true true true + true true true true @@ -7418,6 +7857,7 @@ true true true + true true true true @@ -7443,6 +7883,7 @@ true true true + true true true true @@ -7452,6 +7893,7 @@ true true true + true true true true @@ -7477,6 +7919,7 @@ true true true + true true true true @@ -7486,6 +7929,7 @@ true true true + true true true true @@ -7511,6 +7955,7 @@ true true true + true true true true @@ -7520,6 +7965,7 @@ true true true + true true true true @@ -7545,6 +7991,7 @@ true true true + true true true true @@ -7554,6 +8001,7 @@ true true true + true true true true @@ -7579,6 +8027,7 @@ true true true + true true true true @@ -7588,6 +8037,7 @@ true true true + true true true true @@ -7613,6 +8063,7 @@ true true true + true true true true @@ -7622,6 +8073,7 @@ true true true + true true true true @@ -7647,6 +8099,7 @@ true true true + true true true true @@ -7656,6 +8109,7 @@ true true true + true true true true @@ -7681,6 +8135,7 @@ true true true + true true true true @@ -7690,6 +8145,7 @@ true true true + true true true true @@ -7715,6 +8171,7 @@ true true true + true true true true @@ -7724,6 +8181,7 @@ true true true + true true true true @@ -7749,6 +8207,7 @@ true true true + true true true true @@ -7758,6 +8217,7 @@ true true true + true true true true @@ -7783,6 +8243,7 @@ true true true + true true true true @@ -7792,6 +8253,7 @@ true true true + true true true true @@ -7817,6 +8279,7 @@ true true true + true true true true @@ -7826,6 +8289,7 @@ true true true + true true true true @@ -7851,6 +8315,7 @@ true true true + true true true true @@ -7860,6 +8325,7 @@ true true true + true true true true @@ -7885,6 +8351,7 @@ true true true + true true true true @@ -7894,6 +8361,7 @@ true true true + true true true true @@ -7919,6 +8387,7 @@ true true true + true true true true @@ -7928,6 +8397,7 @@ true true true + true true true true @@ -7953,6 +8423,7 @@ true true true + true true true true @@ -7962,6 +8433,7 @@ true true true + true true true true @@ -7987,6 +8459,7 @@ true true true + true true true true @@ -7996,6 +8469,7 @@ true true true + true true true true @@ -8021,6 +8495,7 @@ true true true + true true true true @@ -8030,6 +8505,7 @@ true true true + true true true true @@ -8055,6 +8531,7 @@ true true true + true true true true @@ -8064,6 +8541,7 @@ true true true + true true true true @@ -8089,6 +8567,7 @@ true true true + true true true true @@ -8098,6 +8577,7 @@ true true true + true true true true @@ -8123,6 +8603,7 @@ true true true + true true true true @@ -8132,6 +8613,7 @@ true true true + true true true true @@ -8157,6 +8639,7 @@ true true true + true true true true @@ -8166,6 +8649,7 @@ true true true + true true true true @@ -8191,6 +8675,7 @@ true true true + true true true true @@ -8200,6 +8685,7 @@ true true true + true true true true @@ -8225,6 +8711,7 @@ true true true + true true true true @@ -8234,6 +8721,7 @@ true true true + true true true true @@ -8253,9 +8741,11 @@ true true true + true true true true + true true true true @@ -8281,8 +8771,10 @@ true true true + true true true + true true true true @@ -8311,8 +8803,10 @@ true true true + true true true + true true true true @@ -8349,6 +8843,7 @@ true true true + true true true true @@ -8358,6 +8853,7 @@ true true true + true true true true @@ -8383,6 +8879,7 @@ true true true + true true true true @@ -8392,6 +8889,7 @@ true true true + true true true true @@ -8417,6 +8915,7 @@ true true true + true true true true @@ -8426,6 +8925,7 @@ true true true + true true true true @@ -8451,6 +8951,7 @@ true true true + true true true true @@ -8460,6 +8961,7 @@ true true true + true true true true @@ -8485,6 +8987,7 @@ true true true + true true true true @@ -8494,6 +8997,7 @@ true true true + true true true true @@ -8513,9 +9017,11 @@ true true true + true true true true + true true true true @@ -8543,9 +9049,11 @@ true true true + true true true true + true true true true @@ -8579,6 +9087,7 @@ true true true + true true true true @@ -8588,6 +9097,7 @@ true true true + true true true true @@ -8613,6 +9123,7 @@ true true true + true true true true @@ -8622,6 +9133,7 @@ true true true + true true true true @@ -8647,6 +9159,7 @@ true true true + true true true true @@ -8656,6 +9169,7 @@ true true true + true true true true @@ -8675,9 +9189,11 @@ true true true + true true true true + true true true true @@ -8711,6 +9227,7 @@ true true true + true true true true @@ -8720,6 +9237,7 @@ true true true + true true true true @@ -8745,6 +9263,7 @@ true true true + true true true true @@ -8754,6 +9273,7 @@ true true true + true true true true @@ -8779,6 +9299,7 @@ true true true + true true true true @@ -8788,6 +9309,7 @@ true true true + true true true true @@ -8813,6 +9335,7 @@ true true true + true true true true @@ -8822,6 +9345,7 @@ true true true + true true true true @@ -8847,6 +9371,7 @@ true true true + true true true true @@ -8856,6 +9381,7 @@ true true true + true true true true @@ -8881,6 +9407,7 @@ true true true + true true true true @@ -8890,6 +9417,7 @@ true true true + true true true true @@ -8915,6 +9443,7 @@ true true true + true true true true @@ -8924,6 +9453,7 @@ true true true + true true true true @@ -8949,6 +9479,7 @@ true true true + true true true true @@ -8958,6 +9489,7 @@ true true true + true true true true @@ -8983,6 +9515,7 @@ true true true + true true true true @@ -8992,6 +9525,7 @@ true true true + true true true true @@ -9017,6 +9551,7 @@ true true true + true true true true @@ -9026,6 +9561,7 @@ true true true + true true true true @@ -9051,6 +9587,7 @@ true true true + true true true true @@ -9060,6 +9597,7 @@ true true true + true true true true @@ -9085,6 +9623,7 @@ true true true + true true true true @@ -9094,6 +9633,7 @@ true true true + true true true true @@ -9119,6 +9659,7 @@ true true true + true true true true @@ -9128,6 +9669,7 @@ true true true + true true true true @@ -9153,6 +9695,7 @@ true true true + true true true true @@ -9162,6 +9705,7 @@ true true true + true true true true @@ -9187,6 +9731,7 @@ true true true + true true true true @@ -9196,6 +9741,7 @@ true true true + true true true true @@ -9221,6 +9767,7 @@ true true true + true true true true @@ -9230,6 +9777,7 @@ true true true + true true true true @@ -9255,6 +9803,7 @@ true true true + true true true true @@ -9264,6 +9813,7 @@ true true true + true true true true @@ -9289,6 +9839,7 @@ true true true + true true true true @@ -9298,6 +9849,7 @@ true true true + true true true true @@ -9323,6 +9875,7 @@ true true true + true true true true @@ -9332,6 +9885,7 @@ true true true + true true true true @@ -9357,6 +9911,7 @@ true true true + true true true true @@ -9366,6 +9921,7 @@ true true true + true true true true @@ -9391,6 +9947,7 @@ true true true + true true true true @@ -9400,6 +9957,7 @@ true true true + true true true true @@ -9425,6 +9983,7 @@ true true true + true true true true @@ -9434,6 +9993,7 @@ true true true + true true true true @@ -9459,6 +10019,7 @@ true true true + true true true true @@ -9468,6 +10029,7 @@ true true true + true true true true @@ -9493,6 +10055,7 @@ true true true + true true true true @@ -9502,6 +10065,7 @@ true true true + true true true true @@ -9527,6 +10091,7 @@ true true true + true true true true @@ -9536,6 +10101,7 @@ true true true + true true true true @@ -9561,6 +10127,7 @@ true true true + true true true true @@ -9570,6 +10137,7 @@ true true true + true true true true @@ -9595,6 +10163,7 @@ true true true + true true true true @@ -9604,6 +10173,7 @@ true true true + true true true true @@ -9629,6 +10199,7 @@ true true true + true true true true @@ -9638,6 +10209,7 @@ true true true + true true true true @@ -9663,6 +10235,7 @@ true true true + true true true true @@ -9672,6 +10245,7 @@ true true true + true true true true @@ -9697,6 +10271,7 @@ true true true + true true true true @@ -9706,6 +10281,7 @@ true true true + true true true true @@ -9731,6 +10307,7 @@ true true true + true true true true @@ -9740,6 +10317,7 @@ true true true + true true true true @@ -9765,6 +10343,7 @@ true true true + true true true true @@ -9774,6 +10353,7 @@ true true true + true true true true @@ -9799,6 +10379,7 @@ true true true + true true true true @@ -9808,6 +10389,7 @@ true true true + true true true true @@ -9833,6 +10415,7 @@ true true true + true true true true @@ -9842,6 +10425,7 @@ true true true + true true true true @@ -9867,6 +10451,7 @@ true true true + true true true true @@ -9876,6 +10461,7 @@ true true true + true true true true @@ -9901,6 +10487,7 @@ true true true + true true true true @@ -9910,6 +10497,7 @@ true true true + true true true true @@ -9935,6 +10523,7 @@ true true true + true true true true @@ -9944,6 +10533,7 @@ true true true + true true true true @@ -9969,6 +10559,7 @@ true true true + true true true true @@ -9978,6 +10569,7 @@ true true true + true true true true @@ -10003,6 +10595,7 @@ true true true + true true true true @@ -10012,6 +10605,7 @@ true true true + true true true true @@ -10031,8 +10625,10 @@ true true true + true true true + true true true true @@ -10067,6 +10663,7 @@ true true true + true true true true @@ -10076,6 +10673,7 @@ true true true + true true true true @@ -10101,6 +10699,7 @@ true true true + true true true true @@ -10110,6 +10709,7 @@ true true true + true true true true @@ -10135,6 +10735,7 @@ true true true + true true true true @@ -10144,6 +10745,7 @@ true true true + true true true true @@ -10169,6 +10771,7 @@ true true true + true true true true @@ -10178,6 +10781,7 @@ true true true + true true true true @@ -10203,6 +10807,7 @@ true true true + true true true true @@ -10212,6 +10817,7 @@ true true true + true true true true @@ -10237,6 +10843,7 @@ true true true + true true true true @@ -10246,6 +10853,7 @@ true true true + true true true true @@ -10271,6 +10879,7 @@ true true true + true true true true @@ -10280,6 +10889,7 @@ true true true + true true true true @@ -10305,6 +10915,7 @@ true true true + true true true true @@ -10314,6 +10925,7 @@ true true true + true true true true @@ -10339,6 +10951,7 @@ true true true + true true true true @@ -10348,6 +10961,7 @@ true true true + true true true true @@ -10373,6 +10987,7 @@ true true true + true true true true @@ -10382,6 +10997,7 @@ true true true + true true true true @@ -10407,6 +11023,7 @@ true true true + true true true true @@ -10416,6 +11033,7 @@ true true true + true true true true @@ -10441,6 +11059,7 @@ true true true + true true true true @@ -10450,6 +11069,7 @@ true true true + true true true true @@ -10475,6 +11095,7 @@ true true true + true true true true @@ -10484,6 +11105,7 @@ true true true + true true true true @@ -10509,6 +11131,7 @@ true true true + true true true true @@ -10518,6 +11141,7 @@ true true true + true true true true @@ -10543,6 +11167,7 @@ true true true + true true true true @@ -10552,6 +11177,7 @@ true true true + true true true true @@ -10569,8 +11195,10 @@ true true true + true true true + true true true true @@ -10606,6 +11234,7 @@ true true true + true true true true @@ -10615,6 +11244,7 @@ true true true + true true true true @@ -10640,6 +11270,7 @@ true true true + true true true true @@ -10649,6 +11280,7 @@ true true true + true true true true @@ -10674,6 +11306,7 @@ true true true + true true true true @@ -10683,6 +11316,7 @@ true true true + true true true true @@ -10708,6 +11342,7 @@ true true true + true true true true @@ -10717,6 +11352,7 @@ true true true + true true true true @@ -10742,6 +11378,7 @@ true true true + true true true true @@ -10751,6 +11388,7 @@ true true true + true true true true @@ -10776,6 +11414,7 @@ true true true + true true true true @@ -10785,6 +11424,7 @@ true true true + true true true true @@ -10810,6 +11450,7 @@ true true true + true true true true @@ -10819,6 +11460,7 @@ true true true + true true true true @@ -10844,6 +11486,7 @@ true true true + true true true true @@ -10853,6 +11496,7 @@ true true true + true true true true @@ -10878,6 +11522,7 @@ true true true + true true true true @@ -10887,6 +11532,7 @@ true true true + true true true true @@ -10912,6 +11558,7 @@ true true true + true true true true @@ -10921,6 +11568,7 @@ true true true + true true true true @@ -10946,6 +11594,7 @@ true true true + true true true true @@ -10955,6 +11604,7 @@ true true true + true true true true @@ -10980,6 +11630,7 @@ true true true + true true true true @@ -10989,6 +11640,7 @@ true true true + true true true true @@ -11014,6 +11666,7 @@ true true true + true true true true @@ -11023,6 +11676,7 @@ true true true + true true true true @@ -11048,6 +11702,7 @@ true true true + true true true true @@ -11057,6 +11712,7 @@ true true true + true true true true @@ -11077,7 +11733,9 @@ true true true + true true + true true true true @@ -11112,6 +11770,7 @@ true true true + true true true true @@ -11121,6 +11780,7 @@ true true true + true true true true @@ -11146,6 +11806,7 @@ true true true + true true true true @@ -11155,6 +11816,7 @@ true true true + true true true true @@ -11180,6 +11842,7 @@ true true true + true true true true @@ -11189,6 +11852,7 @@ true true true + true true true true @@ -11214,6 +11878,7 @@ true true true + true true true true @@ -11223,6 +11888,7 @@ true true true + true true true true @@ -11248,6 +11914,7 @@ true true true + true true true true @@ -11257,6 +11924,7 @@ true true true + true true true true @@ -11282,6 +11950,7 @@ true true true + true true true true @@ -11291,6 +11960,7 @@ true true true + true true true true @@ -11316,6 +11986,7 @@ true true true + true true true true @@ -11325,6 +11996,7 @@ true true true + true true true true @@ -11350,6 +12022,7 @@ true true true + true true true true @@ -11359,6 +12032,7 @@ true true true + true true true true @@ -11384,6 +12058,7 @@ true true true + true true true true @@ -11393,6 +12068,7 @@ true true true + true true true true @@ -11418,6 +12094,7 @@ true true true + true true true true @@ -11427,6 +12104,7 @@ true true true + true true true true @@ -11452,6 +12130,7 @@ true true true + true true true true @@ -11461,6 +12140,7 @@ true true true + true true true true @@ -11486,6 +12166,7 @@ true true true + true true true true @@ -11495,6 +12176,7 @@ true true true + true true true true @@ -11520,6 +12202,7 @@ true true true + true true true true @@ -11529,6 +12212,7 @@ true true true + true true true true @@ -11554,6 +12238,7 @@ true true true + true true true true @@ -11563,6 +12248,7 @@ true true true + true true true true @@ -11588,6 +12274,7 @@ true true true + true true true true @@ -11597,6 +12284,7 @@ true true true + true true true true @@ -11622,6 +12310,7 @@ true true true + true true true true @@ -11631,6 +12320,7 @@ true true true + true true true true @@ -11656,6 +12346,7 @@ true true true + true true true true @@ -11665,6 +12356,7 @@ true true true + true true true true @@ -11690,6 +12382,7 @@ true true true + true true true true @@ -11699,6 +12392,7 @@ true true true + true true true true @@ -11736,7 +12430,6 @@ - @@ -11851,6 +12544,7 @@ false false false + false false false false @@ -11860,8 +12554,10 @@ false false false + false false false + false false false false @@ -11881,6 +12577,7 @@ false false false + false false false false @@ -11890,8 +12587,10 @@ false false false + false false false + false false false false @@ -11930,6 +12629,7 @@ false false false + false false false false @@ -11939,8 +12639,10 @@ false false false + false false false + false false false false @@ -11960,6 +12662,7 @@ false false false + false false false false @@ -11969,8 +12672,10 @@ false false false + false false false + false false false false @@ -12004,6 +12709,7 @@ false false false + false false false false @@ -12013,8 +12719,10 @@ false false false + false false false + false false false false @@ -12034,6 +12742,7 @@ false false false + false false false false @@ -12043,8 +12752,10 @@ false false false + false false false + false false false false @@ -12068,6 +12779,7 @@ false false false + false false false false @@ -12077,8 +12789,10 @@ false false false + false false false + false false false false @@ -12098,6 +12812,7 @@ false false false + false false false false @@ -12107,8 +12822,10 @@ false false false + false false false + false false false false @@ -12132,6 +12849,7 @@ false false false + false false false false @@ -12141,8 +12859,10 @@ false false false + false false false + false false false false @@ -12162,6 +12882,7 @@ false false false + false false false false @@ -12171,8 +12892,10 @@ false false false + false false false + false false false false @@ -12196,6 +12919,7 @@ false false false + false false false false @@ -12205,8 +12929,10 @@ false false false + false false false + false false false false @@ -12226,6 +12952,7 @@ false false false + false false false false @@ -12235,8 +12962,10 @@ false false false + false false false + false false false false @@ -12260,6 +12989,7 @@ false false false + false false false false @@ -12269,8 +12999,10 @@ false false false + false false false + false false false false @@ -12290,6 +13022,7 @@ false false false + false false false false @@ -12299,8 +13032,10 @@ false false false + false false false + false false false false @@ -12329,6 +13064,7 @@ false false false + false false false false @@ -12338,8 +13074,10 @@ false false false + false false false + false false false false @@ -12359,6 +13097,7 @@ false false false + false false false false @@ -12368,8 +13107,10 @@ false false false + false false false + false false false false @@ -12397,6 +13138,7 @@ false false false + false false false false @@ -12406,8 +13148,10 @@ false false false + false false false + false false false false @@ -12427,6 +13171,7 @@ false false false + false false false false @@ -12436,8 +13181,10 @@ false false false + false false false + false false false false @@ -12474,6 +13221,7 @@ false false false + false false false false @@ -12483,8 +13231,10 @@ false false false + false false false + false false false false @@ -12504,6 +13254,7 @@ false false false + false false false false @@ -12513,8 +13264,10 @@ false false false + false false false + false false false false @@ -12699,9 +13452,10 @@ - - - + + + + @@ -12715,8 +13469,10 @@ true true true + true true true + true true true true @@ -12744,8 +13500,10 @@ true true true + true true true + true true true true @@ -12773,9 +13531,11 @@ true true true + true true true true + true true true true @@ -12802,8 +13562,10 @@ true true true + true true true + true true true true diff --git a/test/vs2022/etl.vcxproj.filters b/test/vs2022/etl.vcxproj.filters index 6358b1e7..bc844b79 100644 --- a/test/vs2022/etl.vcxproj.filters +++ b/test/vs2022/etl.vcxproj.filters @@ -2213,9 +2213,6 @@ Tests\Misc - - Tests\Misc - Tests\Misc @@ -3526,9 +3523,12 @@ Tests\Scripts - + Resource Files\CI\Github + + Tests\Scripts +