From 44db411d0d1bdc30994a106abfe9f67b3bb398b0 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 8 May 2022 11:10:42 +0100 Subject: [PATCH 01/11] Multiple sanitizer fixes. --- include/etl/absolute.h | 24 ++++++++++ include/etl/binary.h | 62 ++++++++++++++++---------- include/etl/bit_stream.h | 6 ++- include/etl/bitset.h | 6 +-- include/etl/nullptr.h | 2 +- include/etl/private/to_string_helper.h | 3 +- test/data.h | 5 +-- 7 files changed, 74 insertions(+), 34 deletions(-) diff --git a/include/etl/absolute.h b/include/etl/absolute.h index d473b3ec..9dc7b347 100644 --- a/include/etl/absolute.h +++ b/include/etl/absolute.h @@ -32,6 +32,7 @@ SOFTWARE. #define ETL_ABSOLUTE_INCLUDED #include "type_traits.h" +#include "integral_limits.h" namespace etl { @@ -54,6 +55,29 @@ namespace etl { return value; } + + //*************************************************************************** + // For signed types. + // Returns the result as the unsigned type. + //*************************************************************************** + template ::type> + ETL_CONSTEXPR typename etl::enable_if::value, TReturn>::type + absolute_unsigned(T value) + { + return (value == etl::integral_limits::min) ? etl::integral_limits::max / 2U + : (value < T(0)) ? TReturn(-value) : TReturn(value); + } + + //*************************************************************************** + // For unsigned types. + // Returns the result as the unsigned type. + //*************************************************************************** + template + ETL_CONSTEXPR typename etl::enable_if::value, T>::type + absolute_unsigned(T value) + { + return etl::absolute(value); + } } #endif diff --git a/include/etl/binary.h b/include/etl/binary.h index 91058967..51860943 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -120,7 +120,7 @@ namespace etl #else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - const size_t SHIFT = etl::integral_limits::type>::bits - 1; + ETL_CONSTANT size_t SHIFT = etl::integral_limits::type>::bits - 1U; return (value << 1U) | (value >> SHIFT); #endif @@ -138,11 +138,18 @@ namespace etl #else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - const size_t BITS = etl::integral_limits::type>::bits; + ETL_CONSTANT size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; const size_t SHIFT = BITS - distance; - return (value << distance) | (value >> SHIFT); + if (SHIFT == BITS) + { + return value; + } + else + { + return (value << distance) | (value >> SHIFT); + } #endif } @@ -158,7 +165,7 @@ namespace etl #else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - const size_t SHIFT = etl::integral_limits::type>::bits - 1; + ETL_CONSTANT size_t SHIFT = etl::integral_limits::type>::bits - 1U; return (value >> 1U) | (value << SHIFT); #endif @@ -176,11 +183,18 @@ namespace etl #else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - const size_t BITS = etl::integral_limits::type>::bits; + ETL_CONSTANT size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; const size_t SHIFT = BITS - distance; - return (value >> distance) | (value << SHIFT); + if (SHIFT == BITS) + { + return value; + } + else + { + return (value >> distance) | (value << SHIFT); + } #endif } @@ -224,13 +238,13 @@ namespace etl /// Fold a binary number down to a set number of bits using XOR. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR14 TReturn fold_bits(TValue value) { ETL_STATIC_ASSERT(integral_limits::bits >= NBITS, "Return type too small to hold result"); - const TValue mask = etl::power<2, NBITS>::value - 1U; - const size_t shift = NBITS; + ETL_CONSTANT TValue mask = etl::power<2, NBITS>::value - 1U; + ETL_CONSTANT size_t shift = NBITS; // Fold the value down to fit the width. TReturn folded_value = 0; @@ -253,7 +267,7 @@ namespace etl /// Converts an N bit binary number, where bit N-1 is the sign bit, to a signed integral type. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR14 TReturn sign_extend(TValue value) { ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); @@ -274,7 +288,7 @@ namespace etl /// is the right shift amount, to a signed integral type. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR14 TReturn sign_extend(TValue value) { ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); @@ -296,7 +310,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - ETL_CONSTEXPR14 TReturn sign_extend(TValue value, const size_t NBITS) + ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBITS) { ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); @@ -316,7 +330,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - ETL_CONSTEXPR14 TReturn sign_extend(TValue value, const size_t NBITS, const size_t SHIFT) + ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBITS, size_t SHIFT) { ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); @@ -398,7 +412,7 @@ namespace etl ETL_STATIC_ASSERT(sizeof(TResult) >= sizeof(TValue), "Result must be at least as large as the fill value"); typedef typename etl::make_unsigned::type unsigned_r_t; - typedef typename etl::make_unsigned::type unsigned_v_t; + typedef typename etl::make_unsigned::type unsigned_v_t; return TResult(unsigned_v_t(value) * (unsigned_r_t(~unsigned_r_t(0U)) / unsigned_v_t(~unsigned_v_t(0U)))); } @@ -407,13 +421,13 @@ namespace etl /// Fills a value with a bit pattern. Partial compile time. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR TResult binary_fill() { ETL_STATIC_ASSERT(sizeof(TResult) >= sizeof(TValue), "Result must be at least as large as the fill value"); typedef typename etl::make_unsigned::type unsigned_r_t; - typedef typename etl::make_unsigned::type unsigned_v_t; + typedef typename etl::make_unsigned::type unsigned_v_t; return TResult(unsigned_v_t(N) * (unsigned_r_t(~unsigned_r_t(0U)) / unsigned_v_t(~unsigned_v_t(0U)))); } @@ -424,7 +438,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - ETL_CONSTEXPR14 bool has_zero_byte(const TValue value) + ETL_CONSTEXPR14 bool has_zero_byte(TValue value) { typedef typename etl::make_unsigned::type unsigned_t; const unsigned_t mask = etl::binary_fill(0x7FU); @@ -437,7 +451,7 @@ namespace etl /// Detects the presence of zero bytes. Partial compile time. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR14 bool has_zero_byte() { typedef typename etl::make_unsigned::type unsigned_t; @@ -461,7 +475,7 @@ namespace etl /// Detects the presence of a byte of value N. Partial compile time. ///\ingroup binary //*************************************************************************** - template + template ETL_CONSTEXPR14 bool has_byte_n(TValue value) { return etl::has_zero_byte(TValue(value ^ etl::binary_fill(N))); @@ -475,7 +489,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - ETL_CONSTEXPR T binary_merge(const T first, const T second, const T mask) + ETL_CONSTEXPR T binary_merge(T first, T second, T mask) { return second ^ ((second ^ first) & mask); } @@ -486,8 +500,8 @@ namespace etl /// Mask is a template parameter. ///\ingroup binary //*************************************************************************** - template - ETL_CONSTEXPR T binary_merge(const T first, const T second) + template + ETL_CONSTEXPR T binary_merge(T first, T second) { return second ^ ((second ^ first) & MASK); } @@ -2151,7 +2165,7 @@ namespace etl //*************************************************************************** template ETL_CONSTEXPR typename etl::enable_if::value, bool>::type - is_odd(const T value) + is_odd(T value) { return ((static_cast::type>(value) & 1U) != 0U); } @@ -2162,7 +2176,7 @@ namespace etl //*************************************************************************** template ETL_CONSTEXPR typename etl::enable_if::value, bool>::type - is_even(const T value) + is_even(T value) { return ((static_cast::type>(value) & 1U) == 0U); } diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index f820314b..2894d1cf 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -231,10 +231,12 @@ namespace etl while (width != 0) { unsigned char mask_width = static_cast(etl::min(width, bits_in_byte)); - unsigned char chunk = get_chunk(mask_width); + + typedef typename etl::make_unsigned::type chunk_t; + chunk_t chunk = get_chunk(mask_width); width -= mask_width; - value |= static_cast(chunk) << width; + value |= static_cast(chunk << width); } success = true; diff --git a/include/etl/bitset.h b/include/etl/bitset.h index 7da2c4bb..dac84ac9 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -447,12 +447,12 @@ namespace etl if (OK) { - T shift = T(0); + uint_least8_t shift = 0U; for (size_t i = 0UL; i < SIZE; ++i) { - v |= T(pdata[i]) << shift; - shift += T(BITS_PER_ELEMENT); + v |= T(typename etl::make_unsigned::type(pdata[i]) << shift); + shift += uint_least8_t(BITS_PER_ELEMENT); } } diff --git a/include/etl/nullptr.h b/include/etl/nullptr.h index 0820c6f8..4c1b5c8a 100644 --- a/include/etl/nullptr.h +++ b/include/etl/nullptr.h @@ -35,7 +35,7 @@ SOFTWARE. #include -#if ETL_CPP11_NOT_SUPPORTED || ETL_NOT_USING_STL +#if ETL_CPP11_NOT_SUPPORTED // Use the old style C++ NULL definition. #define ETL_NULLPTR 0 #else diff --git a/include/etl/private/to_string_helper.h b/include/etl/private/to_string_helper.h index 0d7ef7a6..8137b226 100644 --- a/include/etl/private/to_string_helper.h +++ b/include/etl/private/to_string_helper.h @@ -385,7 +385,8 @@ namespace etl denominator *= 10U; } - working_t abs_value = etl::absolute(value); + // Get the absolute value, taking care of minimum negative values. + working_t abs_value = etl::absolute_unsigned(value); // Figure out how many decimal digits we have in the value. const uint32_t& original_decimal_digits = denominator_exponent; diff --git a/test/data.h b/test/data.h index 503476c6..99fd7807 100644 --- a/test/data.h +++ b/test/data.h @@ -189,15 +189,15 @@ public: } TestDataM(TestDataM&& other) noexcept - : value(other.value) + : value(std::move(other.value);) , valid(true) { - other.value = std::move(T()); other.valid = false; } virtual ~TestDataM() { + valid = false; } TestDataM& operator =(TestDataM&& other) noexcept @@ -205,7 +205,6 @@ public: value = std::move(other.value); valid = true; - other.value = T(); other.valid = false; return *this; From 898c8c65877d106b5c36fd804a5597a17322d156 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 8 May 2022 11:10:42 +0100 Subject: [PATCH 02/11] Multiple sanitizer fixes. --- test/data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/data.h b/test/data.h index 99fd7807..44dfbb27 100644 --- a/test/data.h +++ b/test/data.h @@ -189,7 +189,7 @@ public: } TestDataM(TestDataM&& other) noexcept - : value(std::move(other.value);) + : value(std::move(other.value)) , valid(true) { other.valid = false; From 87f40fe813460609fce84fa0602c67eb38b1e836 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 11 May 2022 16:04:25 +0100 Subject: [PATCH 03/11] Updates to etl::successor and derived classes. --- .../etl/fixed_sized_memory_block_allocator.h | 20 +- include/etl/imemory_block_allocator.h | 31 +- include/etl/reference_counted_message_pool.h | 11 +- include/etl/successor.h | 90 ++++- test/data.h | 6 + ...est_fixed_sized_memory_block_allocator.cpp | 34 +- test/test_successor.cpp | 376 ++++++++++++++++++ test/vs2019/etl.vcxproj | 5 +- test/vs2019/etl.vcxproj.filters | 3 + 9 files changed, 542 insertions(+), 34 deletions(-) create mode 100644 test/test_successor.cpp diff --git a/include/etl/fixed_sized_memory_block_allocator.h b/include/etl/fixed_sized_memory_block_allocator.h index 3e70641b..0fe7db32 100644 --- a/include/etl/fixed_sized_memory_block_allocator.h +++ b/include/etl/fixed_sized_memory_block_allocator.h @@ -46,7 +46,6 @@ namespace etl class fixed_sized_memory_block_allocator : public imemory_block_allocator { public: - static ETL_CONSTANT size_t Block_Size = VBlock_Size; static ETL_CONSTANT size_t Alignment = VAlignment; static ETL_CONSTANT size_t Size = VSize; @@ -58,17 +57,6 @@ namespace etl { } -#if defined(ETL_IN_UNIT_TEST) - //************************************************************************* - /// Returns true if the allocator is the owner of the block. - /// For unit testing purposes. - //************************************************************************* - bool is_owner_of(const void* const pblock) const - { - return pool.is_in_pool(pblock); - } -#endif - private: /// A structure that has the size Block_Size. @@ -110,6 +98,14 @@ namespace etl } } + //************************************************************************* + /// Returns true if the allocator is the owner of the block. + //************************************************************************* + virtual bool is_owner_of_block(const void* const pblock) const ETL_OVERRIDE + { + return pool.is_in_pool(pblock); + } + /// The generic pool from which allocate memory blocks. etl::generic_pool pool; }; diff --git a/include/etl/imemory_block_allocator.h b/include/etl/imemory_block_allocator.h index 5b8529a2..4b1f84d8 100644 --- a/include/etl/imemory_block_allocator.h +++ b/include/etl/imemory_block_allocator.h @@ -66,7 +66,7 @@ namespace etl /// ...and we have a successor... if (has_successor()) { - // Try to allocate from the next one in the chain. + // ...try to allocate from the next one in the chain. return get_successor().allocate(required_size, required_alignment); } } @@ -82,13 +82,13 @@ namespace etl { bool was_released = release_block(p); - // Call the derived implementation to try to release. + // If that failed... if (!was_released) { - // If it failed and we have a successor... + /// ...and we have a successor... if (has_successor()) { - // Try to release from the next one in the chain. + // ...try to release from the next one in the chain. was_released = get_successor().release(p); } } @@ -96,10 +96,33 @@ namespace etl return was_released; } + //***************************************************************************** + /// Check if the memory block is owned by this allocator. + /// If this allocator does not own it, then pass the request on the the successor, if configured. + //***************************************************************************** + bool is_owner_of(const void* const p) const + { + bool is_owner = is_owner_of_block(p); + + // If that failed... + if (!is_owner) + { + /// ...and we have a successor... + if (has_successor()) + { + // ...check with the next one in the chain. + is_owner = get_successor().is_owner_of(p); + } + } + + return is_owner; + } + protected: virtual void* allocate_block(size_t required_size, size_t required_alignment) = 0; virtual bool release_block(const void* const) = 0; + virtual bool is_owner_of_block(const void* const) const = 0; private: diff --git a/include/etl/reference_counted_message_pool.h b/include/etl/reference_counted_message_pool.h index 0fb2b6ec..35fd2de7 100644 --- a/include/etl/reference_counted_message_pool.h +++ b/include/etl/reference_counted_message_pool.h @@ -155,13 +155,18 @@ namespace etl } //************************************************************************* - /// Destruct a message and send it back to the pool. + /// Destruct a message and send it back to the allocator. //************************************************************************* void release(const etl::ireference_counted_message& rcmessage) { - rcmessage.~ireference_counted_message(); + bool released = false; + lock(); - bool released = memory_block_allocator.release(&rcmessage); + if (memory_block_allocator.is_owner_of(&rcmessage)) + { + rcmessage.~ireference_counted_message(); + released = memory_block_allocator.release(&rcmessage); + } unlock(); ETL_ASSERT(released, ETL_ERROR(etl::reference_counted_message_pool_release_failure)); diff --git a/include/etl/successor.h b/include/etl/successor.h index 57377389..807e0ba1 100644 --- a/include/etl/successor.h +++ b/include/etl/successor.h @@ -33,9 +33,38 @@ SOFTWARE. #include "platform.h" #include "nullptr.h" +#include "exception.h" +#include "error_handler.h" +#include "file_error_numbers.h" namespace etl { + //*************************************************************************** + /// Exception for the successor. + //*************************************************************************** + class successor_exception : public etl::exception + { + public: + + successor_exception(string_type reason_, string_type file_name_, numeric_type line_number_) + : exception(reason_, file_name_, line_number_) + { + } + }; + + //*************************************************************************** + /// Invalid exception for successor. + //*************************************************************************** + class successor_invalid : public etl::successor_exception + { + public: + + successor_invalid(string_type file_name_, numeric_type line_number_) + : etl::successor_exception(ETL_ERROR_TEXT("successor:invalid", ETL_SUCCESSOR_FILE_ID"A"), file_name_, line_number_) + { + } + }; + //*************************************************************************** /// Adds successor traits to a class. //*************************************************************************** @@ -70,16 +99,75 @@ namespace etl p_successor = &s; } +#if ETL_CPP11_SUPPORTED + //************************************************************************* + /// Set a list of successors to this. + //************************************************************************* + template + void set_successor(successor_type& s, TSuccessors&... rest) + { + set_successor(s); + s.set_successor(rest...); + } +#endif + + //************************************************************************* + /// Append a successor. + //************************************************************************* + template + void append_successor(TSuccessor& s) + { + if (has_successor()) + { + get_successor().append_successor(s); + } + else + { + set_successor(s); + } + } + +#if ETL_CPP11_SUPPORTED + //************************************************************************* + /// Append the successor. + //************************************************************************* + template + void append_successor(TSuccessor& s, TSuccessors&... rest) + { + if (has_successor()) + { + get_successor().append_successor(s); + get_successor().append_successor(rest...); + } + else + { + set_successor(s); + append_successor(rest...); + } + } +#endif + + //************************************************************************* + /// Clear the successor. + //************************************************************************* + void clear_successor() + { + p_successor = ETL_NULLPTR; + } + //************************************************************************* /// Get the successor. + /// Emits an etl::successor_invalid if a successor has not been set. //************************************************************************* successor_type& get_successor() const { + ETL_ASSERT(has_successor(), ETL_ERROR(successor_invalid)) + return *p_successor; } //************************************************************************* - /// Do we have a successor? + /// Does this have a successor? //************************************************************************* bool has_successor() const { diff --git a/test/data.h b/test/data.h index 44dfbb27..b9a7d850 100644 --- a/test/data.h +++ b/test/data.h @@ -188,6 +188,12 @@ public: { } + explicit TestDataM(T&& value_) + : value(std::move(value_)) + , valid(true) + { + } + TestDataM(TestDataM&& other) noexcept : value(std::move(other.value)) , valid(true) diff --git a/test/test_fixed_sized_memory_block_allocator.cpp b/test/test_fixed_sized_memory_block_allocator.cpp index 70e19f97..8bcc3ab7 100644 --- a/test/test_fixed_sized_memory_block_allocator.cpp +++ b/test/test_fixed_sized_memory_block_allocator.cpp @@ -137,8 +137,7 @@ namespace Allocator16 allocator16; Allocator32 allocator32; - allocator8.set_successor(allocator16); - allocator16.set_successor(allocator32); + allocator8.set_successor(allocator16, allocator32); int8_t* p1 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator8 int16_t* p2 = static_cast(allocator8.allocate(sizeof(int16_t), alignof(uint16_t))); // Take from allocator16 @@ -146,10 +145,10 @@ namespace int64_t* p4 = static_cast(allocator8.allocate(sizeof(int64_t), alignof(uint64_t))); // Unable to allocate int8_t* p5 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator8 int8_t* p6 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator8 - int8_t* p7 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator8. allocator8 is full. + int8_t* p7 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator8. allocator8 is now full. int8_t* p8 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator16 int8_t* p9 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator16 - int8_t* p10 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator16. allocator16 is full. + int8_t* p10 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator16. allocator16 now is full. int8_t* p11 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(uint8_t))); // Take from allocator32 CHECK(p1 != nullptr); @@ -164,48 +163,59 @@ namespace CHECK(p10 != nullptr); CHECK(p11 != nullptr); + // Take from allocator8 CHECK(allocator8.is_owner_of(p1)); CHECK(!allocator16.is_owner_of(p1)); CHECK(!allocator32.is_owner_of(p1)); - CHECK(!allocator8.is_owner_of(p2)); + // Take from allocator16 + CHECK(allocator8.is_owner_of(p2)); CHECK(allocator16.is_owner_of(p2)); CHECK(!allocator32.is_owner_of(p2)); - CHECK(!allocator8.is_owner_of(p3)); - CHECK(!allocator16.is_owner_of(p3)); + // Take from allocator32 + CHECK(allocator8.is_owner_of(p3)); + CHECK(allocator16.is_owner_of(p3)); CHECK(allocator32.is_owner_of(p3)); + // Unable to allocate CHECK(!allocator8.is_owner_of(p4)); CHECK(!allocator16.is_owner_of(p4)); CHECK(!allocator32.is_owner_of(p4)); + // Take from allocator8 CHECK(allocator8.is_owner_of(p5)); CHECK(!allocator16.is_owner_of(p5)); CHECK(!allocator32.is_owner_of(p5)); + // Take from allocator8 CHECK(allocator8.is_owner_of(p6)); CHECK(!allocator16.is_owner_of(p6)); CHECK(!allocator32.is_owner_of(p6)); + // Take from allocator8. CHECK(allocator8.is_owner_of(p7)); CHECK(!allocator16.is_owner_of(p7)); CHECK(!allocator32.is_owner_of(p7)); - CHECK(!allocator8.is_owner_of(p8)); + // Take from allocator16 + CHECK(allocator8.is_owner_of(p8)); CHECK(allocator16.is_owner_of(p8)); CHECK(!allocator32.is_owner_of(p8)); - CHECK(!allocator8.is_owner_of(p9)); + // Take from allocator16 + CHECK(allocator8.is_owner_of(p9)); CHECK(allocator16.is_owner_of(p9)); CHECK(!allocator32.is_owner_of(p9)); - CHECK(!allocator8.is_owner_of(p10)); + // Take from allocator16. + CHECK(allocator8.is_owner_of(p10)); CHECK(allocator16.is_owner_of(p10)); CHECK(!allocator32.is_owner_of(p10)); - CHECK(!allocator8.is_owner_of(p11)); - CHECK(!allocator16.is_owner_of(p11)); + // Take from allocator32 + CHECK(allocator8.is_owner_of(p11)); + CHECK(allocator16.is_owner_of(p11)); CHECK(allocator32.is_owner_of(p11)); CHECK(allocator8.release(p1)); diff --git a/test/test_successor.cpp b/test/test_successor.cpp new file mode 100644 index 00000000..a36974bf --- /dev/null +++ b/test/test_successor.cpp @@ -0,0 +1,376 @@ +/****************************************************************************** +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/successor.h" + +namespace +{ + //******************************************************* + struct SuccessorBase : etl::successor + { + SuccessorBase() + { + } + + SuccessorBase(SuccessorBase& successors...) + : successor(successors) + { + } + + virtual void Test(int) = 0; + }; + + //******************************************************* + struct SuccessorSameBase1 : SuccessorBase + { + SuccessorSameBase1() + : value(0) + { + } + + SuccessorSameBase1(SuccessorBase& successors...) + : SuccessorBase(successors) + , value(0) + { + } + + void Test(int i) override + { + if (i > 1) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + //******************************************************* + struct SuccessorSameBase2 : SuccessorBase + { + SuccessorSameBase2() + : value(0) + { + } + + void Test(int i) override + { + if (i > 2) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + //******************************************************* + struct SuccessorSameBase3 : SuccessorBase + { + SuccessorSameBase3() + : value(0) + { + } + + void Test(int i) override + { + if (i > 3) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + //******************************************************* + struct SuccessorSameBase4 : SuccessorBase + { + SuccessorSameBase4() + : value(0) + { + } + + void Test(int i) override + { + if (i > 4) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + //******************************************************* + struct SuccessorSameBase5 : SuccessorBase + { + SuccessorSameBase5() + : value(0) + { + } + + void Test(int i) override + { + value = i; + } + + int value; + }; + + //******************************************************* + struct SuccessorNoBase3 + { + SuccessorNoBase3() + : value(0) + { + } + + void Test(int i) + { + value = i; + } + + int value; + }; + + //******************************************************* + struct SuccessorNoBase2 : etl::successor + { + SuccessorNoBase2() + : value(0) + { + } + + void Test(int i) + { + if (i > 2) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + //******************************************************* + struct SuccessorNoBase1 : etl::successor + { + SuccessorNoBase1() + : value(0) + { + } + + void Test(int i) + { + if (i > 1) + { + get_successor().Test(i); + } + else + { + value = i; + } + } + + int value; + }; + + SUITE(test_successor) + { + //************************************************************************* + TEST(test_successors_same_check_append_multiple_to_first) + { + SuccessorSameBase1 successor1; + SuccessorSameBase2 successor2; + SuccessorSameBase3 successor3; + SuccessorSameBase4 successor4; + SuccessorSameBase5 successor5; + + successor1.append_successor(successor2, successor3, successor4, successor5); + + CHECK(successor1.has_successor()); + CHECK(successor2.has_successor()); + CHECK(successor3.has_successor()); + CHECK(successor4.has_successor()); + CHECK(!successor5.has_successor()); + + CHECK(&successor1.get_successor() == &successor2); + CHECK(&successor2.get_successor() == &successor3); + CHECK(&successor3.get_successor() == &successor4); + + CHECK_THROW(successor5.get_successor(), etl::successor_invalid); + } + + //************************************************************************* + TEST(test_successors_same_check_append_multiple) + { + SuccessorSameBase1 successor1; + SuccessorSameBase2 successor2; + SuccessorSameBase3 successor3; + SuccessorSameBase4 successor4; + SuccessorSameBase5 successor5; + + successor1.set_successor(successor2, successor3); + successor1.append_successor(successor4, successor5); + + CHECK(successor1.has_successor()); + CHECK(successor2.has_successor()); + CHECK(successor3.has_successor()); + CHECK(successor4.has_successor()); + CHECK(!successor5.has_successor()); + + CHECK(&successor1.get_successor() == &successor2); + CHECK(&successor2.get_successor() == &successor3); + CHECK(&successor3.get_successor() == &successor4); + + CHECK_THROW(successor5.get_successor(), etl::successor_invalid); + } + + //************************************************************************* + TEST(test_successors_same_check_append_chain) + { + SuccessorSameBase1 successor1; + SuccessorSameBase2 successor2; + SuccessorSameBase3 successor3; + SuccessorSameBase4 successor4; + SuccessorSameBase5 successor5; + + successor1.set_successor(successor2, successor3); + successor4.set_successor(successor5); + successor1.append_successor(successor4); + + CHECK(successor1.has_successor()); + CHECK(successor2.has_successor()); + CHECK(successor3.has_successor()); + CHECK(successor4.has_successor()); + CHECK(!successor5.has_successor()); + + CHECK(&successor1.get_successor() == &successor2); + CHECK(&successor2.get_successor() == &successor3); + CHECK(&successor3.get_successor() == &successor4); + + CHECK_THROW(successor5.get_successor(), etl::successor_invalid); + } + + //************************************************************************* + TEST(test_successors_same_check) + { + SuccessorSameBase1 successor1; + SuccessorSameBase2 successor2; + SuccessorSameBase3 successor3; + + successor1.set_successor(successor2, successor3); + + CHECK(successor1.has_successor()); + CHECK(successor2.has_successor()); + CHECK(!successor3.has_successor()); + + CHECK(&successor1.get_successor() == &successor2); + CHECK(&successor2.get_successor() == &successor3); + + CHECK_THROW(successor3.get_successor(), etl::successor_invalid); + } + + //************************************************************************* + TEST(test_successors_same_check_calls) + { + SuccessorSameBase1 successor1; + SuccessorSameBase2 successor2; + SuccessorSameBase3 successor3; + + successor1.set_successor(successor2, successor3); + + successor1.Test(1); + successor1.Test(2); + successor1.Test(3); + + CHECK_EQUAL(1, successor1.value); + CHECK_EQUAL(2, successor2.value); + CHECK_EQUAL(3, successor3.value); + } + + //************************************************************************* + TEST(test_successors_different_setup) + { + SuccessorNoBase1 successor1; + SuccessorNoBase2 successor2; + SuccessorNoBase3 successor3; + + successor1.set_successor(successor2, successor3); + + CHECK(successor1.has_successor()); + CHECK(successor2.has_successor()); + // successor3 does not support a successor. + + CHECK(&successor1.get_successor() == &successor2); + CHECK(&successor2.get_successor() == &successor3); + } + + //************************************************************************* + TEST(test_successors_different_check_calls) + { + SuccessorNoBase1 successor1; + SuccessorNoBase2 successor2; + SuccessorNoBase3 successor3; + + successor1.set_successor(successor2, successor3); + + successor1.Test(1); + successor1.Test(2); + successor1.Test(3); + + CHECK_EQUAL(1, successor1.value); + CHECK_EQUAL(2, successor2.value); + CHECK_EQUAL(3, successor3.value); + } + } +} + diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index d2782473..592975ed 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -765,7 +765,7 @@ - true + false true $(Configuration)\ @@ -1045,7 +1045,7 @@ true stdcpp17 - EditAndContinue + ProgramDatabase /Zc:__cplusplus %(AdditionalOptions) @@ -11431,6 +11431,7 @@ + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 282937dc..f232ffe3 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -3242,6 +3242,9 @@ Tests\Types + + Tests\Patterns + From 7d7a9cf15bfcf0c9ac8b097a923d50ec440a3e96 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 11 May 2022 21:06:35 +0100 Subject: [PATCH 04/11] Updated CMakeLists.txt --- test/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4f7ba7e6..0c139f2a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -42,8 +42,6 @@ set(TEST_SOURCE_FILES test_array.cpp test_array_view.cpp test_array_wrapper.cpp - test_atomic_clang_sync.cpp - test_atomic_gcc_sync.cpp test_atomic_std.cpp test_binary.cpp test_bip_buffer_spsc_atomic.cpp @@ -252,6 +250,7 @@ set(TEST_SOURCE_FILES test_string_view.cpp test_string_wchar_t.cpp test_string_wchar_t_external_buffer.cpp + test_successor.cpp test_task_scheduler.cpp test_threshold.cpp test_to_string.cpp @@ -322,11 +321,20 @@ else () endif () if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - list(APPEND TEST_SOURCE_FILES "test_atomic_gcc_sync.cpp") + message(STATUS "Using GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") + message(STATUS "Including test_atomic_gcc_sync") + list(APPEND TEST_SOURCE_FILES "test_atomic_gcc_sync.cpp") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined") +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message(STATUS "Using Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") + message(STATUS "Including test_atomic_clang_sync") + list(APPEND TEST_SOURCE_FILES "test_atomic_clang_sync.cpp") +endif() add_executable(etl_tests ${TEST_SOURCE_FILES}) add_library(unit_test ${UNITTEST_SOURCE_FILES}) From 7c3d8490c4669496ea6b015983d814dcdfb730ad Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 13 May 2022 14:43:36 +0100 Subject: [PATCH 05/11] indirect_vector updates from sanitizer results --- include/etl/indirect_vector.h | 9 +-------- test/test_indirect_vector.cpp | 12 ++++++++---- test/test_indirect_vector_external_buffer.cpp | 8 ++++++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/etl/indirect_vector.h b/include/etl/indirect_vector.h index 63723f3e..49683c40 100644 --- a/include/etl/indirect_vector.h +++ b/include/etl/indirect_vector.h @@ -454,13 +454,7 @@ namespace etl //********************************************************************* iterator begin() { - etl::ivector& ivr = lookup; - - bool e = ivr.empty(); - - typename etl::ivector::iterator itr = ivr.begin(); - - return iterator(itr); + return iterator(lookup.begin()); } //********************************************************************* @@ -1214,7 +1208,6 @@ namespace etl #endif ~iindirect_vector() { - initialise(); } protected: diff --git a/test/test_indirect_vector.cpp b/test/test_indirect_vector.cpp index 1cc75ae2..e604aeff 100644 --- a/test/test_indirect_vector.cpp +++ b/test/test_indirect_vector.cpp @@ -409,17 +409,21 @@ namespace const DataDC constData(10); CHECK_EQUAL(&data[0], &(*data.begin())); + CHECK_EQUAL(&data[0], &(*data.cbegin())); CHECK_EQUAL(&constData[0], &(*constData.begin())); + CHECK_EQUAL(&constData[0], &(*constData.cbegin())); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { - DataDC data(10); - const DataDC constData(10); + DataDC data(10U); + const DataDC constData(10U); - CHECK_EQUAL(&data[10], &(*data.end())); - CHECK_EQUAL(&constData[10], &(constData.end())); + CHECK(std::distance(data.begin(), data.end()) == 10U); + CHECK(std::distance(data.cbegin(), data.cend()) == 10U); + CHECK(std::distance(constData.begin(), constData.end()) == 10U); + CHECK(std::distance(constData.cbegin(), constData.cend()) == 10U); } //************************************************************************* diff --git a/test/test_indirect_vector_external_buffer.cpp b/test/test_indirect_vector_external_buffer.cpp index 9542acbe..57e4fd66 100644 --- a/test/test_indirect_vector_external_buffer.cpp +++ b/test/test_indirect_vector_external_buffer.cpp @@ -485,7 +485,9 @@ namespace const DataDC constData(10, lookup2, pool2); CHECK_EQUAL(&data[0], &(*data.begin())); + CHECK_EQUAL(&data[0], &(*data.cbegin())); CHECK_EQUAL(&constData[0], &(*constData.begin())); + CHECK_EQUAL(&constData[0], &(*constData.cbegin())); } //************************************************************************* @@ -500,8 +502,10 @@ namespace DataDC data(10, lookup1, pool1); const DataDC constData(10, lookup2, pool2); - CHECK_EQUAL(&data[10], &(*data.end())); - CHECK_EQUAL(&constData[10], &(constData.end())); + CHECK(std::distance(data.begin(), data.end()) == 10U); + CHECK(std::distance(data.cbegin(), data.cend()) == 10U); + CHECK(std::distance(constData.begin(), constData.end()) == 10U); + CHECK(std::distance(constData.cbegin(), constData.cend()) == 10U); } //************************************************************************* From 2d743082ec9989fbb1c2c03b02e45aed11ff38d7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 13 May 2022 16:45:14 +0100 Subject: [PATCH 06/11] Updated runtests.sh --- test/runtests.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/runtests.sh b/test/runtests.sh index f7d47c53..a1b19a49 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -6,6 +6,8 @@ cd build-make || exit 1 echo "ETL Tests" > log.txt +export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + #****************************************************************************** # GCC #****************************************************************************** @@ -14,7 +16,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " GCC - STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt gcc --version | grep gcc | tee -a log.txt -CC=gcc CXX=g++ cmake --cmake-clean-cache -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="g++" -DCMAKE_C_COMPILER="gcc" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -34,7 +36,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " GCC - STL - Force C++03" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt gcc --version | grep gcc | tee -a log.txt -CC=gcc CXX=g++ cmake --cmake-clean-cache -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="g++" -DCMAKE_C_COMPILER="gcc" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -54,7 +56,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " GCC - No STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt gcc --version | grep gcc | tee -a log.txt -CC=gcc CXX=g++ cmake --cmake-clean-cache -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="g++" -DCMAKE_C_COMPILER="gcc" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -74,7 +76,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " GCC - No STL - Force Builtins" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt gcc --version | grep gcc | tee -a log.txt -CC=gcc CXX=g++ cmake --cmake-clean-cache -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USE_MEM_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="g++" -DCMAKE_C_COMPILER="gcc" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USE_MEM_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -98,7 +100,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " Clang - STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt clang --version | grep clang | tee -a log.txt -CC=clang CXX=clang++ cmake --cmake-clean-cache -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -118,7 +120,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " Clang - STL - Force C++03" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt clang --version | grep clang | tee -a log.txt -CC=clang CXX=clang++ cmake --cmake-clean-cache -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -138,7 +140,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " Clang - No STL" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt clang --version | grep clang | tee -a log.txt -CC=clang CXX=clang++ cmake --cmake-clean-cache -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USE_MEM_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -158,7 +160,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " Clang - No STL - Builtins" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt clang --version | grep clang | tee -a log.txt -CC=clang CXX=clang++ cmake --cmake-clean-cache -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USE_MEM_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USE_MEM_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed Compilation >>>>" @@ -182,7 +184,7 @@ cd ../etl_initializer_list/ mkdir -p build-make || exit 1 cd build-make || exit 1 gcc --version | grep gcc | tee -a log.txt -CC=gcc CXX=g++ cmake --cmake-clean-cache .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="g++" -DCMAKE_C_COMPILER="gcc" .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed initializer_list Compilation >>>>" @@ -203,7 +205,7 @@ echo "-----------------------------------------------" | tee -a log.txt echo " Clang - Initializer list test" | tee -a log.txt echo "-----------------------------------------------" | tee -a log.txt clang --version | grep clang | tee -a log.txt -CC=clang CXX=clang++ cmake --cmake-clean-cache .. +cmake --cmake-clean-cache -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" .. make -j8 if [ $? -eq 0 ]; then echo "<<<< Passed initializer_list Compilation >>>>" From 7b3bb5fa6d5be0e04beb32b45b773a975256cb95 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 15 May 2022 18:01:44 +0100 Subject: [PATCH 07/11] Fixed incorrect returned span length for byte stream read --- include/etl/byte_stream.h | 2 +- test/test_byte_stream.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/etl/byte_stream.h b/include/etl/byte_stream.h index d011e630..2b75e82a 100644 --- a/include/etl/byte_stream.h +++ b/include/etl/byte_stream.h @@ -559,7 +559,7 @@ namespace etl { T* destination = start; - while (length-- != 0U) + for (size_t i = 0; i < length; ++i) { *destination++ = from_bytes(); } diff --git a/test/test_byte_stream.cpp b/test/test_byte_stream.cpp index 7333eb77..799f4295 100644 --- a/test/test_byte_stream.cpp +++ b/test/test_byte_stream.cpp @@ -920,6 +920,7 @@ namespace etl::optional > result = reader.read(output); CHECK(result.has_value()); + CHECK_EQUAL(sizeof(const int32_t), result.value().size()); CHECK_EQUAL(put_data[0], get_data[0]); CHECK_EQUAL(put_data[1], get_data[1]); CHECK_EQUAL(put_data[2], get_data[2]); @@ -944,6 +945,7 @@ namespace etl::optional > result = reader.read(get_data.data(), get_data.size()); CHECK(result.has_value()); + CHECK_EQUAL(sizeof(const int32_t), result.value().size()); CHECK_EQUAL(put_data[0], get_data[0]); CHECK_EQUAL(put_data[1], get_data[1]); CHECK_EQUAL(put_data[2], get_data[2]); From 7bfea414cbc59a766a808630587681297c26e945 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 15 May 2022 18:55:30 +0100 Subject: [PATCH 08/11] Updated array_wrapper test to remove sanitizer issues --- test/test_array_wrapper.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_array_wrapper.cpp b/test/test_array_wrapper.cpp index 60cf245f..b33f07a5 100644 --- a/test/test_array_wrapper.cpp +++ b/test/test_array_wrapper.cpp @@ -261,7 +261,7 @@ namespace TEST(test_rend) { Data5 aw5; - CHECK_EQUAL(data5 + Data5::REND, std::addressof(*aw5.rend())); + CHECK_EQUAL(Data5::SIZE, std::distance(aw5.rbegin(), aw5.rend())); } //************************************************************************* @@ -275,12 +275,12 @@ namespace TEST(test_crend) { const Data5 caw5a; - CHECK_EQUAL(caw5a.data() + Data5::REND, std::addressof(*caw5a.rend())); - CHECK_EQUAL(caw5a.data() + Data5::REND, std::addressof(*caw5a.crend())); + CHECK_EQUAL(Data5::SIZE, std::distance(caw5a.rbegin(), caw5a.rend())); + CHECK_EQUAL(Data5::SIZE, std::distance(caw5a.rbegin(), caw5a.rend())); CData5 caw5b; - CHECK_EQUAL(caw5b.data() + CData5::REND, std::addressof(*caw5b.rend())); - CHECK_EQUAL(caw5b.data() + CData5::REND, std::addressof(*caw5b.crend())); + CHECK_EQUAL(Data5::SIZE, std::distance(caw5b.rbegin(), caw5b.rend())); + CHECK_EQUAL(Data5::SIZE, std::distance(caw5b.rbegin(), caw5b.rend())); } //************************************************************************* @@ -329,7 +329,7 @@ namespace Data5::reverse_iterator itr = aw5.rbegin(); int* p = data5 + Data5::RBEGIN; - while (p != data5 + Data5::REND) + while (itr != aw5.rend()) { CHECK_EQUAL(*p, *itr); --p; @@ -350,7 +350,7 @@ namespace Data5::const_reverse_iterator itr = aw5.crbegin(); int* p = data5 + Data5::RBEGIN; - while (p != data5 + Data5::REND) + while (itr != aw5.crend()) { CHECK_EQUAL(*p, *itr); --p; From 0d4c663d0b2b3ce351cb59e89c4755ad9bebd3e3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 16 May 2022 20:56:25 +0100 Subject: [PATCH 09/11] 64 bit conversion type fixes --- include/etl/circular_buffer.h | 8 ++------ include/etl/cumulative_moving_average.h | 2 +- include/etl/mem_cast.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/etl/circular_buffer.h b/include/etl/circular_buffer.h index 42abcc61..13a1d3d3 100644 --- a/include/etl/circular_buffer.h +++ b/include/etl/circular_buffer.h @@ -296,9 +296,7 @@ namespace etl //************************************************************************* iterator& operator +=(int n) { - n = picb->BUFFER_SIZE + n; - - current += n; + current += size_type(picb->BUFFER_SIZE + n); current %= picb->BUFFER_SIZE; return (*this); @@ -569,9 +567,7 @@ namespace etl //************************************************************************* const_iterator& operator +=(int n) { - n = picb->BUFFER_SIZE + n; - - current += n; + current += size_type(picb->BUFFER_SIZE + n); current %= picb->BUFFER_SIZE; return (*this); diff --git a/include/etl/cumulative_moving_average.h b/include/etl/cumulative_moving_average.h index d604b052..b04ef62f 100644 --- a/include/etl/cumulative_moving_average.h +++ b/include/etl/cumulative_moving_average.h @@ -206,7 +206,7 @@ namespace etl //************************************************************************* cumulative_moving_average(const T initial_value, const size_t sample_size) : average(initial_value * SCALE) - , samples(sample_size) + , samples(sample_t(sample_size)) { } diff --git a/include/etl/mem_cast.h b/include/etl/mem_cast.h index bfc16fd7..960ba5b4 100644 --- a/include/etl/mem_cast.h +++ b/include/etl/mem_cast.h @@ -533,7 +533,7 @@ namespace etl const type p = reinterpret_cast(pbuffer); - return 1U << etl::count_trailing_zeros(p); + return size_t(1U) << etl::count_trailing_zeros(p); } //*********************************** From 232f329867736acf63dc873fe59b823719e86d37 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 16 May 2022 20:56:44 +0100 Subject: [PATCH 10/11] Fix header file includes --- test/sanity-check/delegate.h.t.cpp | 2 +- test/sanity-check/delegate_cpp03.h.t.cpp | 2 +- test/sanity-check/variant_old.h.t.cpp | 2 +- test/test_mem_cast_ptr.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sanity-check/delegate.h.t.cpp b/test/sanity-check/delegate.h.t.cpp index ded35f20..2ff5841b 100644 --- a/test/sanity-check/delegate.h.t.cpp +++ b/test/sanity-check/delegate.h.t.cpp @@ -26,4 +26,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include diff --git a/test/sanity-check/delegate_cpp03.h.t.cpp b/test/sanity-check/delegate_cpp03.h.t.cpp index c7273823..cba3076f 100644 --- a/test/sanity-check/delegate_cpp03.h.t.cpp +++ b/test/sanity-check/delegate_cpp03.h.t.cpp @@ -26,4 +26,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include diff --git a/test/sanity-check/variant_old.h.t.cpp b/test/sanity-check/variant_old.h.t.cpp index c306bbfb..d95072de 100644 --- a/test/sanity-check/variant_old.h.t.cpp +++ b/test/sanity-check/variant_old.h.t.cpp @@ -26,4 +26,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include diff --git a/test/test_mem_cast_ptr.cpp b/test/test_mem_cast_ptr.cpp index c528537f..45c496c6 100644 --- a/test/test_mem_cast_ptr.cpp +++ b/test/test_mem_cast_ptr.cpp @@ -69,7 +69,7 @@ namespace char* Ptr(int i) { - return reinterpret_cast(i); + return reinterpret_cast(uintptr_t(i)); } std::aligned_storage_t buffer; From 9224df106ec26bfdd547af2939226ee02e49a21c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 16 May 2022 20:58:07 +0100 Subject: [PATCH 11/11] Fixed data alignment issues raised by sanitizer --- include/etl/unordered_map.h | 49 +++-- include/etl/unordered_multimap.h | 51 +++-- include/etl/unordered_multiset.h | 57 +++--- include/etl/unordered_set.h | 53 +++-- test/test_flat_map.cpp | 10 +- test/test_flat_multimap.cpp | 10 +- test/test_flat_multiset.cpp | 10 +- test/test_flat_set.cpp | 10 +- test/test_map.cpp | 6 +- test/test_multimap.cpp | 6 +- test/test_multiset.cpp | 20 +- test/test_set.cpp | 20 +- test/test_unordered_map.cpp | 4 +- test/test_unordered_multimap.cpp | 4 +- test/test_unordered_multiset.cpp | 28 ++- test/test_unordered_set.cpp | 14 +- test/vs2019/etl.sln | 4 +- test/vs2019/etl.vcxproj | 334 ++++++++++++++++++++++++++++--- test/vs2019/etl.vcxproj.filters | 159 +++++++-------- 19 files changed, 548 insertions(+), 301 deletions(-) diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 9c5708a2..3ff10d15 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -158,7 +158,7 @@ namespace etl value_type key_value_pair; }; - private: + protected: typedef etl::intrusive_forward_list bucket_t; typedef etl::ipool pool_t; @@ -195,9 +195,9 @@ namespace etl //********************************* iterator(const iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -277,9 +277,9 @@ namespace etl //********************************* iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -338,17 +338,17 @@ namespace etl //********************************* const_iterator(const typename iunordered_map::iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } //********************************* const_iterator(const const_iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -428,9 +428,9 @@ namespace etl //********************************* const_iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -1305,9 +1305,11 @@ namespace etl /// Constructor. //********************************************************************* iunordered_map(pool_t& node_pool_, bucket_t* pbuckets_, size_t number_of_buckets_) - : pnodepool(&node_pool_), - pbuckets(pbuckets_), - number_of_buckets(number_of_buckets_) + : pnodepool(&node_pool_) + , pbuckets(pbuckets_) + , number_of_buckets(number_of_buckets_) + , first(pbuckets) + , last(pbuckets) { } @@ -1347,7 +1349,7 @@ namespace etl } first = pbuckets; - last = first; + last = first; } #if ETL_USING_CPP11 @@ -1438,10 +1440,6 @@ namespace etl ++pcurrent; } } - else - { - // Nothing to do. - } } } @@ -1533,7 +1531,6 @@ namespace etl unordered_map() : base(node_pool, buckets, MAX_BUCKETS_) { - base::initialise(); } //************************************************************************* @@ -1628,7 +1625,7 @@ namespace etl etl::pool node_pool; /// The buckets of node lists. - etl::intrusive_forward_list buckets[MAX_BUCKETS_]; + typename base::bucket_t buckets[MAX_BUCKETS_]; }; //************************************************************************* diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 73f6de6f..878083d9 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -156,7 +156,7 @@ namespace etl value_type key_value_pair; }; - private: + protected: typedef etl::intrusive_forward_list bucket_t; typedef etl::ipool pool_t; @@ -193,9 +193,9 @@ namespace etl //********************************* iterator(const iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -275,9 +275,9 @@ namespace etl //********************************* iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -336,17 +336,17 @@ namespace etl //********************************* const_iterator(const typename iunordered_multimap::iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } //********************************* const_iterator(const const_iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -427,9 +427,9 @@ namespace etl //********************************* const_iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -1212,9 +1212,11 @@ namespace etl /// Constructor. //********************************************************************* iunordered_multimap(pool_t& node_pool_, bucket_t* pbuckets_, size_t number_of_buckets_) - : pnodepool(&node_pool_), - pbuckets(pbuckets_), - number_of_buckets(number_of_buckets_) + : pnodepool(&node_pool_) + , pbuckets(pbuckets_) + , number_of_buckets(number_of_buckets_) + , first(pbuckets) + , last(pbuckets) { } @@ -1253,7 +1255,7 @@ namespace etl } first = pbuckets; - last = first; + last = first; } #if ETL_USING_CPP11 @@ -1291,7 +1293,7 @@ namespace etl if (size() == 1) { first = pbucket; - last = pbucket; + last = pbucket; } else { @@ -1344,10 +1346,6 @@ namespace etl ++pcurrent; } } - else - { - // Nothing to do. - } } } @@ -1439,7 +1437,6 @@ namespace etl unordered_multimap() : base(node_pool, buckets, MAX_BUCKETS) { - base::initialise(); } //************************************************************************* @@ -1539,7 +1536,7 @@ namespace etl etl::pool node_pool; /// The buckets of node lists. - etl::intrusive_forward_list buckets[MAX_BUCKETS_]; + typename base::bucket_t buckets[MAX_BUCKETS_]; }; //************************************************************************* diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index 34dc8ae2..f8f443e5 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -154,7 +154,7 @@ namespace etl value_type key; }; - private: + protected: typedef etl::intrusive_forward_list bucket_t; typedef etl::ipool pool_t; @@ -190,9 +190,9 @@ namespace etl //********************************* iterator(const iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -272,9 +272,9 @@ namespace etl //********************************* iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -332,17 +332,17 @@ namespace etl //********************************* const_iterator(const typename iunordered_multiset::iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } //********************************* const_iterator(const const_iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -423,9 +423,9 @@ namespace etl //********************************* const_iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -726,8 +726,8 @@ namespace etl ::new (&node.key) value_type(etl::move(key)); ETL_INCREMENT_DEBUG_COUNT - // Just add the pointer to the bucket; - bucket.insert_after(bucket.before_begin(), node); + // Just add the pointer to the bucket; + bucket.insert_after(bucket.before_begin(), node); adjust_first_last_markers_after_insert(&bucket); result.first = iterator((pbuckets + number_of_buckets), pbucket, pbucket->begin()); @@ -1196,9 +1196,11 @@ namespace etl /// Constructor. //********************************************************************* iunordered_multiset(pool_t& node_pool_, bucket_t* pbuckets_, size_t number_of_buckets_) - : pnodepool(&node_pool_), - pbuckets(pbuckets_), - number_of_buckets(number_of_buckets_) + : pnodepool(&node_pool_) + , pbuckets(pbuckets_) + , number_of_buckets(number_of_buckets_) + , first(pbuckets) + , last(pbuckets) { } @@ -1237,7 +1239,7 @@ namespace etl } first = pbuckets; - last = first; + last = first; } #if ETL_USING_CPP11 @@ -1275,7 +1277,7 @@ namespace etl if (size() == 1) { first = pbucket; - last = pbucket; + last = pbucket; } else { @@ -1298,7 +1300,7 @@ namespace etl if (empty()) { first = pbuckets; - last = pbuckets; + last = pbuckets; } else { @@ -1328,10 +1330,6 @@ namespace etl ++pcurrent; } } - else - { - // Nothing to do. - } } } @@ -1424,7 +1422,6 @@ namespace etl unordered_multiset() : base(node_pool, buckets, MAX_BUCKETS) { - base::initialise(); } //************************************************************************* @@ -1525,7 +1522,7 @@ namespace etl etl::pool node_pool; /// The buckets of node lists. - etl::intrusive_forward_list buckets[MAX_BUCKETS_]; + typename base::bucket_t buckets[MAX_BUCKETS_]; }; //************************************************************************* diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index 1dfce044..c6993d75 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -155,7 +155,7 @@ namespace etl value_type key; }; - private: + protected: typedef etl::intrusive_forward_list bucket_t; typedef etl::ipool pool_t; @@ -191,9 +191,9 @@ namespace etl //********************************* iterator(const iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -273,9 +273,9 @@ namespace etl //********************************* iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -333,17 +333,17 @@ namespace etl //********************************* const_iterator(const typename iunordered_set::iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } //********************************* const_iterator(const const_iterator& other) - : pbuckets_end(other.pbuckets_end), - pbucket(other.pbucket), - inode(other.inode) + : pbuckets_end(other.pbuckets_end) + , pbucket(other.pbucket) + , inode(other.inode) { } @@ -424,9 +424,9 @@ namespace etl //********************************* const_iterator(bucket_t* pbuckets_end_, bucket_t* pbucket_, local_iterator inode_) - : pbuckets_end(pbuckets_end_), - pbucket(pbucket_), - inode(inode_) + : pbuckets_end(pbuckets_end_) + , pbucket(pbucket_) + , inode(inode_) { } @@ -456,7 +456,7 @@ namespace etl bucket_t* pbuckets_end; bucket_t* pbucket; - local_iterator inode; + local_iterator inode; }; typedef typename etl::iterator_traits::difference_type difference_type; @@ -1190,9 +1190,11 @@ namespace etl /// Constructor. //********************************************************************* iunordered_set(pool_t& node_pool_, bucket_t* pbuckets_, size_t number_of_buckets_) - : pnodepool(&node_pool_), - pbuckets(pbuckets_), - number_of_buckets(number_of_buckets_) + : pnodepool(&node_pool_) + , pbuckets(pbuckets_) + , number_of_buckets(number_of_buckets_) + , first(pbuckets) + , last(pbuckets) { } @@ -1231,7 +1233,7 @@ namespace etl } first = pbuckets; - last = first; + last = first; } #if ETL_USING_CPP11 @@ -1298,7 +1300,7 @@ namespace etl if (empty()) { first = pbuckets; - last = pbuckets; + last = pbuckets; } else { @@ -1328,10 +1330,6 @@ namespace etl ++pcurrent; } } - else - { - // Nothing to do. - } } } @@ -1423,7 +1421,6 @@ namespace etl unordered_set() : base(node_pool, buckets, MAX_BUCKETS) { - base::initialise(); } //************************************************************************* @@ -1523,7 +1520,7 @@ namespace etl etl::pool node_pool; /// The buckets of node lists. - etl::intrusive_forward_list buckets[MAX_BUCKETS_]; + typename base::bucket_t buckets[MAX_BUCKETS_]; }; //************************************************************************* diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index 1c24a5aa..041f5792 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -338,7 +338,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::flat_map data{ ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4), ElementNDC(5, N5), ElementNDC(6, N6), ElementNDC(7, N7), ElementNDC(8, N8), ElementNDC(9, N9) }; @@ -357,7 +357,7 @@ namespace #endif //************************************************************************* - TEST(test_destruct_via_iflat_map) + TEST_FIXTURE(SetupFixture, test_destruct_via_iflat_map) { int current_count = NDC::get_instance_count(); @@ -399,7 +399,7 @@ namespace #endif //************************************************************************* - TEST(test_move_constructor) + TEST_FIXTURE(SetupFixture, test_move_constructor) { using Item = ETL_OR_STD::pair; @@ -1494,7 +1494,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_flat_map_template_deduction) + TEST_FIXTURE(SetupFixture, test_flat_map_template_deduction) { using Pair = ETL_OR_STD::pair; @@ -1515,7 +1515,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_flat_map) + TEST_FIXTURE(SetupFixture, test_make_flat_map) { using Pair = ETL_OR_STD::pair; diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index 8112096a..c87e03b3 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -299,7 +299,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::flat_multimap data{ ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4), ElementNDC(5, N5), ElementNDC(6, N6), ElementNDC(7, N7), ElementNDC(8, N8), ElementNDC(9, N9) }; @@ -318,7 +318,7 @@ namespace #endif //************************************************************************* - TEST(test_destruct_via_iflat_multimap) + TEST_FIXTURE(SetupFixture, test_destruct_via_iflat_multimap) { int current_count = NDC::get_instance_count(); @@ -366,7 +366,7 @@ namespace #endif //************************************************************************* - TEST(test_move_constructor) + TEST_FIXTURE(SetupFixture, test_move_constructor) { using Item = ETL_OR_STD::pair; @@ -1287,7 +1287,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_flat_multimap_template_deduction) + TEST_FIXTURE(SetupFixture, test_flat_multimap_template_deduction) { using Pair = ETL_OR_STD::pair; @@ -1316,7 +1316,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_flat_multimap) + TEST_FIXTURE(SetupFixture, test_make_flat_multimap) { using Pair = ETL_OR_STD::pair; diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index d2cba759..ff2eb0b5 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -267,7 +267,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::flat_multiset data{ N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; etl::flat_multiset check = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; @@ -284,7 +284,7 @@ namespace #endif //************************************************************************* - TEST(test_destruct_via_iflat_multiset) + TEST_FIXTURE(SetupFixture, test_destruct_via_iflat_multiset) { int current_count = NDC::get_instance_count(); @@ -326,7 +326,7 @@ namespace #endif //************************************************************************* - TEST(test_move_constructor) + TEST_FIXTURE(SetupFixture, test_move_constructor) { using Item = MC; @@ -1237,7 +1237,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_flat_set_template_deduction) + TEST_FIXTURE(SetupFixture, test_flat_set_template_deduction) { using Pair = ETL_OR_STD::pair; @@ -1267,7 +1267,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_flat_multiset) + TEST_FIXTURE(SetupFixture, test_make_flat_multiset) { auto data = etl::make_flat_multiset(NDC("A"), NDC("B"), NDC("B2"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index e78ecd77..08bf0723 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -280,7 +280,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::flat_set data{ N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; etl::flat_set check = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; @@ -297,7 +297,7 @@ namespace #endif //************************************************************************* - TEST(test_destruct_via_iflat_set) + TEST_FIXTURE(SetupFixture, test_destruct_via_iflat_set) { int current_count = NDC::get_instance_count(); @@ -339,7 +339,7 @@ namespace #endif //************************************************************************* - TEST(test_move_constructor) + TEST_FIXTURE(SetupFixture, test_move_constructor) { using Item = MC; @@ -1162,7 +1162,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_flat_set_template_deduction) + TEST_FIXTURE(SetupFixture, test_flat_set_template_deduction) { using Pair = ETL_OR_STD::pair; @@ -1190,7 +1190,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_flat_set) + TEST_FIXTURE(SetupFixture, test_make_flat_set) { auto data = etl::make_flat_set(NDC("A"), NDC("B"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); diff --git a/test/test_map.cpp b/test/test_map.cpp index f27d0fd9..5011fa95 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -215,7 +215,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::map data{ std::pair("0", 0), std::pair("1", 1), std::pair("2", 2), std::pair("3", 3), std::pair("4", 4), std::pair("5", 5), std::pair("6", 6), std::pair("7", 7), std::pair("8", 8), std::pair("9", 9) }; @@ -1568,7 +1568,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_map_template_deduction) + TEST_FIXTURE(SetupFixture, test_map_template_deduction) { using Pair = std::pair; @@ -1589,7 +1589,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_map) + TEST_FIXTURE(SetupFixture, test_make_map) { using Pair = ETL_OR_STD::pair; diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 3ec7d4d3..ba636703 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -217,7 +217,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::multimap data{ std::pair("0", 0), std::pair("1", 1), std::pair("2", 2), std::pair("3", 3), std::pair("4", 4), std::pair("5", 5), std::pair("6", 6), std::pair("7", 7), std::pair("8", 8), std::pair("9", 9) }; @@ -1582,7 +1582,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_multimap_template_deduction) + TEST_FIXTURE(SetupFixture, test_multimap_template_deduction) { using Pair = std::pair; @@ -1610,7 +1610,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_multimap) + TEST_FIXTURE(SetupFixture, test_make_multimap) { using Pair = ETL_OR_STD::pair; diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index 4ed9b106..03680d45 100644 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -232,7 +232,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::multiset data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; etl::multiset check = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; @@ -288,11 +288,6 @@ namespace DataM data2(std::move(data1)); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* @@ -398,11 +393,6 @@ namespace data2 = std::move(data1); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* @@ -1584,7 +1574,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_multiset_template_deduction) + TEST_FIXTURE(SetupFixture, test_multiset_template_deduction) { etl::multiset data{ std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F") }; @@ -1610,7 +1600,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_multiset) + TEST_FIXTURE(SetupFixture, test_make_multiset) { auto data = etl::make_multiset< std::string>(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); @@ -1635,7 +1625,7 @@ namespace #endif //************************************************************************* - TEST(test_contains) + TEST_FIXTURE(SetupFixture, test_contains) { std::array initial = { 1, 2, 3, 4, 5, 6 }; etl::multiset> data(initial.begin(), initial.end()); @@ -1645,7 +1635,7 @@ namespace } //************************************************************************* - TEST(test_contains_using_transparent_comparator) + TEST_FIXTURE(SetupFixture, test_contains_using_transparent_comparator) { std::array initial = { 1, 2, 3, 4, 5, 6 }; etl::multiset> data(initial.begin(), initial.end()); diff --git a/test/test_set.cpp b/test/test_set.cpp index fc3aa3a9..1f1fbdf0 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -189,7 +189,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::set data{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; etl::set check = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; @@ -246,11 +246,6 @@ namespace CHECK(!data1.empty()); // Move does not clear the source. - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); - CHECK(data2.find(ItemM(1)) != data2.end()); CHECK(data2.find(ItemM(2)) != data2.end()); CHECK(data2.find(ItemM(3)) != data2.end()); @@ -363,11 +358,6 @@ namespace data2 = std::move(data1); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* @@ -1393,7 +1383,7 @@ namespace //************************************************************************* #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) - TEST(test_set_template_deduction) + TEST_FIXTURE(SetupFixture, test_set_template_deduction) { etl::set data{ std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F") }; @@ -1419,7 +1409,7 @@ namespace //************************************************************************* #if ETL_HAS_INITIALIZER_LIST - TEST(test_make_set) + TEST_FIXTURE(SetupFixture, test_make_set) { auto data = etl::make_set< std::string>(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); @@ -1444,7 +1434,7 @@ namespace #endif //************************************************************************* - TEST(test_contains) + TEST_FIXTURE(SetupFixture, test_contains) { std::array initial = { 1, 2, 3, 4, 5, 6 }; etl::set> data(initial.begin(), initial.end()); @@ -1454,7 +1444,7 @@ namespace } //************************************************************************* - TEST(test_contains_using_transparent_comparator) + TEST_FIXTURE(SetupFixture, test_contains_using_transparent_comparator) { std::array initial = { 1, 2, 3, 4, 5, 6 }; etl::set> data(initial.begin(), initial.end()); diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 0c6b2ccf..b8fe0c2b 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -246,7 +246,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::unordered_map data{ ElementNDC(K0, N0), ElementNDC(K1, N1), ElementNDC(K2, N2), ElementNDC(K3, N3), ElementNDC(K4, N4), ElementNDC(K5, N5), ElementNDC(K6, N6), ElementNDC(K7, N7), ElementNDC(K8, N8), ElementNDC(K9, N9) }; @@ -299,7 +299,7 @@ namespace } //************************************************************************* - TEST(test_destruct_via_iunordered_map) + TEST_FIXTURE(SetupFixture, test_destruct_via_iunordered_map) { int current_count = NDC::get_instance_count(); diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index fa7286a1..9b81a3f0 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -223,7 +223,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::unordered_multimap data{ ElementNDC(K0, N0), ElementNDC(K1, N1), ElementNDC(K2, N2), ElementNDC(K3, N3), ElementNDC(K4, N4), ElementNDC(K5, N5), ElementNDC(K6, N6), ElementNDC(K7, N7), ElementNDC(K8, N8), ElementNDC(K9, N9) }; @@ -276,7 +276,7 @@ namespace } //************************************************************************* - TEST(test_destruct_via_iunordered_multimap) + TEST_FIXTURE(SetupFixture, test_destruct_via_iunordered_multimap) { int current_count = NDC::get_instance_count(); diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 936b63c5..79d56f33 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -164,7 +164,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::unordered_multiset data{ N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; etl::unordered_multiset check = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; @@ -206,16 +206,27 @@ namespace DataM data2(std::move(data1)); + size_t count1 = etl::distance(data1.begin(), data1.end()); + size_t count2 = etl::distance(data2.begin(), data2.end()); + CHECK(!data1.empty()); // Move does not clear the source. - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); + DataM::const_iterator itr = data1.begin(); + + + CHECK(data2.find(ItemM(1)) != data2.end()); + CHECK(data2.find(ItemM(2)) != data2.end()); + CHECK(data2.find(ItemM(3)) != data2.end()); + CHECK(data2.find(ItemM(4)) != data2.end()); + + CHECK(data2.find(ItemM(1))->valid); + CHECK(data2.find(ItemM(2))->valid); + CHECK(data2.find(ItemM(3))->valid); + CHECK(data2.find(ItemM(4))->valid); } //************************************************************************* - TEST(test_destruct_via_iunordered_multiset) + TEST_FIXTURE(SetupFixture, test_destruct_via_iunordered_multiset) { int current_count = NDC::get_instance_count(); @@ -294,11 +305,6 @@ namespace data2 = std::move(data1); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* diff --git a/test/test_unordered_set.cpp b/test/test_unordered_set.cpp index 6b7c7127..8570818a 100644 --- a/test/test_unordered_set.cpp +++ b/test/test_unordered_set.cpp @@ -157,7 +157,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) //************************************************************************* - TEST(test_cpp17_deduced_constructor) + TEST_FIXTURE(SetupFixture, test_cpp17_deduced_constructor) { etl::unordered_set data{ N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; etl::unordered_set check = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; @@ -200,15 +200,10 @@ namespace DataM data2(std::move(data1)); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* - TEST(test_destruct_via_iunordered_set) + TEST_FIXTURE(SetupFixture, test_destruct_via_iunordered_set) { int current_count = NDC::get_instance_count(); @@ -287,11 +282,6 @@ namespace data2 = std::move(data1); CHECK(!data1.empty()); // Move does not clear the source. - - CHECK_EQUAL(1, ItemM(1).value); - CHECK_EQUAL(2, ItemM(2).value); - CHECK_EQUAL(3, ItemM(3).value); - CHECK_EQUAL(4, ItemM(4).value); } //************************************************************************* diff --git a/test/vs2019/etl.sln b/test/vs2019/etl.sln index 3c234851..bc09716a 100644 --- a/test/vs2019/etl.sln +++ b/test/vs2019/etl.sln @@ -97,8 +97,8 @@ Global {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 No Unit Tests|Win32 - {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.Build.0 = Debug No Unit Tests|Win32 + {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 MSVC C++20 - No STL|Win32.ActiveCfg = Debug MSVC C++20 - No STL|Win32 diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 592975ed..078334aa 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -2213,7 +2213,7 @@ false - stdcpp14 + stdcpp17 /Zc:__cplusplus %(AdditionalOptions) @@ -2231,11 +2231,11 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + ../../unittest-cpp/UnitTest++/;../../include;../../test false - stdcpp14 + stdcpp17 Console @@ -2652,7 +2652,9 @@ - + + false + @@ -2695,36 +2697,33 @@ - true - true - true - true - true - true - true - true true - true - true - true - true - true true - true - true - true + true true + true + true true - true - true - true - true + true true - true - true + true + true + true + true + true + true + true + true + true true true - true + true + true + true + true + true + true + true true @@ -2757,6 +2756,7 @@ true true true + true true @@ -2789,6 +2789,7 @@ true true true + true true @@ -2821,6 +2822,7 @@ true true true + true true @@ -2853,6 +2855,7 @@ true true true + true true @@ -2885,6 +2888,7 @@ true true true + true true @@ -2917,6 +2921,7 @@ true true true + true true @@ -2949,6 +2954,7 @@ true true true + true true @@ -2981,6 +2987,7 @@ true true true + true true @@ -3013,6 +3020,7 @@ true true true + true true @@ -3045,6 +3053,7 @@ true true true + true true @@ -3072,6 +3081,11 @@ true true true + true + true + true + true + true true @@ -3100,6 +3114,7 @@ true true true + true true @@ -3132,6 +3147,7 @@ true true true + true true @@ -3164,6 +3180,7 @@ true true true + true true @@ -3196,6 +3213,7 @@ true true true + true true @@ -3228,6 +3246,7 @@ true true true + true true @@ -3260,6 +3279,7 @@ true true true + true true @@ -3288,6 +3308,7 @@ true true true + true true @@ -3316,6 +3337,7 @@ true true true + true true @@ -3348,6 +3370,7 @@ true true true + true true @@ -3380,6 +3403,7 @@ true true true + true true @@ -3412,6 +3436,7 @@ true true true + true true @@ -3440,6 +3465,7 @@ true true true + true true @@ -3468,6 +3494,7 @@ true true true + true true @@ -3496,6 +3523,7 @@ true true true + true true @@ -3528,6 +3556,7 @@ true true true + true true @@ -3560,6 +3589,7 @@ true true true + true true @@ -3592,6 +3622,7 @@ true true true + true true @@ -3624,6 +3655,7 @@ true true true + true true @@ -3656,6 +3688,7 @@ true true true + true true @@ -3688,6 +3721,7 @@ true true true + true true @@ -3720,6 +3754,7 @@ true true true + true true @@ -3752,6 +3787,7 @@ true true true + true true @@ -3784,6 +3820,7 @@ true true true + true true @@ -3816,6 +3853,7 @@ true true true + true true @@ -3848,6 +3886,7 @@ true true true + true true @@ -3880,6 +3919,7 @@ true true true + true true @@ -3912,6 +3952,7 @@ true true true + true true @@ -3944,6 +3985,7 @@ true true true + true true @@ -3976,6 +4018,7 @@ true true true + true true @@ -4008,6 +4051,7 @@ true true true + true true @@ -4040,6 +4084,7 @@ true true true + true true @@ -4072,6 +4117,7 @@ true true true + true true @@ -4104,6 +4150,7 @@ true true true + true true @@ -4136,6 +4183,7 @@ true true true + true true @@ -4168,6 +4216,7 @@ true true true + true true @@ -4200,6 +4249,7 @@ true true true + true true @@ -4232,6 +4282,7 @@ true true true + true true @@ -4264,6 +4315,7 @@ true true true + true true @@ -4296,6 +4348,7 @@ true true true + true true @@ -4328,6 +4381,7 @@ true true true + true true @@ -4360,6 +4414,7 @@ true true true + true true @@ -4392,6 +4447,7 @@ true true true + true true @@ -4424,6 +4480,7 @@ true true true + true true @@ -4456,6 +4513,7 @@ true true true + true true @@ -4488,6 +4546,7 @@ true true true + true true @@ -4520,6 +4579,7 @@ true true true + true true @@ -4552,6 +4612,7 @@ true true true + true true @@ -4584,6 +4645,7 @@ true true true + true true @@ -4616,6 +4678,7 @@ true true true + true true @@ -4648,6 +4711,7 @@ true true true + true true @@ -4680,6 +4744,7 @@ true true true + true true @@ -4712,6 +4777,7 @@ true true true + true true @@ -4744,6 +4810,7 @@ true true true + true true @@ -4776,6 +4843,7 @@ true true true + true true @@ -4808,6 +4876,7 @@ true true true + true true @@ -4840,6 +4909,7 @@ true true true + true true @@ -4872,6 +4942,7 @@ true true true + true true @@ -4904,6 +4975,7 @@ true true true + true true @@ -4936,6 +5008,7 @@ true true true + true true @@ -4968,6 +5041,7 @@ true true true + true true @@ -5000,6 +5074,7 @@ true true true + true true @@ -5032,6 +5107,7 @@ true true true + true true @@ -5064,6 +5140,7 @@ true true true + true true @@ -5096,6 +5173,7 @@ true true true + true true @@ -5128,6 +5206,7 @@ true true true + true true @@ -5160,6 +5239,7 @@ true true true + true true @@ -5192,6 +5272,7 @@ true true true + true true @@ -5224,6 +5305,7 @@ true true true + true true @@ -5256,6 +5338,7 @@ true true true + true true @@ -5288,6 +5371,7 @@ true true true + true true @@ -5320,6 +5404,7 @@ true true true + true true @@ -5352,6 +5437,7 @@ true true true + true true @@ -5384,6 +5470,36 @@ true true true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true @@ -5416,6 +5532,7 @@ true true true + true true @@ -5448,6 +5565,7 @@ true true true + true true @@ -5480,6 +5598,7 @@ true true true + true true @@ -5512,6 +5631,7 @@ true true true + true true @@ -5544,6 +5664,7 @@ true true true + true true @@ -5576,6 +5697,7 @@ true true true + true true @@ -5608,6 +5730,7 @@ true true true + true true @@ -5640,6 +5763,7 @@ true true true + true true @@ -5672,6 +5796,7 @@ true true true + true true @@ -5704,6 +5829,7 @@ true true true + true true @@ -5736,6 +5862,7 @@ true true true + true true @@ -5768,6 +5895,7 @@ true true true + true true @@ -5800,6 +5928,7 @@ true true true + true true @@ -5832,6 +5961,7 @@ true true true + true true @@ -5864,6 +5994,7 @@ true true true + true true @@ -5896,6 +6027,7 @@ true true true + true true @@ -5928,6 +6060,7 @@ true true true + true true @@ -5960,6 +6093,7 @@ true true true + true true @@ -5992,6 +6126,7 @@ true true true + true true @@ -6024,6 +6159,7 @@ true true true + true true @@ -6056,6 +6192,7 @@ true true true + true true @@ -6088,6 +6225,7 @@ true true true + true true @@ -6120,6 +6258,7 @@ true true true + true true @@ -6152,6 +6291,7 @@ true true true + true true @@ -6184,6 +6324,7 @@ true true true + true true @@ -6216,6 +6357,7 @@ true true true + true true @@ -6248,6 +6390,7 @@ true true true + true true @@ -6280,6 +6423,7 @@ true true true + true true @@ -6312,6 +6456,7 @@ true true true + true true @@ -6344,6 +6489,7 @@ true true true + true true @@ -6372,6 +6518,7 @@ true true true + true true @@ -6404,6 +6551,7 @@ true true true + true true @@ -6436,6 +6584,7 @@ true true true + true true @@ -6468,6 +6617,7 @@ true true true + true true @@ -6500,6 +6650,7 @@ true true true + true true @@ -6532,6 +6683,7 @@ true true true + true true @@ -6564,6 +6716,7 @@ true true true + true true @@ -6596,6 +6749,7 @@ true true true + true true @@ -6628,6 +6782,7 @@ true true true + true true @@ -6660,6 +6815,7 @@ true true true + true true @@ -6692,6 +6848,7 @@ true true true + true true @@ -6724,6 +6881,7 @@ true true true + true true @@ -6756,6 +6914,7 @@ true true true + true true @@ -6788,6 +6947,7 @@ true true true + true true @@ -6820,6 +6980,7 @@ true true true + true true @@ -6852,6 +7013,7 @@ true true true + true true @@ -6884,6 +7046,7 @@ true true true + true true @@ -6916,6 +7079,7 @@ true true true + true true @@ -6948,6 +7112,7 @@ true true true + true true @@ -6980,6 +7145,7 @@ true true true + true true @@ -7012,6 +7178,7 @@ true true true + true true @@ -7044,6 +7211,7 @@ true true true + true true @@ -7076,6 +7244,7 @@ true true true + true true @@ -7108,6 +7277,7 @@ true true true + true true @@ -7140,6 +7310,7 @@ true true true + true true @@ -7172,6 +7343,7 @@ true true true + true true @@ -7204,6 +7376,7 @@ true true true + true true @@ -7236,6 +7409,7 @@ true true true + true true @@ -7268,6 +7442,7 @@ true true true + true true @@ -7300,6 +7475,7 @@ true true true + true true @@ -7332,6 +7508,7 @@ true true true + true true @@ -7364,6 +7541,7 @@ true true true + true true @@ -7392,6 +7570,7 @@ true true true + true true @@ -7420,6 +7599,7 @@ true true true + true true @@ -7448,6 +7628,7 @@ true true true + true true @@ -7480,6 +7661,7 @@ true true true + true true @@ -7512,6 +7694,7 @@ true true true + true true @@ -7544,6 +7727,7 @@ true true true + true true @@ -7576,6 +7760,7 @@ true true true + true true @@ -7608,6 +7793,7 @@ true true true + true true @@ -7636,6 +7822,7 @@ true true true + true true @@ -7664,6 +7851,7 @@ true true true + true true @@ -7696,6 +7884,7 @@ true true true + true true @@ -7728,6 +7917,7 @@ true true true + true true @@ -7760,6 +7950,7 @@ true true true + true true @@ -7788,6 +7979,7 @@ true true true + true true @@ -7820,6 +8012,7 @@ true true true + true true @@ -7852,6 +8045,7 @@ true true true + true true @@ -7884,6 +8078,7 @@ true true true + true true @@ -7916,6 +8111,7 @@ true true true + true true @@ -7948,6 +8144,7 @@ true true true + true true @@ -7980,6 +8177,7 @@ true true true + true true @@ -8012,6 +8210,7 @@ true true true + true true @@ -8044,6 +8243,7 @@ true true true + true true @@ -8076,6 +8276,7 @@ true true true + true true @@ -8108,6 +8309,7 @@ true true true + true true @@ -8140,6 +8342,7 @@ true true true + true true @@ -8172,6 +8375,7 @@ true true true + true true @@ -8204,6 +8408,7 @@ true true true + true true @@ -8236,6 +8441,7 @@ true true true + true true @@ -8268,6 +8474,7 @@ true true true + true true @@ -8300,6 +8507,7 @@ true true true + true true @@ -8332,6 +8540,7 @@ true true true + true true @@ -8364,6 +8573,7 @@ true true true + true true @@ -8396,6 +8606,7 @@ true true true + true true @@ -8428,6 +8639,7 @@ true true true + true true @@ -8460,6 +8672,7 @@ true true true + true true @@ -8492,6 +8705,7 @@ true true true + true true @@ -8524,6 +8738,7 @@ true true true + true true @@ -8556,6 +8771,7 @@ true true true + true true @@ -8588,6 +8804,7 @@ true true true + true true @@ -8620,6 +8837,7 @@ true true true + true true @@ -8652,6 +8870,7 @@ true true true + true true @@ -8684,6 +8903,7 @@ true true true + true true @@ -8716,6 +8936,7 @@ true true true + true true @@ -8748,6 +8969,7 @@ true true true + true true @@ -8780,6 +9002,7 @@ true true true + true true @@ -8812,6 +9035,7 @@ true true true + true true @@ -8844,6 +9068,7 @@ true true true + true true @@ -8876,6 +9101,7 @@ true true true + true true @@ -8908,6 +9134,7 @@ true true true + true true @@ -8940,6 +9167,7 @@ true true true + true true @@ -8972,6 +9200,7 @@ true true true + true true @@ -9004,6 +9233,7 @@ true true true + true true @@ -9036,6 +9266,7 @@ true true true + true true @@ -9064,6 +9295,7 @@ true true true + true true @@ -9096,6 +9328,7 @@ true true true + true true @@ -9128,6 +9361,7 @@ true true true + true true @@ -9160,6 +9394,7 @@ true true true + true true @@ -9192,6 +9427,7 @@ true true true + true true @@ -9224,6 +9460,7 @@ true true true + true true @@ -9256,6 +9493,7 @@ true true true + true true @@ -9288,6 +9526,7 @@ true true true + true true @@ -9320,6 +9559,7 @@ true true true + true true @@ -9352,6 +9592,7 @@ true true true + true true @@ -9384,6 +9625,7 @@ true true true + true true @@ -9416,6 +9658,7 @@ true true true + true true @@ -9448,6 +9691,7 @@ true true true + true true @@ -9480,6 +9724,7 @@ true true true + true true @@ -9512,6 +9757,7 @@ true true true + true true @@ -9544,6 +9790,7 @@ true true true + true true @@ -9576,6 +9823,7 @@ true true true + true true @@ -9608,6 +9856,7 @@ true true true + true true @@ -9640,6 +9889,7 @@ true true true + true true @@ -9672,6 +9922,7 @@ true true true + true true @@ -9704,6 +9955,7 @@ true true true + true true @@ -9736,6 +9988,7 @@ true true true + true true @@ -9768,6 +10021,7 @@ true true true + true true @@ -9800,6 +10054,7 @@ true true true + true true @@ -9832,6 +10087,7 @@ true true true + true true @@ -9864,6 +10120,7 @@ true true true + true true @@ -9896,6 +10153,7 @@ true true true + true true @@ -9928,6 +10186,7 @@ true true true + true true @@ -9960,6 +10219,7 @@ true true true + true true @@ -9992,6 +10252,7 @@ true true true + true true @@ -10020,6 +10281,7 @@ true true true + true true @@ -10052,6 +10314,7 @@ true true true + true true @@ -10084,6 +10347,7 @@ true true true + true true @@ -10116,6 +10380,7 @@ true true true + true true @@ -10148,6 +10413,7 @@ true true true + true true @@ -10180,6 +10446,7 @@ true true true + true true @@ -10212,6 +10479,7 @@ true true true + true true @@ -10244,6 +10512,7 @@ true true true + true true @@ -10276,6 +10545,7 @@ true true true + true true @@ -10308,6 +10578,7 @@ true true true + true true @@ -10340,6 +10611,7 @@ true true true + true true @@ -10372,6 +10644,7 @@ true true true + true true @@ -10404,6 +10677,7 @@ true true true + true true @@ -10436,6 +10710,7 @@ true true true + true true @@ -10468,6 +10743,7 @@ true true true + true true @@ -10500,6 +10776,7 @@ true true true + true true @@ -10532,6 +10809,7 @@ true true true + true true @@ -10564,6 +10842,7 @@ true true true + true true @@ -10596,6 +10875,7 @@ true true true + true diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index f232ffe3..d9b0a5d7 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -2201,81 +2201,6 @@ Tests\Binary - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - - - Tests\Sanity Checks - Tests\Misc @@ -2285,9 +2210,6 @@ Tests\Messaging - - Tests\Sanity Checks\Source - Tests\Sanity Checks\Source @@ -3245,6 +3167,87 @@ Tests\Patterns + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source + + + Tests\Sanity Checks\Source +