diff --git a/include/etl/alignment.h b/include/etl/alignment.h index ab2ad6fa..c6a4de06 100644 --- a/include/etl/alignment.h +++ b/include/etl/alignment.h @@ -76,9 +76,8 @@ namespace etl //***************************************************************************** inline bool is_aligned(void* p, size_t required_alignment) { - uintptr_t alignment = static_cast(required_alignment); uintptr_t address = reinterpret_cast(p); - return (address % alignment) == 0U; + return (address % required_alignment) == 0U; } //***************************************************************************** @@ -88,7 +87,7 @@ namespace etl bool is_aligned(void* p) { uintptr_t address = reinterpret_cast(p); - return (address % static_cast(Alignment)) == 0U; + return (address % Alignment) == 0U; } //***************************************************************************** diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 9734a9b0..6dcc50f7 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -350,7 +350,8 @@ namespace etl { unsigned char mask_width = static_cast(etl::min(nbits, bits_available_in_char)); nbits -= mask_width; - uint32_t mask = ((uint32_t(1U) << mask_width) - 1U) << nbits; + uint32_t mask = ((1U << mask_width) - 1U) << nbits; + //uint32_t mask = ((uint32_t(1U) << mask_width) - 1U) << nbits; // Move chunk to lowest char bits. // Chunks are never larger than one char. @@ -628,7 +629,7 @@ namespace etl void write_unchecked(bool value) { unsigned char chunk = value ? 1 : 0; - write_data(static_cast(chunk), 1); + write_data(chunk, 1); } //*************************************************************************** diff --git a/include/etl/byte_stream.h b/include/etl/byte_stream.h index 4152ff4a..aaa9d8a4 100644 --- a/include/etl/byte_stream.h +++ b/include/etl/byte_stream.h @@ -261,7 +261,7 @@ namespace etl //*************************************************************************** void restart(size_t n = 0U) { - pcurrent = const_cast(pdata + n); + pcurrent = pdata + n; } //*************************************************************************** diff --git a/include/etl/char_traits.h b/include/etl/char_traits.h index f9b9247f..8ffeb7fd 100644 --- a/include/etl/char_traits.h +++ b/include/etl/char_traits.h @@ -56,6 +56,24 @@ namespace etl typedef char state_type; }; + template<> struct char_traits_types + { + typedef signed char char_type; + typedef int int_type; + typedef long long off_type; + typedef size_t pos_type; + typedef signed char state_type; + }; + + template<> struct char_traits_types + { + typedef unsigned char char_type; + typedef int int_type; + typedef long long off_type; + typedef size_t pos_type; + typedef unsigned char state_type; + }; + template<> struct char_traits_types { typedef wchar_t char_type; @@ -65,6 +83,7 @@ namespace etl typedef char state_type; }; +#if ETL_USING_CPP20 template<> struct char_traits_types { typedef char8_t char_type; @@ -73,6 +92,7 @@ namespace etl typedef size_t pos_type; typedef char state_type; }; +#endif template<> struct char_traits_types { diff --git a/include/etl/debounce.h b/include/etl/debounce.h index aad3ff40..6997af8b 100644 --- a/include/etl/debounce.h +++ b/include/etl/debounce.h @@ -55,7 +55,7 @@ namespace etl void add_sample(bool sample) { // Changed from last time? - if (sample != bool((flags & Sample) != 0)) + if (sample != ((flags & Sample) != 0)) { count = 0; flags = (flags & ~Sample) | (sample ? Sample : 0); diff --git a/include/etl/endianness.h b/include/etl/endianness.h index 2c433f3f..69f03770 100644 --- a/include/etl/endianness.h +++ b/include/etl/endianness.h @@ -49,9 +49,9 @@ SOFTWARE. #if !defined(ETL_ENDIAN_NATIVE) // Can we use the C++20 definitions? #if ETL_USING_CPP20 && ETL_USING_STL - #define ETL_ENDIAN_LITTLE std::endian::little - #define ETL_ENDIAN_BIG std::endian::big - #define ETL_ENDIAN_NATIVE std::endian::native + #define ETL_ENDIAN_LITTLE static_cast(std::endian::little) + #define ETL_ENDIAN_BIG static_cast(std::endian::big) + #define ETL_ENDIAN_NATIVE static_cast(std::endian::native) // Is this the IAR compiler? #elif defined(ETL_COMPILER_IAR) && defined(__LITTLE_ENDIAN__) #define ETL_ENDIAN_LITTLE 0 @@ -100,14 +100,14 @@ namespace etl { enum enum_type { - little = static_cast(ETL_ENDIAN_LITTLE), - big = static_cast(ETL_ENDIAN_BIG), - native = static_cast(ETL_ENDIAN_NATIVE), + little = ETL_ENDIAN_LITTLE, + big = ETL_ENDIAN_BIG, + native = ETL_ENDIAN_NATIVE }; ETL_DECLARE_ENUM_TYPE(endian, int) - ETL_ENUM_TYPE(little, "little") - ETL_ENUM_TYPE(big, "big") + ETL_ENUM_TYPE(little, "little") + ETL_ENUM_TYPE(big, "big") ETL_END_ENUM_TYPE }; diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index b22887fd..d2cf8ce6 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -313,7 +313,7 @@ namespace etl /// is_signed template struct is_signed : false_type {}; template <> struct is_signed : etl::bool_constant<(char(255) < 0)> {}; - template <> struct is_signed : public etl::bool_constant(wchar_t(-1) < wchar_t(0))> {}; + template <> struct is_signed : public etl::bool_constant {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; diff --git a/include/etl/hash.h b/include/etl/hash.h index 256a6fbb..8066a012 100644 --- a/include/etl/hash.h +++ b/include/etl/hash.h @@ -47,6 +47,8 @@ SOFTWARE. ///\defgroup hash Standard hash calculations ///\ingroup maths +#include "private/diagnostic_useless_cast_push.h" + namespace etl { namespace private_hash @@ -433,7 +435,7 @@ namespace etl double v; } u; - if (!(v < 0.0) && !(v > 0.0)) + if (etl::is_zero(v)) { // -0.0 and 0.0 are represented differently at bit level v = 0.0; } @@ -467,7 +469,7 @@ namespace etl long double v; } u; - if (!(v < 0.0L) && !(v > 0.0L)) + if (etl::is_zero(v)) { // -0.0 and 0.0 are represented differently at bit level v = 0.0L; } @@ -536,6 +538,8 @@ namespace etl } } +#include "private/diagnostic_pop.h" + #endif // ETL_USING_8BIT_TYPES #endif diff --git a/include/etl/limits.h b/include/etl/limits.h index 48185d2f..d64f6c57 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -54,7 +54,7 @@ SOFTWARE. #endif #if ETL_NOT_USING_STL -#define ETL_LOG10_OF_2(x) (((x) * 301) / 1000) + #define ETL_LOG10_OF_2(x) (((x) * 301) / 1000) #if !defined(LDBL_MIN) && defined(DBL_MIN) // Looks like we don't have these macros defined. @@ -80,20 +80,24 @@ SOFTWARE. #if defined(ETL_NO_CPP_NAN_SUPPORT) #if defined(NAN) - #define ETL_NAN (double)NAN - #define ETL_NANF (float)NAN - #define ETL_NANL (long double)NAN + #include "etl/private/diagnostic_useless_cast_push.h" + #define ETL_NANF NAN + #define ETL_NAN static_cast(NAN) + #define ETL_NANL static_cast(NAN) #define ETL_HAS_NAN true + #include "etl/private/diagnostic_pop.h" #else - #define ETL_NAN (double)0.0 - #define ETL_NANF (float)0.0 - #define ETL_NANL (long double)0.0 + #include "etl/private/diagnostic_useless_cast_push.h" + #define ETL_NANF HUGE_VALF + #define ETL_NAN HUGE_VAL + #define ETL_NANL HUGE_VALL #define ETL_HAS_NAN false + #include "etl/private/diagnostic_pop.h" #endif #else - #define ETL_NAN nan("") - #define ETL_NANF nanf("") - #define ETL_NANL nanl("") + #define ETL_NANF nanf("") + #define ETL_NAN nan("") + #define ETL_NANL nanl("") #define ETL_HAS_NAN true #endif @@ -101,18 +105,18 @@ namespace etl { enum float_round_style { - round_indeterminate = -1, - round_toward_zero = 0, - round_to_nearest = 1, - round_toward_infinity = 2, + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, round_toward_neg_infinity = 3, }; enum float_denorm_style { denorm_indeterminate = -1, - denorm_absent = 0, - denorm_present = 1 + denorm_absent = 0, + denorm_present = 1 }; namespace private_limits diff --git a/include/etl/private/diagnostic_self_assign_overloaded_push.h b/include/etl/private/diagnostic_self_assign_overloaded_push.h index d5184415..803fbde7 100644 --- a/include/etl/private/diagnostic_self_assign_overloaded_push.h +++ b/include/etl/private/diagnostic_self_assign_overloaded_push.h @@ -33,6 +33,10 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ +#if defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__) + #pragma GCC diagnostic push +#endif + #if defined(__clang__) || defined(__llvm__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wself-assign-overloaded" diff --git a/include/etl/private/diagnostic_useless_cast_push.h b/include/etl/private/diagnostic_useless_cast_push.h new file mode 100644 index 00000000..9c9f0f0d --- /dev/null +++ b/include/etl/private/diagnostic_useless_cast_push.h @@ -0,0 +1,43 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2023 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +/* + * The header include guard has been intentionally omitted. + * This file is intended to evaluated multiple times by design. + */ + +#if defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + +#if defined(__clang__) || defined(__llvm__) + #pragma clang diagnostic push +#endif diff --git a/include/etl/private/to_string_helper.h b/include/etl/private/to_string_helper.h index 8c6768cd..2c3cbed5 100644 --- a/include/etl/private/to_string_helper.h +++ b/include/etl/private/to_string_helper.h @@ -43,6 +43,7 @@ SOFTWARE. #include "../algorithm.h" #include "../iterator.h" #include "../math.h" +#include "../limits.h" #include @@ -307,9 +308,9 @@ namespace etl iterator start = str.end(); - if (etl::is_nan(value) || etl::is_infinity(value)) + if (isnan(value) || isinf(value)) { - etl::private_to_string::add_nan_inf(etl::is_nan(value), etl::is_infinity(value), str); + etl::private_to_string::add_nan_inf(isnan(value), isinf(value), str); } else { diff --git a/include/etl/random.h b/include/etl/random.h index bd4097a0..e24bb84d 100644 --- a/include/etl/random.h +++ b/include/etl/random.h @@ -462,10 +462,12 @@ namespace etl random_pcg() { +#include "etl/private/diagnostic_useless_cast_push.h" // An attempt to come up with a unique non-zero seed, // based on the address of the instance. uintptr_t n = reinterpret_cast(this); value = static_cast(n); +#include "etl/private/diagnostic_pop.h" } //*************************************************************************** diff --git a/include/etl/reference_counted_object.h b/include/etl/reference_counted_object.h index 28b3cb5a..e3458611 100644 --- a/include/etl/reference_counted_object.h +++ b/include/etl/reference_counted_object.h @@ -171,7 +171,7 @@ namespace etl //*************************************************************************** ETL_NODISCARD virtual int32_t decrement_reference_count() ETL_OVERRIDE { - return int32_t(1); + return 1; } //*************************************************************************** @@ -179,7 +179,7 @@ namespace etl //*************************************************************************** ETL_NODISCARD virtual int32_t get_reference_count() const ETL_OVERRIDE { - return int32_t(1); + return 1; } }; diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 90f87a47..cb4fc726 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -301,7 +301,7 @@ namespace etl /// is_signed template struct is_signed : false_type {}; template <> struct is_signed : etl::bool_constant<(char(255) < 0)> {}; - template <> struct is_signed : public etl::bool_constant(wchar_t(-1) < wchar_t(0))> {}; + template <> struct is_signed : public etl::bool_constant {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; diff --git a/include/etl/utility.h b/include/etl/utility.h index 5e37b342..52cf0d37 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -337,7 +337,7 @@ namespace etl inline bool operator ==(const pair& a, const pair& b) { #include "private/diagnostic_float_equal_push.h" - return (a.first == b.first) && (a.second == b.second); + return (a.first == b.first) && !(a.second < b.second) && !(a.second > b.second); #include "private/diagnostic_pop.h" } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3e821e45..4869a7c8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -371,7 +371,20 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") message(STATUS "Using Clang compiler") endif () -if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(etl_tests + PRIVATE + -fno-omit-frame-pointer + -fno-common + -Wall + -Wextra + -Werror + -Wfloat-equal + -Wuseless-cast + ) +endif () + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(etl_tests PRIVATE -fno-omit-frame-pointer @@ -381,7 +394,9 @@ if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Cla -Werror -Wfloat-equal ) +endif () +if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) if (ETL_ENABLE_SANITIZER) message(STATUS "Compiling with Sanitizer enabled") # MinGW doesn't presently support sanitization diff --git a/test/etl_error_handler/log_errors/test_error_handler.cpp b/test/etl_error_handler/log_errors/test_error_handler.cpp index ade19548..1b8d7bf4 100644 --- a/test/etl_error_handler/log_errors/test_error_handler.cpp +++ b/test/etl_error_handler/log_errors/test_error_handler.cpp @@ -31,8 +31,6 @@ SOFTWARE. #include #include -etl::error_handler eh; - //***************************************************************************** struct ErrorLog { @@ -124,7 +122,7 @@ int main() { static ErrorLog error_log; - etl::error_handler::set_callback(error_log); + etl::error_handler::set_callback(); Assert(false); Assert(true); diff --git a/test/murmurhash3.cpp b/test/murmurhash3.cpp index 537427f8..c50769af 100644 --- a/test/murmurhash3.cpp +++ b/test/murmurhash3.cpp @@ -132,7 +132,7 @@ void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out) //---------- // tail - const uint8_t * tail = (const uint8_t*)(data + nblocks * 4); + const uint8_t * tail = data + nblocks * 4; uint32_t k1 = 0U; @@ -204,7 +204,7 @@ void MurmurHash3_x86_128(const void * key, const int len, //---------- // tail - const uint8_t * tail = (const uint8_t*)(data + nblocks * 16); + const uint8_t * tail = data + nblocks * 16; uint32_t k1 = 0U; uint32_t k2 = 0U; @@ -296,7 +296,7 @@ void MurmurHash3_x64_128(const void * key, const int len, //---------- // tail - const uint8_t * tail = (const uint8_t*)(data + nblocks * 16); + const uint8_t * tail = data + nblocks * 16; uint64_t k1 = 0ULL; uint64_t k2 = 0ULL; diff --git a/test/run-syntax-checks.sh b/test/run-syntax-checks.sh index ed7d3290..76b5a7eb 100644 --- a/test/run-syntax-checks.sh +++ b/test/run-syntax-checks.sh @@ -3,7 +3,7 @@ clear echo -e -testname="Test Name Not Set" +configuration_name="Configuration Name Not Set" FailColour='\033[38;2;255;128;128m' PassColour='\033[38;2;128;255;128m' @@ -20,19 +20,21 @@ SetCxxStandard() cxx_standard=$1 } -SetTestName() +SetConfigurationName() { - testname=$1 + configuration_name=$1 } PrintHeader() { echo "$TitleColour" echo "============================================================================" | tee -a log.txt - echo " $testname " | tee -a log.txt + echo " Configuration : $configuration_name " | tee -a log.txt + echo " Compiler : $compiler " | tee -a log.txt echo " Language standard : C++$cxx_standard " | tee -a log.txt - echo -n " ETL version : " | cat - ../../../version.txt | tee -a log.txt - echo " Git branch : "$(ParseGitBranch) | tee -a log.txt + echo " ETL Version : $etl_version " | tee -a log.txt + echo " Git branch : $(ParseGitBranch) " | tee -a log.txt + echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL} " | tee -a log.txt echo "============================================================================" | tee -a log.txt echo "$NoColour" } @@ -76,20 +78,29 @@ else export CMAKE_BUILD_PARALLEL_LEVEL=$1 fi -echo "" -echo "Using "$CMAKE_BUILD_PARALLEL_LEVEL" concurrent processes" +#****************************************************************************** +# Get the ETL version +#****************************************************************************** +etl_version_raw=$(cat ../../version.txt) +etl_version=$(echo $etl_version_raw | sed -e 's/\r//g') # Remove trailing \r + +#****************************************************************************** +# Get the compiler versions +#****************************************************************************** +gcc_compiler=$(g++ --version | grep g++) +clang_compiler=$(clang++ --version | grep clang) ############################################################################### cd c++03 || exit 1 SetCxxStandard "03 (98)" -SetTestName "GCC - STL" +SetConfigurationName "STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -99,12 +110,12 @@ else exit $? fi -SetTestName "GCC - No STL" +SetConfigurationName "No STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -114,12 +125,12 @@ else exit $? fi -##SetTestName "GCC - No STL - User defined traits" +##SetConfigurationName "No STL - User defined traits" +#compiler=$gcc_compiler # PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#g++ --version | head --lines=1 | tee -a ../log.txt #CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bgcc #if [ $? -eq 0 ]; then @@ -129,12 +140,12 @@ fi # exit $? #fi -SetTestName "GCC - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -144,12 +155,12 @@ else exit $? fi -SetTestName "GCC - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -159,12 +170,12 @@ else exit $? fi -SetTestName "Clang - STL" +SetConfigurationName "STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -174,12 +185,12 @@ else exit $? fi -SetTestName "Clang - No STL" +SetConfigurationName "No STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -189,12 +200,12 @@ else exit $? fi -#SetTestName "Clang - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$clang_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#clang++ --version | head --lines=1 | tee -a ../log.txt #CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bclang #if [ $? -eq 0 ]; then @@ -204,12 +215,12 @@ fi # exit $? #fi -SetTestName "Clang - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -219,12 +230,12 @@ else exit $? fi -SetTestName "Clang - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -239,12 +250,12 @@ cd ../c++11 || exit 1 SetCxxStandard "11" -SetTestName "GCC - STL" +SetConfigurationName "STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -254,12 +265,12 @@ else exit $? fi -SetTestName "GCC - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -269,12 +280,12 @@ else exit $? fi -SetTestName "GCC - No STL" +SetConfigurationName "No STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -284,12 +295,12 @@ else exit $? fi -SetTestName "GCC - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -299,12 +310,12 @@ else exit $? fi -#SetTestName "GCC - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$gcc_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#g++ --version | head --lines=1 | tee -a ../log.txt #CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bgcc #if [ $? -eq 0 ]; then @@ -314,12 +325,12 @@ fi # exit $? #fi -SetTestName "GCC - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -329,12 +340,12 @@ else exit $? fi -SetTestName "GCC - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -344,12 +355,12 @@ else exit $? fi -SetTestName "Clang - STL" +SetConfigurationName "STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -359,12 +370,12 @@ else exit $? fi -SetTestName "Clang - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -374,12 +385,12 @@ else exit $? fi -SetTestName "Clang - No STL" +SetConfigurationName "No STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -389,12 +400,12 @@ else exit $? fi -SetTestName "Clang - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -404,13 +415,13 @@ else exit $? fi -#SetTestName "Clang - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$clang_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#clang++ --version | head --lines=1 | tee -a ../log.txt -#CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +##CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bclang #if [ $? -eq 0 ]; then # PassedCompilation @@ -419,12 +430,12 @@ fi # exit $? #fi -SetTestName "Clang - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -434,12 +445,12 @@ else exit $? fi -SetTestName "Clang - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -454,12 +465,12 @@ cd ../c++14 || exit 1 SetCxxStandard "14" -SetTestName "GCC - STL" +SetConfigurationName "STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -469,12 +480,12 @@ else exit $? fi -SetTestName "GCC - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -484,12 +495,12 @@ else exit $? fi -SetTestName "GCC - No STL" +SetConfigurationName "No STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -499,12 +510,12 @@ else exit $? fi -SetTestName "GCC - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -514,12 +525,12 @@ else exit $? fi -#SetTestName "GCC - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$gcc_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#g++ --version | head --lines=1 | tee -a ../log.txt #CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bgcc #if [ $? -eq 0 ]; then @@ -529,12 +540,12 @@ fi # exit $? #fi -SetTestName "GCC - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -544,12 +555,12 @@ else exit $? fi -SetTestName "GCC - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -559,12 +570,12 @@ else exit $? fi -SetTestName "Clang - STL" +SetConfigurationName "STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -574,12 +585,12 @@ else exit $? fi -SetTestName "Clang - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -589,12 +600,12 @@ else exit $? fi -SetTestName "Clang - No STL" +SetConfigurationName "No STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -604,12 +615,12 @@ else exit $? fi -SetTestName "Clang - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -619,13 +630,13 @@ else exit $? fi -#SetTestName "Clang - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$clang_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#clang++ --version | head --lines=1 | tee -a ../log.txt -#CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. +##CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bclang #if [ $? -eq 0 ]; then # PassedCompilation @@ -634,12 +645,12 @@ fi # exit $? #fi -SetTestName "Clang - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -649,12 +660,12 @@ else exit $? fi -SetTestName "Clang - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -669,12 +680,12 @@ cd ../c++17 || exit 1 SetCxxStandard "17" -SetTestName "GCC - STL" +SetConfigurationName "STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -684,12 +695,12 @@ else exit $? fi -SetTestName "GCC - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -699,12 +710,12 @@ else exit $? fi -SetTestName "GCC - No STL" +SetConfigurationName "No STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -714,12 +725,12 @@ else exit $? fi -SetTestName "GCC - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -729,12 +740,12 @@ else exit $? fi -#SetTestName "GCC - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$gcc_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#g++ --version | head --lines=1 | tee -a ../log.txt #CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bgcc #if [ $? -eq 0 ]; then @@ -744,12 +755,12 @@ fi # exit $? #fi -SetTestName "GCC - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -759,12 +770,12 @@ else exit $? fi -SetTestName "GCC - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -774,12 +785,12 @@ else exit $? fi -SetTestName "Clang - STL" +SetConfigurationName "STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -789,12 +800,12 @@ else exit $? fi -SetTestName "Clang - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -804,12 +815,12 @@ else exit $? fi -SetTestName "Clang - No STL" +SetConfigurationName "No STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -819,12 +830,12 @@ else exit $? fi -SetTestName "Clang - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -834,12 +845,12 @@ else exit $? fi -#SetTestName "Clang - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$clang_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#clang++ --version | head --lines=1 | tee -a ../log.txt #CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bclang #if [ $? -eq 0 ]; then @@ -849,12 +860,12 @@ fi # exit $? #fi -SetTestName "Clang - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -864,12 +875,12 @@ else exit $? fi -SetTestName "Clang - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -884,12 +895,12 @@ cd ../c++20 || exit 1 SetCxxStandard "20" -SetTestName "GCC - STL" +SetConfigurationName "STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -899,12 +910,12 @@ else exit $? fi -SetTestName "GCC - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -914,12 +925,12 @@ else exit $? fi -SetTestName "GCC - No STL" +SetConfigurationName "No STL" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -929,12 +940,12 @@ else exit $? fi -SetTestName "GCC - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -944,12 +955,12 @@ else exit $? fi -#SetTestName "GCC - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$gcc_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#g++ --version | head --lines=1 | tee -a ../log.txt #CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bgcc #if [ $? -eq 0 ]; then @@ -959,12 +970,12 @@ fi # exit $? #fi -SetTestName "GCC - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -974,12 +985,12 @@ else exit $? fi -SetTestName "GCC - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$gcc_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -989,12 +1000,12 @@ else exit $? fi -SetTestName "Clang - STL" +SetConfigurationName "STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -1004,12 +1015,12 @@ else exit $? fi -SetTestName "Clang - STL - Force C++03" +SetConfigurationName "STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -1019,12 +1030,12 @@ else exit $? fi -SetTestName "Clang - No STL" +SetConfigurationName "No STL" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bclang if [ $? -eq 0 ]; then @@ -1034,12 +1045,12 @@ else exit $? fi -SetTestName "Clang - No STL - Force C++03" +SetConfigurationName "No STL - Force C++03" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -clang++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON .. cmake --build bclang if [ $? -eq 0 ]; then @@ -1049,12 +1060,12 @@ else exit $? fi -#SetTestName "Clang - No STL - User defined traits" +#SetConfigurationName "No STL - User defined traits" +#compiler=$clang_compiler #PrintHeader #rm -rdf bgcc #rm -rdf bclang #cmake -E make_directory bgcc bclang -#clang++ --version | head --lines=1 | tee -a ../log.txt #CC=clang CXX=clang++ cmake -E chdir bclang cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=ON -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. #cmake --build bclang #if [ $? -eq 0 ]; then @@ -1064,12 +1075,12 @@ fi # exit $? #fi -SetTestName "Clang - STL - Built-in traits" +SetConfigurationName "STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then @@ -1079,12 +1090,12 @@ else exit $? fi -SetTestName "Clang - No STL - Built-in traits" +SetConfigurationName "No STL - Built-in traits" +compiler=$clang_compiler PrintHeader rm -rdf bgcc rm -rdf bclang cmake -E make_directory bgcc bclang -g++ --version | head --lines=1 | tee -a ../log.txt CC=clang CXX=clang++ cmake -E chdir bgcc cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=ON -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF .. cmake --build bgcc if [ $? -eq 0 ]; then diff --git a/test/run-tests.sh b/test/run-tests.sh index eb61987b..90433c4e 100644 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -11,7 +11,7 @@ export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-14/bin//llvm-symbolizer echo -e -testname="Test Name Not Set" +configuration_name="Configuration Name Not Set" FailColour='\033[38;2;255;128;128m' PassColour='\033[38;2;128;255;128m' @@ -24,9 +24,9 @@ ParseGitBranch() git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } -SetTestName() +SetConfigurationName() { - testname=$1 + configuration_name=$1 } Bell() @@ -38,12 +38,14 @@ PrintHeader() { echo "$TitleColour" echo "============================================================================" | tee -a log.txt - echo " $testname " | tee -a log.txt + echo " Configuration : $configuration_name " | tee -a log.txt + echo " Compiler : $compiler " | tee -a log.txt echo " Language standard : C++$cxx_standard " | tee -a log.txt echo " Optimisation : $opt " | tee -a log.txt echo " Sanitizer : $sanitize " | tee -a log.txt - echo -n " ETL version : " | cat - ../../version.txt | tee -a log.txt - echo " Git branch : "$(ParseGitBranch) | tee -a log.txt + echo " ETL Version : $etl_version " | tee -a log.txt + echo " Git branch : $(ParseGitBranch) " | tee -a log.txt + echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL} " | tee -a log.txt echo "============================================================================" | tee -a log.txt echo "$NoColour" } @@ -144,9 +146,6 @@ else export CMAKE_BUILD_PARALLEL_LEVEL=$3 fi -echo "" -echo "Using "${CMAKE_BUILD_PARALLEL_LEVEL}" concurrent processes" - #****************************************************************************** # Set the sanitizer enable. Default OFF #****************************************************************************** @@ -156,14 +155,26 @@ else sanitize="OFF" fi +#****************************************************************************** +# Get the ETL version +#****************************************************************************** +etl_version_raw=$(cat ../../version.txt) +etl_version=$(echo $etl_version_raw | sed -e 's/\r//g') # Remove trailing \r + +#****************************************************************************** +# Get the compiler versions +#****************************************************************************** +gcc_compiler=$(g++ --version | grep g++) +clang_compiler=$(clang++ --version | grep clang++) + #****************************************************************************** # GCC #****************************************************************************** -SetTestName "GCC - STL" +compiler=$gcc_compiler +SetConfigurationName "STL" PrintHeader rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -180,11 +191,11 @@ else fi #****************************************************************************** -SetTestName "GCC - STL - Non-virtual messages" +compiler=$gcc_compiler +SetConfigurationName "STL - Non-virtual messages" PrintHeader rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=ON .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=ON .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -201,11 +212,11 @@ else fi #****************************************************************************** -SetTestName "GCC - STL - Force C++03" +compiler=$gcc_compiler +SetConfigurationName "STL - Force C++03" PrintHeader rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -222,11 +233,11 @@ else fi #****************************************************************************** -SetTestName "GCC - No STL" +compiler=$gcc_compiler +SetConfigurationName "No STL" PrintHeader rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -243,11 +254,11 @@ else fi #****************************************************************************** -SetTestName "GCC - No STL - Force C++03" +compiler=$gcc_compiler +SetConfigurationName "No STL - Force C++03" PrintHeader rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -266,11 +277,11 @@ fi #****************************************************************************** # CLANG #****************************************************************************** -SetTestName "Clang - STL" +compiler=$clang_compiler +SetConfigurationName "STL" PrintHeader rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -287,11 +298,11 @@ else fi #****************************************************************************** -SetTestName "Clang - STL - Force C++03" +compiler=$clang_compiler +SetConfigurationName "STL - Force C++03" PrintHeader rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -308,11 +319,11 @@ else fi #****************************************************************************** -SetTestName "Clang - No STL" +compiler=$clang_compiler +SetConfigurationName "No STL" PrintHeader rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -329,11 +340,11 @@ else fi #****************************************************************************** -SetTestName "Clang - No STL - Force C++03" +compiler=$clang_compiler +SetConfigurationName "No STL - Force C++03" PrintHeader rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -350,14 +361,14 @@ else fi #****************************************************************************** -SetTestName "GCC - Initializer list test" +compiler=$gcc_compiler +SetConfigurationName "Initializer list test" PrintHeader cd ../etl_initializer_list/ mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -374,11 +385,11 @@ else fi #****************************************************************************** -SetTestName "Clang - Initializer list test" +compiler=$clang_compiler +SetConfigurationName "Initializer list test" PrintHeader rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -395,14 +406,14 @@ else fi #****************************************************************************** -SetTestName "GCC - Error macros 'log_errors' test" +compiler=$gcc_compiler +SetConfigurationName "Error macros 'log_errors' test" PrintHeader cd ../../etl_error_handler/log_errors mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -419,14 +430,14 @@ else fi #****************************************************************************** -SetTestName "GCC - Error macros 'exceptions' test" +compiler=$gcc_compiler +SetConfigurationName "Error macros 'exceptions' test" PrintHeader cd ../../../etl_error_handler/exceptions mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -443,14 +454,14 @@ else fi #****************************************************************************** -SetTestName "GCC - Error macros 'log_errors and exceptions' test" +compiler=$gcc_compiler +SetConfigurationName "Error macros 'log_errors and exceptions' test" PrintHeader cd ../../../etl_error_handler/log_errors_and_exceptions mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -gcc --version | grep gcc | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -467,14 +478,14 @@ else fi #****************************************************************************** -SetTestName "Clang - Error macros 'log_errors' test" +compiler=$clang_compiler +SetConfigurationName "Error macros 'log_errors' test" PrintHeader cd ../../../etl_error_handler/log_errors mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -491,14 +502,14 @@ else fi #****************************************************************************** -SetTestName "Clang - Error macros 'exceptions' test" +compiler=$clang_compiler +SetConfigurationName "Error macros 'exceptions' test" PrintHeader cd ../../../etl_error_handler/exceptions mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation @@ -515,14 +526,14 @@ else fi #****************************************************************************** -SetTestName "Clang - Error macros 'log_errors and exceptions' test" +compiler=$clang_compiler +SetConfigurationName "Error macros 'log_errors and exceptions' test" PrintHeader cd ../../../etl_error_handler/log_errors_and_exceptions mkdir -p build-make || exit 1 cd build-make || exit 1 rm * -rf -clang --version | grep clang | tee -a log.txt -cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. +cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize .. cmake --build . if [ $? -eq 0 ]; then PassedCompilation diff --git a/test/test_array.cpp b/test/test_array.cpp index 0465debe..122755c1 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -654,7 +654,7 @@ namespace #if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) TEST(test_array_template_deduction) { - etl::array data{ char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9 }; + etl::array data{ char(0), short(1), 2, long(3), 4, 5, 6, 7, 8, 9 }; using Type = std::remove_reference_t; CHECK((std::is_same_v)); diff --git a/test/test_atomic.cpp b/test/test_atomic.cpp index 801f3069..091c8b4c 100644 --- a/test/test_atomic.cpp +++ b/test/test_atomic.cpp @@ -92,7 +92,7 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare.load(), (int)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -101,7 +101,7 @@ namespace std::atomic compare(Enum::One); etl::atomic test(Enum::One); - CHECK_EQUAL((Enum)compare.load(), (Enum::value_type)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -112,7 +112,7 @@ namespace std::atomic compare(&i); etl::atomic test(&i); - CHECK_EQUAL((int*)compare.load(), (int*)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -121,7 +121,7 @@ namespace std::atomic compare(true); etl::atomic test(true); - CHECK_EQUAL((bool)compare.load(), (bool)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -132,7 +132,7 @@ namespace compare.store(2); test.store(2); - CHECK_EQUAL((int)compare.load(), (int)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -143,7 +143,7 @@ namespace compare.store(Enum::Two); test.store(Enum::Two); - CHECK_EQUAL((Enum::value_type)compare.load(), (Enum::value_type)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -157,7 +157,7 @@ namespace compare.store(&j); test.store(&j); - CHECK_EQUAL((int*)compare.load(), (int*)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -168,7 +168,7 @@ namespace compare.store(true); test.store(true); - CHECK_EQUAL((bool)compare.load(), (bool)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -179,7 +179,7 @@ namespace compare = 2; test = 2; - CHECK_EQUAL((int)compare.load(), (int)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -190,7 +190,7 @@ namespace compare = Enum::Two; test = Enum::Two; - CHECK_EQUAL((Enum::value_type)compare.load(), (Enum::value_type)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -204,7 +204,7 @@ namespace compare = &j; test = &j; - CHECK_EQUAL((int*)compare.load(), (int*)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -215,7 +215,7 @@ namespace compare = true; test = true; - CHECK_EQUAL((bool)compare.load(), (bool)test.load()); + CHECK_EQUAL(compare.load(), test.load()); } //************************************************************************* @@ -224,8 +224,8 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)++compare, (int)++test); - CHECK_EQUAL((int)++compare, (int)++test); + CHECK_EQUAL(++compare, ++test); + CHECK_EQUAL(++compare, ++test); } //************************************************************************* @@ -234,8 +234,8 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare++, (int)test++); - CHECK_EQUAL((int)compare++, (int)test++); + CHECK_EQUAL(compare++, test++); + CHECK_EQUAL(compare++, test++); } //************************************************************************* @@ -244,8 +244,8 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)--compare, (int)--test); - CHECK_EQUAL((int)--compare, (int)--test); + CHECK_EQUAL(--compare, --test); + CHECK_EQUAL(--compare, --test); } //************************************************************************* @@ -254,8 +254,8 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare--, (int)test--); - CHECK_EQUAL((int)compare--, (int)test--); + CHECK_EQUAL(compare--, test--); + CHECK_EQUAL(compare--, test--); } //************************************************************************* @@ -266,8 +266,8 @@ namespace std::atomic compare(&data[0]); etl::atomic test(&data[0]); - CHECK_EQUAL((int*)++compare, (int*)++test); - CHECK_EQUAL((int*)++compare, (int*)++test); + CHECK_EQUAL(++compare, ++test); + CHECK_EQUAL(++compare, ++test); } //************************************************************************* @@ -278,8 +278,8 @@ namespace std::atomic compare(&data[0]); etl::atomic test(&data[0]); - CHECK_EQUAL((int*)compare++, (int*)test++); - CHECK_EQUAL((int*)compare++, (int*)test++); + CHECK_EQUAL(compare++, test++); + CHECK_EQUAL(compare++, test++); } //************************************************************************* @@ -290,8 +290,8 @@ namespace std::atomic compare(&data[3]); etl::atomic test(&data[3]); - CHECK_EQUAL((int*)--compare, (int*)--test); - CHECK_EQUAL((int*)--compare, (int*)--test); + CHECK_EQUAL(--compare, --test); + CHECK_EQUAL(--compare, --test); } //************************************************************************* @@ -302,8 +302,8 @@ namespace std::atomic compare(&data[3]); etl::atomic test(&data[3]); - CHECK_EQUAL((int*)compare--, (int*)test--); - CHECK_EQUAL((int*)compare--, (int*)test--); + CHECK_EQUAL(compare--, test--); + CHECK_EQUAL(compare--, test--); } //************************************************************************* @@ -312,7 +312,7 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare.fetch_add(2), (int)test.fetch_add(2)); + CHECK_EQUAL(compare.fetch_add(2), test.fetch_add(2)); } //************************************************************************* @@ -323,7 +323,7 @@ namespace std::atomic compare(&data[0]); etl::atomic test(&data[0]); - CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10))); + CHECK_EQUAL(compare.fetch_add(ptrdiff_t(10)), test.fetch_add(ptrdiff_t(10))); } //************************************************************************* @@ -335,7 +335,7 @@ namespace compare += 2; test += 2; - CHECK_EQUAL((int)compare, (int)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -349,7 +349,7 @@ namespace compare += 2; test += 2; - CHECK_EQUAL((int*)compare, (int*)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -361,7 +361,7 @@ namespace compare -= 2; test -= 2; - CHECK_EQUAL((int)compare, (int)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -375,7 +375,7 @@ namespace compare -= 2; test -= 2; - CHECK_EQUAL((int*)compare, (int*)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -387,7 +387,7 @@ namespace compare &= 0x55AA55AAUL; test &= 0x55AA55AAUL; - CHECK_EQUAL((int)compare, (int)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -399,7 +399,7 @@ namespace compare |= 0x55AA55AAUL; test |= 0x55AA55AAUL; - CHECK_EQUAL((int)compare, (int)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -411,7 +411,7 @@ namespace compare ^= 0x55AA55AAUL; test ^= 0x55AA55AAUL; - CHECK_EQUAL((int)compare, (int)test); + CHECK_EQUAL(compare, test); } //************************************************************************* @@ -420,7 +420,7 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare.fetch_sub(2), (int)test.fetch_sub(2)); + CHECK_EQUAL(compare.fetch_sub(2), test.fetch_sub(2)); } //************************************************************************* @@ -431,7 +431,7 @@ namespace std::atomic compare(&data[0]); etl::atomic test(&data[0]); - CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10))); + CHECK_EQUAL(compare.fetch_add(ptrdiff_t(10)), test.fetch_add(ptrdiff_t(10))); } //************************************************************************* @@ -440,7 +440,7 @@ namespace std::atomic compare(0xFFFFFFFFUL); etl::atomic test(0xFFFFFFFFUL); - CHECK_EQUAL((int)compare.fetch_and(0x55AA55AAUL), (int)test.fetch_and(0x55AA55AAUL)); + CHECK_EQUAL(compare.fetch_and(0x55AA55AAUL), test.fetch_and(0x55AA55AAUL)); } //************************************************************************* @@ -449,7 +449,7 @@ namespace std::atomic compare(0x0000FFFFUL); etl::atomic test(0x0000FFFFUL); - CHECK_EQUAL((int)compare.fetch_or(0x55AA55AAUL), (int)test.fetch_or(0x55AA55AAUL)); + CHECK_EQUAL(compare.fetch_or(0x55AA55AAUL), test.fetch_or(0x55AA55AAUL)); } //************************************************************************* @@ -458,7 +458,7 @@ namespace std::atomic compare(0x0000FFFFUL); etl::atomic test(0x0000FFFFUL); - CHECK_EQUAL((int)compare.fetch_xor(0x55AA55AAUL), (int)test.fetch_xor(0x55AA55AAUL)); + CHECK_EQUAL(compare.fetch_xor(0x55AA55AAUL), test.fetch_xor(0x55AA55AAUL)); } //************************************************************************* @@ -467,7 +467,7 @@ namespace std::atomic compare(1); etl::atomic test(1); - CHECK_EQUAL((int)compare.exchange(2), (int)test.exchange(2)); + CHECK_EQUAL(compare.exchange(2), test.exchange(2)); } //************************************************************************* @@ -476,7 +476,7 @@ namespace std::atomic compare(Enum::One); etl::atomic test(Enum::One); - CHECK_EQUAL((Enum)compare.exchange(Enum::Two), (Enum)test.exchange(Enum::Two)); + CHECK_EQUAL(compare.exchange(Enum::Two), test.exchange(Enum::Two)); } //************************************************************************* @@ -488,7 +488,7 @@ namespace std::atomic compare(&i); etl::atomic test(&i); - CHECK_EQUAL((int*)compare.exchange(&j), (int*)test.exchange(&j)); + CHECK_EQUAL(compare.exchange(&j), test.exchange(&j)); } //************************************************************************* @@ -497,7 +497,7 @@ namespace std::atomic compare(false); etl::atomic test(false); - CHECK_EQUAL((bool)compare.exchange(true), (bool)test.exchange(true)); + CHECK_EQUAL(compare.exchange(true), test.exchange(true)); } //************************************************************************* diff --git a/test/test_binary.cpp b/test/test_binary.cpp index 9275f269..468758cd 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -38,6 +38,8 @@ SOFTWARE. #include "etl/integral_limits.h" #include "etl/type_traits.h" +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -2759,3 +2761,5 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" + diff --git a/test/test_bit.cpp b/test/test_bit.cpp index b73737c1..e86d1e69 100644 --- a/test/test_bit.cpp +++ b/test/test_bit.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include "etl/bit.h" #include "etl/fnv_1.h" +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -1525,3 +1527,4 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_bit_stream.cpp b/test/test_bit_stream.cpp index 435ea638..c0cbd251 100644 --- a/test/test_bit_stream.cpp +++ b/test/test_bit_stream.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -1072,3 +1074,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" \ No newline at end of file diff --git a/test/test_bit_stream_reader_big_endian.cpp b/test/test_bit_stream_reader_big_endian.cpp index c2918451..c71977b1 100644 --- a/test/test_bit_stream_reader_big_endian.cpp +++ b/test/test_bit_stream_reader_big_endian.cpp @@ -34,6 +34,7 @@ SOFTWARE. #include #include "etl/private/diagnostic_unused_function_push.h" +#include "etl/private/diagnostic_useless_cast_push.h" namespace { @@ -1507,3 +1508,4 @@ namespace } #include "etl/private/diagnostic_pop.h" +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_bit_stream_reader_little_endian.cpp b/test/test_bit_stream_reader_little_endian.cpp index 31aad5f5..776d2023 100644 --- a/test/test_bit_stream_reader_little_endian.cpp +++ b/test/test_bit_stream_reader_little_endian.cpp @@ -33,6 +33,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -1193,3 +1195,5 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" + diff --git a/test/test_bit_stream_writer_big_endian.cpp b/test/test_bit_stream_writer_big_endian.cpp index 31f6a676..be7ff681 100644 --- a/test/test_bit_stream_writer_big_endian.cpp +++ b/test/test_bit_stream_writer_big_endian.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -794,3 +796,5 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" + diff --git a/test/test_bit_stream_writer_little_endian.cpp b/test/test_bit_stream_writer_little_endian.cpp index f53b7682..e66c46c2 100644 --- a/test/test_bit_stream_writer_little_endian.cpp +++ b/test/test_bit_stream_writer_little_endian.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -881,3 +883,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_byte_stream.cpp b/test/test_byte_stream.cpp index 10a3fceb..13d4eaaa 100644 --- a/test/test_byte_stream.cpp +++ b/test/test_byte_stream.cpp @@ -37,6 +37,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -1346,3 +1348,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_char_traits.cpp b/test/test_char_traits.cpp index 5f140101..6f5fadd1 100644 --- a/test/test_char_traits.cpp +++ b/test/test_char_traits.cpp @@ -32,6 +32,8 @@ SOFTWARE. #include "etl/char_traits.h" +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { template @@ -724,3 +726,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_deque.cpp b/test/test_deque.cpp index 676cc823..42db7899 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -29,7 +29,6 @@ SOFTWARE. #include "unit_test_framework.h" #include "etl/deque.h" -#include "etl/algorithm.h" #include "data.h" @@ -42,2162 +41,2167 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { SUITE(test_deque) { const size_t SIZE = 14UL; - //typedef TestDataDC DC; - //typedef TestDataNDC NDC; + typedef TestDataDC DC; + typedef TestDataNDC NDC; - //typedef etl::deque DataInt; - //typedef etl::ideque IDataInt; - //typedef etl::deque DataDC; - //typedef etl::deque DataNDC; - //typedef etl::ideque IDataNDC; + typedef etl::deque DataInt; + typedef etl::ideque IDataInt; + typedef etl::deque DataDC; + typedef etl::deque DataNDC; + typedef etl::ideque IDataNDC; - //typedef std::deque Compare_Data; - //typedef std::deque Compare_DataDC; + typedef std::deque Compare_Data; + typedef std::deque Compare_DataDC; - //NDC N0 = NDC("0"); - //NDC N1 = NDC("1"); - //NDC N2 = NDC("2"); - //NDC N3 = NDC("3"); - //NDC N4 = NDC("4"); - //NDC N5 = NDC("5"); - //NDC N6 = NDC("6"); - //NDC N7 = NDC("7"); - //NDC N8 = NDC("8"); - //NDC N9 = NDC("9"); - //NDC N10 = NDC("10"); - //NDC N11 = NDC("11"); - //NDC N12 = NDC("12"); - //NDC N13 = NDC("13"); - //NDC N14 = NDC("14"); - //NDC N15 = NDC("15"); - //NDC N16 = NDC("16"); - //NDC N17 = NDC("17"); - //NDC N999 = NDC("999"); + NDC N0 = NDC("0"); + NDC N1 = NDC("1"); + NDC N2 = NDC("2"); + NDC N3 = NDC("3"); + NDC N4 = NDC("4"); + NDC N5 = NDC("5"); + NDC N6 = NDC("6"); + NDC N7 = NDC("7"); + NDC N8 = NDC("8"); + NDC N9 = NDC("9"); + NDC N10 = NDC("10"); + NDC N11 = NDC("11"); + NDC N12 = NDC("12"); + NDC N13 = NDC("13"); + NDC N14 = NDC("14"); + NDC N15 = NDC("15"); + NDC N16 = NDC("16"); + NDC N17 = NDC("17"); + NDC N999 = NDC("999"); - //std::vector blank_data = { N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999 }; - //std::vector initial_data = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13 }; - //std::vector initial_data_excess = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14 }; - //std::vector initial_data_under = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11 }; - //std::vector initial_data_small = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; - //std::vector insert_data = { N10, N11, N12, N13, N14 }; - //std::vector initial_data_dc = { DC("0"), DC("1"), DC("2"), DC("3"), DC("4"), DC("5"), DC("6"), DC("7"), DC("8"), DC("9"), DC("10"), DC("11"), DC("12"), DC("13") }; - //std::vector int_data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; - //std::vector int_data2 = { 15, 16, 17, 18 }; + std::vector blank_data = { N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999, N999 }; + std::vector initial_data = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13 }; + std::vector initial_data_excess = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14 }; + std::vector initial_data_under = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11 }; + std::vector initial_data_small = { N0, N1, N2, N3, N4, N5, N6, N7, N8, N9 }; + std::vector insert_data = { N10, N11, N12, N13, N14 }; + std::vector initial_data_dc = { DC("0"), DC("1"), DC("2"), DC("3"), DC("4"), DC("5"), DC("6"), DC("7"), DC("8"), DC("9"), DC("10"), DC("11"), DC("12"), DC("13") }; + std::vector int_data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; + std::vector int_data2 = { 15, 16, 17, 18 }; - ////************************************************************************* - //TEST(test_constructor) - //{ - // DataDC data; + //************************************************************************* + TEST(test_constructor) + { + DataDC data; - // CHECK(data.empty()); - // CHECK(!data.full()); - // CHECK(data.begin() == data.end()); - // CHECK_EQUAL(0U, data.size()); - // CHECK_EQUAL(SIZE, data.max_size()); - //} + CHECK(data.empty()); + CHECK(!data.full()); + CHECK(data.begin() == data.end()); + CHECK_EQUAL(0U, data.size()); + CHECK_EQUAL(SIZE, data.max_size()); + } //************************************************************************* TEST(test_constructor_fill) { - std::deque compare_data(SIZE, 1); - etl::deque data(SIZE, 2); + Compare_Data compare_data(SIZE, N999); + DataNDC data(SIZE, N999); - CHECK(std::equal(data.cbegin(), data.cend(), data.cbegin())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_destruct_via_ideque) + { + int current_count = NDC::get_instance_count(); + + DataNDC* pdata = new DataNDC(SIZE, N999); + CHECK_EQUAL(int(current_count + SIZE), NDC::get_instance_count()); + + IDataNDC* pidata = pdata; + delete pidata; + CHECK_EQUAL(current_count, NDC::get_instance_count()); + } + + //************************************************************************* + TEST(test_constructor_fill_excess) + { + CHECK_THROW(DataNDC(SIZE + 1, N999), etl::deque_full); + } + + //************************************************************************* + TEST(test_constructor_range) + { + Compare_Data compare_data(initial_data.begin(), initial_data.end()); + DataNDC data(initial_data.begin(), initial_data.end()); + + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + +#if ETL_HAS_INITIALIZER_LIST + //************************************************************************* + TEST(test_constructor_initializer_list) + { + Compare_Data compare_data = { N0, N1, N2, N3 }; + DataNDC data = { N0, N1, N2, N3 }; + + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } +#endif + + //************************************************************************* + TEST(test_copy_constructor) + { + DataNDC deque1(initial_data.begin(), initial_data.end()); + DataNDC deque2(deque1); + + CHECK_EQUAL(deque1.size(), deque2.size()); + CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); + } + + //************************************************************************* + TEST(test_move_constructor) + { + const size_t SIZE = 10UL; + typedef etl::deque, SIZE> Data; + + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + + Data deque1; + deque1.push_back(std::move(p1)); + deque1.push_back(std::move(p2)); + deque1.push_back(std::move(p3)); + deque1.push_back(std::move(p4)); + + Data deque2(std::move(deque1)); + + CHECK_EQUAL(4U, deque2.size()); + + std::unique_ptr pr = std::move(*deque2.begin()); + + CHECK_EQUAL(1U, *pr); + CHECK_EQUAL(2U, *deque2[1]); + CHECK_EQUAL(3U, *deque2[2]); + CHECK_EQUAL(4U, *deque2[3]); + } + + //************************************************************************* + TEST(test_move_insert_erase) + { + const size_t SIZE = 10UL; + typedef etl::deque, SIZE> Data; + + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + + Data deque1; + deque1.push_back(std::move(p1)); + deque1.push_back(std::move(p2)); + deque1.push_back(std::move(p4)); + + deque1.insert(deque1.begin() + 2U, std::move(p3)); + + CHECK_EQUAL(4U, deque1.size()); + + CHECK(bool(deque1[0])); + CHECK(bool(deque1[1])); + CHECK(bool(deque1[2])); + CHECK(bool(deque1[3])); + + CHECK_EQUAL(1U, *deque1[0]); + CHECK_EQUAL(2U, *deque1[1]); + CHECK_EQUAL(3U, *deque1[2]); + CHECK_EQUAL(4U, *deque1[3]); + + deque1.erase(deque1.begin() + 1); + + CHECK(bool(deque1[0])); + CHECK(bool(deque1[1])); + CHECK(bool(deque1[2])); + + CHECK_EQUAL(1U, *deque1[0]); + CHECK_EQUAL(3U, *deque1[1]); + CHECK_EQUAL(4U, *deque1[2]); + } + + //************************************************************************* + TEST(test_assignment) + { + DataNDC deque1(initial_data.begin(), initial_data.end()); + DataNDC deque2; + + deque2 = deque1; + + CHECK_EQUAL(deque1.size(), deque2.size()); + CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); + } + + //************************************************************************* + TEST(test_move_assignment) + { + const size_t SIZE = 10UL; + typedef etl::deque, SIZE> Data; + + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + std::unique_ptr p5(new uint32_t(5U)); + + Data deque1; + deque1.push_back(std::move(p1)); + deque1.push_back(std::move(p2)); + deque1.push_back(std::move(p3)); + deque1.push_back(std::move(p4)); + + Data deque2; + deque2.push_back(std::move(p5)); + deque2 = std::move(deque1); + + CHECK_EQUAL(4U, deque2.size()); + + CHECK_EQUAL(1U, *deque2[0]); + CHECK_EQUAL(2U, *deque2[1]); + CHECK_EQUAL(3U, *deque2[2]); + CHECK_EQUAL(4U, *deque2[3]); + } + + //************************************************************************* + TEST(test_assignment_interface) + { + DataNDC deque1(initial_data.begin(), initial_data.end()); + DataNDC deque2; + + IDataNDC& ideque1 = deque1; + IDataNDC& ideque2 = deque2; + + ideque2 = ideque1; + + CHECK_EQUAL(deque1.size(), deque2.size()); + CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); + } + + //************************************************************************* + TEST(test_move_assignment_interface) + { + const size_t SIZE = 10UL; + typedef etl::deque, SIZE> Data; + typedef etl::ideque> IData; + + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + std::unique_ptr p5(new uint32_t(5U)); + + Data deque1; + deque1.push_back(std::move(p1)); + deque1.push_back(std::move(p2)); + deque1.push_back(std::move(p3)); + deque1.push_back(std::move(p4)); + + Data deque2; + deque2.push_back(std::move(p5)); + + IData& ideque1 = deque1; + IData& ideque2 = deque2; + + ideque2 = std::move(ideque1); + + CHECK_EQUAL(0U, deque1.size()); + CHECK_EQUAL(4U, deque2.size()); + + CHECK_EQUAL(1U, *deque2[0]); + CHECK_EQUAL(2U, *deque2[1]); + CHECK_EQUAL(3U, *deque2[2]); + CHECK_EQUAL(4U, *deque2[3]); + } + + //************************************************************************* + TEST(test_self_assignment) + { + DataNDC deque1(initial_data.begin(), initial_data.end()); + DataNDC deque2(deque1); + +#include "etl/private/diagnostic_self_assign_overloaded_push.h" + deque2 = deque2; +#include "etl/private/diagnostic_pop.h" + + CHECK_EQUAL(deque1.size(), deque2.size()); + CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); + } + + //************************************************************************* + TEST(test_assign_range) + { + DataNDC data; + + CHECK_NO_THROW(data.assign(initial_data.begin(), initial_data.end())); + + CHECK_EQUAL(initial_data.size(), data.size()); + CHECK(std::equal(initial_data.begin(), initial_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_assign_range_excess) + { + DataNDC data; + + CHECK_THROW(data.assign(initial_data_excess.begin(), initial_data_excess.end()), etl::deque_full); + } + + //************************************************************************* + TEST(test_assign_fill) + { + Compare_Data compare_data; + DataNDC data; + + compare_data.assign(SIZE, N999); + + CHECK_NO_THROW(data.assign(SIZE, N999)); + + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_assign_fill_excess) + { + DataNDC data; + + CHECK_THROW(data.assign(SIZE + 1, N999), etl::deque_full); + } + + //************************************************************************* + TEST(test_at) + { + Compare_Data compare_data(initial_data.begin(), initial_data.end()); + DataNDC data(initial_data.begin(), initial_data.end()); + + CHECK_EQUAL(compare_data.at(0), data.at(0)); + CHECK_EQUAL(compare_data.at(1), data.at(1)); + CHECK_EQUAL(compare_data.at(2), data.at(2)); + CHECK_EQUAL(compare_data.at(3), data.at(3)); + CHECK_EQUAL(compare_data.at(4), data.at(4)); + CHECK_EQUAL(compare_data.at(5), data.at(5)); + } + + //************************************************************************* + TEST(test_at_const) + { + const Compare_Data compare_data(initial_data.begin(), initial_data.end()); + const DataNDC data(initial_data.begin(), initial_data.end()); + + CHECK_EQUAL(compare_data.at(0), data.at(0)); + CHECK_EQUAL(compare_data.at(1), data.at(1)); + CHECK_EQUAL(compare_data.at(2), data.at(2)); + CHECK_EQUAL(compare_data.at(3), data.at(3)); + CHECK_EQUAL(compare_data.at(4), data.at(4)); + CHECK_EQUAL(compare_data.at(5), data.at(5)); + } + + //************************************************************************* + TEST(test_index_operator) + { + Compare_Data compare_data(initial_data.begin(), initial_data.end()); + DataNDC data(initial_data.begin(), initial_data.end()); + + CHECK_EQUAL(compare_data[0], data[0]); + CHECK_EQUAL(compare_data[1], data[1]); + CHECK_EQUAL(compare_data[2], data[2]); + CHECK_EQUAL(compare_data[3], data[3]); + CHECK_EQUAL(compare_data[4], data[4]); + CHECK_EQUAL(compare_data[5], data[5]); + } + + //************************************************************************* + TEST(test_index_operator_const) + { + const Compare_Data compare_data(initial_data.begin(), initial_data.end()); + const DataNDC data(initial_data.begin(), initial_data.end()); + + CHECK_EQUAL(compare_data[0], data[0]); + CHECK_EQUAL(compare_data[1], data[1]); + CHECK_EQUAL(compare_data[2], data[2]); + CHECK_EQUAL(compare_data[3], data[3]); + CHECK_EQUAL(compare_data[4], data[4]); + CHECK_EQUAL(compare_data[5], data[5]); + } + + //************************************************************************* + TEST(test_front) + { + DataNDC data; + + data.push_front(N1); + CHECK_EQUAL(N1, data.front()); + + data.push_front(N2); + CHECK_EQUAL(N2, data.front()); + + data.push_front(N3); + CHECK_EQUAL(N3, data.front()); + + data.push_front(N4); + CHECK_EQUAL(N4, data.front()); + + data.push_front(N5); + CHECK_EQUAL(N5, data.front()); + + data.push_front(N6); + CHECK_EQUAL(N6, data.front()); + } + + //************************************************************************* + TEST(test_front_const) + { + DataNDC data; + const DataNDC& ctestDeque = data; + + data.push_front(N1); + CHECK_EQUAL(N1, ctestDeque.front()); + + data.push_front(N2); + CHECK_EQUAL(N2, ctestDeque.front()); + + data.push_front(N3); + CHECK_EQUAL(N3, ctestDeque.front()); + + data.push_front(N4); + CHECK_EQUAL(N4, ctestDeque.front()); + + data.push_front(N5); + CHECK_EQUAL(N5, ctestDeque.front()); + + data.push_front(N6); + CHECK_EQUAL(N6, ctestDeque.front()); + } + + //************************************************************************* + TEST(test_back) + { + DataNDC data; + + data.push_back(N1); + CHECK_EQUAL(N1, data.back()); + + data.push_back(N2); + CHECK_EQUAL(N2, data.back()); + + data.push_back(N3); + CHECK_EQUAL(N3, data.back()); + + data.push_back(N4); + CHECK_EQUAL(N4, data.back()); + + data.push_back(N5); + CHECK_EQUAL(N5, data.back()); + + data.push_back(N6); + CHECK_EQUAL(N6, data.back()); + } + + //************************************************************************* + TEST(test_back_const) + { + DataNDC data; + const DataNDC& ctestDeque = data; + + data.push_back(N1); + CHECK_EQUAL(N1, ctestDeque.back()); + + data.push_back(N2); + CHECK_EQUAL(N2, ctestDeque.back()); + + data.push_back(N3); + CHECK_EQUAL(N3, ctestDeque.back()); + + data.push_back(N4); + CHECK_EQUAL(N4, ctestDeque.back()); + + data.push_back(N5); + CHECK_EQUAL(N5, ctestDeque.back()); + + data.push_back(N6); + CHECK_EQUAL(N6, ctestDeque.back()); + } + + //************************************************************************* + TEST(test_iterator_comparison) + { + DataNDC data(SIZE, N0); + + DataNDC::iterator first = data.begin() + 1; + DataNDC::iterator second = data.begin() + 1; + DataNDC::iterator third = data.begin() + 4; + + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); + CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); + + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); + } + + //************************************************************************* + TEST(test_const_iterator_comparison) + { + DataNDC data(SIZE, N0); + + DataNDC::const_iterator first = data.begin() + 1; + DataNDC::const_iterator second = data.begin() + 1; + DataNDC::const_iterator third = data.begin() + 4; + + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); + CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); + + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); + } + + //************************************************************************* + TEST(test_iterator_comparison_rollover_left) + { + DataNDC data(SIZE, N0); + + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + + DataNDC::const_iterator first = data.cbegin() + 1; + DataNDC::const_iterator second = data.cbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_const_iterator_comparison_rollover_left) + { + DataNDC data(SIZE, N0); + + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + + DataNDC::const_iterator first = data.cbegin() + 1; + DataNDC::const_iterator second = data.cbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_iterator_comparison_rollover_right) + { + DataNDC data(SIZE, N0); + + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + + DataNDC::iterator first = data.begin() + 1; + DataNDC::iterator second = data.begin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_const_iterator_comparison_rollover_right) + { + DataNDC data(SIZE, N0); + + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + + DataNDC::const_iterator first = data.cbegin() + 1; + DataNDC::const_iterator second = data.cbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_reverse_iterator_comparison) + { + DataNDC data(SIZE, N0); + + DataNDC::reverse_iterator first = data.rbegin() + 1; + DataNDC::reverse_iterator second = data.rbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_const_reverse_iterator_comparison) + { + DataNDC data(SIZE, N0); + + DataNDC::const_reverse_iterator first = data.crbegin() + 1; + DataNDC::const_reverse_iterator second = data.crbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_reverse_iterator_comparison_rollover_left) + { + DataNDC data(SIZE, N0); + + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + + DataNDC::reverse_iterator first = data.rbegin() + 1; + DataNDC::reverse_iterator second = data.rbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_const_reverse_iterator_comparison_rollover_left) + { + DataNDC data(SIZE, N0); + + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + data.push_front(N1); + + DataNDC::const_reverse_iterator first = data.crbegin() + 1; + DataNDC::const_reverse_iterator second = data.crbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_reverse_iterator_comparison_rollover_right) + { + DataNDC data(SIZE, N0); + + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + + DataNDC::reverse_iterator first = data.rbegin() + 1; + DataNDC::reverse_iterator second = data.rbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_const_reverse_iterator_comparison_rollover_right) + { + DataNDC data(SIZE, N0); + + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + data.push_back(N1); + + DataNDC::const_reverse_iterator first = data.crbegin() + 1; + DataNDC::const_reverse_iterator second = data.crbegin() + 4; + + CHECK(first < second); + CHECK(!(second < first)); + } + + //************************************************************************* + TEST(test_empty) + { + DataNDC data; + + CHECK(data.empty()); + } + + //************************************************************************* + TEST(test_full) + { + DataDC data; + data.resize(SIZE); + + CHECK(data.full()); + } + + //************************************************************************* + TEST(test_clear) + { + DataDC data; + + data.resize(SIZE); + data.clear(); + CHECK(data.empty()); + + // Do it again to check that clear() didn't screw up the internals. + data.resize(SIZE); + CHECK_EQUAL(SIZE, data.size()); + data.clear(); + CHECK(data.empty()); + } + + //************************************************************************* + TEST(test_clear_pod) + { + DataInt data; + + data.resize(SIZE); + data.clear(); + CHECK(data.empty()); + + // Do it again to check that clear() didn't screw up the internals. + data.resize(SIZE); + data.clear(); + CHECK(data.empty()); + } + + //************************************************************************* + TEST(test_insert_to_empty) + { + const int value(5); + const size_t insertCount = 2UL; + etl::deque valuesToInsert(insertCount, value); + etl::deque data; + + data.insert(data.cbegin(), valuesToInsert.begin(), valuesToInsert.end()); + + CHECK_EQUAL(insertCount, std::distance(data.begin(), data.end())); + CHECK(data.size() == insertCount); + CHECK(data[0] == value); + CHECK(data[1] == value); + CHECK(std::equal(data.begin(), data.end(), valuesToInsert.begin())); + } + + //************************************************************************* + TEST(test_insert_value_begin) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.insert(compare_data.cbegin(), N14); + DataNDC::iterator position = data.insert(data.cbegin(), N14); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_emplace_value_begin) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin(), N14.value); + DataNDC::iterator position = data.emplace(data.begin(), N14.value); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_insert_value_end) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.insert(compare_data.cend(), N14); + DataNDC::iterator position = data.insert(data.cend(), N14); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_emplace_value_end) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.emplace(compare_data.end(), N14.value); + DataNDC::iterator position = data.emplace(data.end(), N14.value); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_insert_value) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.insert(compare_data.cbegin() + 3, N14); + DataNDC::iterator position = data.insert(data.cbegin() + 3, N14); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + + compare_data.assign(initial_data_under.begin(), initial_data_under.end()); + data.assign(compare_data.begin(), compare_data.end()); + + cposition = compare_data.insert(compare_data.cbegin() + 4, N14); + position = data.insert(data.cbegin() + 4, N14); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_emplace_value) + { + Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin() + 3, N14.value); + DataNDC::iterator position = data.emplace(data.begin() + 3, N14.value); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + + compare_data.assign(initial_data_under.begin(), initial_data_under.end()); + data.assign(compare_data.begin(), compare_data.end()); + + cposition = compare_data.emplace(compare_data.begin() + 4, N14.value); + position = data.emplace(data.begin() + 4, N14.value); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); + } + + //************************************************************************* + TEST(test_emplace_default) + { + const int Initial = 1; + const int Default = 2; + + struct S + { + S() + : value(Default) + { + } + + S(int v) + : value(v) + { + } + + bool operator ==(const S& rhs) const + { + return value == rhs.value; + } + + int value; + }; + + // First fill with Initial values. + etl::deque data; + data.resize(SIZE, S(Initial)); + data.clear(); + + // Then emplace Default values. + for (size_t i = 0; i < SIZE; ++i) + { + data.emplace(data.end()); + } + + // Compare with an array of default values. + std::array compare_data; + compare_data.fill(S()); + + CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_front_default) + { + const int Initial = 1; + const int Default = 2; + + struct S + { + S() + : value(Default) + { + } + + S(int v) + : value(v) + { + } + + bool operator ==(const S& rhs) const + { + return value == rhs.value; + } + + int value; + }; + + // First fill with Initial values. + etl::deque data; + data.resize(SIZE, S(Initial)); + data.clear(); + + // Then emplace Default values. + for (size_t i = 0; i < SIZE; ++i) + { + data.emplace_front(); + } + + // Compare with an array of default values. + std::array compare_data; + compare_data.fill(S()); + + CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_back_default) + { + const int Initial = 1; + const int Default = 2; + + struct S + { + S() + : value(Default) + { + } + + S(int v) + : value(v) + { + } + + bool operator ==(const S& rhs) const + { + return value == rhs.value; + } + + int value; + }; + + // First fill with Initial values. + etl::deque data; + data.resize(SIZE, S(Initial)); + data.clear(); + + // Then emplace Default values. + for (size_t i = 0; i < SIZE; ++i) + { + data.emplace_back(); + } + + // Compare with an array of default values. + std::array compare_data; + compare_data.fill(S()); + + CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_insert_n_value_position) + { + size_t max_insert = SIZE - initial_data_small.size(); + + for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size) + { + for (size_t offset = 0UL; offset <= initial_data_small.size(); ++offset) + { + Compare_Data compare_data(initial_data_small.begin(), initial_data_small.end()); + DataNDC data(compare_data.begin(), compare_data.end()); + + compare_data.insert(compare_data.cbegin() + offset, insert_size, N14); + data.insert(data.cbegin() + offset, insert_size, N14); + + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + } + } + + //************************************************************************* + TEST(test_insert_n_value_excess) + { + DataNDC data(initial_data_under.begin(), initial_data_under.end()); + + size_t insert_size = SIZE - initial_data_under.size() + 1; + + CHECK_THROW(data.insert(data.cbegin(), insert_size, N14), etl::deque_full); + CHECK_THROW(data.insert(data.cend(), insert_size, N14), etl::deque_full); + CHECK_THROW(data.insert(data.cbegin() + 6, insert_size, N14), etl::deque_full); + } + + //************************************************************************* + TEST(test_insert_range) + { + size_t max_insert = SIZE - initial_data_small.size(); + + for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size) + { + Compare_Data range(insert_data.begin(), insert_data.begin() + insert_size); + + for (size_t offset = 0UL; offset <= initial_data_small.size(); ++offset) + { + Compare_Data compare_data(initial_data_small.begin(), initial_data_small.end()); + DataNDC data(blank_data.begin(), blank_data.end()); + data.assign(compare_data.begin(), compare_data.end()); + + compare_data.insert(compare_data.cbegin() + offset, range.begin(), range.end()); + data.insert(data.cbegin() + offset, range.begin(), range.end()); + + CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + } + } + + //************************************************************************* + TEST(test_insert_range_excess) + { + Compare_Data range = { N12, N13, N14, N15 }; + DataNDC data(initial_data_under.begin(), initial_data_under.end()); + + CHECK_THROW(data.insert(data.cbegin(), range.begin(), range.end()), etl::deque_full); + CHECK_THROW(data.insert(data.cend(), range.begin(), range.end()), etl::deque_full); + CHECK_THROW(data.insert(data.cbegin() + 6, range.begin(), range.end()), etl::deque_full); + } + + //************************************************************************* + TEST(test_erase_begin) + { + Compare_Data compare_data = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + DataNDC data(compare_data.begin(), compare_data.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + DataNDC::const_iterator i_next = data.erase(data.cbegin()); + Compare_Data::const_iterator i_cnext = compare_data.erase(compare_data.cbegin()); + + CHECK_EQUAL(DataNDC::difference_type(data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.cbegin(), i_cnext), std::distance(data.cbegin(), i_next)); + } + + //************************************************************************* + TEST(test_erase_end) + { + Compare_Data compare_data = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + DataNDC data(compare_data.begin(), compare_data.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + DataNDC::iterator i_erase = data.end() - 1; + DataNDC::iterator i_next = data.erase(i_erase); + + Compare_Data::const_iterator i_cerase = compare_data.cend() - 1U; + Compare_Data::iterator i_cnext = compare_data.erase(i_cerase); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + } + + //************************************************************************* + TEST(test_erase_middle) + { + std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + + Compare_Data compare_data(initial.begin(), initial.end()); + DataNDC data(initial.begin(), initial.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + // Erase near beginning. + DataNDC::const_iterator i_erase = data.begin() + 2; + DataNDC::iterator i_next = data.erase(i_erase); + + Compare_Data::const_iterator i_cerase = compare_data.begin() + 2; + Compare_Data::iterator i_cnext = compare_data.erase(i_cerase); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + + compare_data.assign(initial.begin(), initial.end()); + data.assign(initial.begin(), initial.end()); + + // Cause rollover. + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + // Erase near end. + i_erase = data.begin() + 3; + i_next = data.erase(i_erase); + + i_cerase = compare_data.begin() + 3; + i_cnext = compare_data.erase(i_cerase); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + } + + //************************************************************************* + TEST(test_erase_range_begin) + { + std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + + Compare_Data compare_data(initial.begin(), initial.end()); + DataNDC data(initial.begin(), initial.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + DataNDC::iterator i_next = data.erase(data.cbegin(), data.cbegin() + 3); + Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cbegin(), compare_data.cbegin() + 3); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + } + + //************************************************************************* + TEST(test_erase_range_end) + { + std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + + Compare_Data compare_data(initial.begin(), initial.end()); + DataNDC data(initial.begin(), initial.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + DataNDC::iterator i_next = data.erase(data.cend() - 3, data.cend()); + Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cend() - 3, compare_data.cend()); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + } + + //************************************************************************* + TEST(test_erase_range_middle) + { + std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; + + Compare_Data compare_data(initial.begin(), initial.end()); + DataNDC data(initial.begin(), initial.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + DataNDC::iterator i_next = data.erase(data.cbegin() + 1, data.cbegin() + 3); + Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cbegin() + 1, compare_data.cbegin() + 3); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + + compare_data.assign(initial.begin(), initial.end()); + data.assign(initial.begin(), initial.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N4); + data.push_back(N5); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + data.push_back(N9); + data.push_back(N10); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(N4); + compare_data.push_back(N5); + compare_data.push_back(N6); + compare_data.push_back(N7); + compare_data.push_back(N8); + compare_data.push_back(N9); + compare_data.push_back(N10); + + i_next = data.erase(data.cbegin() + 3, data.cbegin() + 5); + i_cnext = compare_data.erase(compare_data.cbegin() + 3, compare_data.cbegin() + 5); + + CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); + } + + //************************************************************************* + TEST(test_push_back) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + CHECK_NO_THROW(data.push_back(N1)); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); + + CHECK_NO_THROW(data.push_back(N2)); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); + + CHECK_NO_THROW(data.push_back(N3)); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); + + CHECK_NO_THROW(data.push_back(N4)); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); + + CHECK_NO_THROW(data.push_back(N5)); + CHECK_EQUAL(size_t(5), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_back) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + CHECK_NO_THROW(data.emplace_back("1")); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); + + CHECK_NO_THROW(data.emplace_back("2")); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); + + CHECK_NO_THROW(data.emplace_back("3")); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); + + CHECK_NO_THROW(data.emplace_back("4")); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); + + CHECK_NO_THROW(data.emplace_back("5")); + CHECK_EQUAL(size_t(5), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_back_return) + { + DataNDC data; + + data.emplace_back("24"); + auto& back = data.emplace_back("42"); + CHECK_EQUAL(back, data.back()); + } + + //************************************************************************* + TEST(test_push_back_excess) + { + DataNDC data; + + for (size_t i = 0UL; i < SIZE; ++i) + { + CHECK_NO_THROW(data.push_back(N0)); + } + + CHECK_THROW(data.push_back(N999), etl::deque_full); + } + + //************************************************************************* + TEST(test_pop_back) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + data.assign(compare_data.begin(), compare_data.end()); + + data.pop_back(); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); + + data.pop_back(); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); + + data.pop_back(); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); + + data.pop_back(); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); + + data.pop_back(); + CHECK_EQUAL(size_t(0), data.size()); + } + + //************************************************************************* + TEST(test_pop_back_exception) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + data.assign(compare_data.begin(), compare_data.end()); + + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + data.pop_back(); + + CHECK_THROW(data.pop_back(), etl::deque_empty); + } + + //************************************************************************* + TEST(test_push_front) + { + Compare_Data compare_data = { N5, N4, N3, N2, N1 }; + DataNDC data; + + CHECK_NO_THROW(data.push_front(N1)); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.push_front(N2)); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.push_front(N3)); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.push_front(N4)); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.push_front(N5)); + CHECK_EQUAL(size_t(5), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_front) + { + Compare_Data compare_data = { N5, N4, N3, N2, N1 }; + DataNDC data; + + CHECK_NO_THROW(data.emplace_front("1")); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.emplace_front("2")); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.emplace_front("3")); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.emplace_front("4")); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); + + CHECK_NO_THROW(data.emplace_front("5")); + CHECK_EQUAL(size_t(5), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_emplace_front_return) + { + DataNDC data; + + data.emplace_front("24"); + auto& front = data.emplace_front("42"); + CHECK_EQUAL(front, data.front()); + } + + //************************************************************************* + TEST(test_push_front_excess) + { + DataNDC data; + + for (size_t i = 0UL; i < SIZE; ++i) + { + CHECK_NO_THROW(data.push_front(N1)); + } + + CHECK_THROW(data.push_front(N999), etl::deque_full); + } + + //************************************************************************* + TEST(test_pop_front_exception) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + data.assign(compare_data.begin(), compare_data.end()); + + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + + CHECK_THROW(data.pop_front(), etl::deque_empty); + } + + //************************************************************************* + TEST(test_push_front_push_back) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5}; + DataNDC data; + + CHECK_NO_THROW(data.push_back(N3)); + CHECK_NO_THROW(data.push_front(N2)); + CHECK_NO_THROW(data.push_back(N4)); + CHECK_NO_THROW(data.push_front(N1)); + CHECK_NO_THROW(data.push_back(N5)); + + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_push_back_pop_front_push_back) + { + Compare_Data compare_data = { N6, N7, N8 }; + DataNDC data; + + data.push_back(N1); + data.push_back(N2); + data.push_back(N3); + data.push_back(N4); + data.push_back(N5); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(N6); + data.push_back(N7); + data.push_back(N8); + + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_pop_front) + { + Compare_Data compare_data = { N1, N2, N3, N4, N5 }; + DataNDC data; + + data.assign(compare_data.begin(), compare_data.end()); + + data.pop_front(); + CHECK_EQUAL(size_t(4), data.size()); + CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); + + data.pop_front(); + CHECK_EQUAL(size_t(3), data.size()); + CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); + + data.pop_front(); + CHECK_EQUAL(size_t(2), data.size()); + CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); + + data.pop_front(); + CHECK_EQUAL(size_t(1), data.size()); + CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); + + data.pop_front(); + CHECK_EQUAL(size_t(0), data.size()); + } + + //************************************************************************* + TEST(test_resize_up) + { + Compare_DataDC compare_data(initial_data_dc.begin(), initial_data_dc.end()); + DataDC data(initial_data_dc.begin(), initial_data_dc.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(DC("14")); + data.push_back(DC("15")); + data.push_back(DC("16")); + data.push_back(DC("17")); + data.resize(SIZE); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(DC("14")); + compare_data.push_back(DC("15")); + compare_data.push_back(DC("16")); + compare_data.push_back(DC("17")); + compare_data.resize(SIZE); + + CHECK_EQUAL(size_t(SIZE), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_resize_down) + { + Compare_DataDC compare_data(initial_data_dc.begin(), initial_data_dc.end()); + DataDC data(initial_data_dc.begin(), initial_data_dc.end()); + + // Cause rollover. + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.push_back(DC("14")); + data.push_back(DC("15")); + data.push_back(DC("16")); + data.push_back(DC("17")); + data.resize(SIZE / 2); + + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.pop_front(); + compare_data.push_back(DC("14")); + compare_data.push_back(DC("15")); + compare_data.push_back(DC("16")); + compare_data.push_back(DC("17")); + compare_data.resize(SIZE / 2); + + CHECK_EQUAL(compare_data.size(), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_resize_value) + { + Compare_Data compare_data = { N1, N2, N3, N3, N3 }; + DataNDC data; + + data.push_front(N1); + data.push_back(N2); + data.resize(SIZE, N3); + + CHECK_EQUAL(size_t(SIZE), data.size()); + CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); + } + + //************************************************************************* + TEST(test_resize_excess) + { + DataDC data; + + CHECK_THROW(data.resize(SIZE + 1), etl::deque_full); + } + + //************************************************************************* + TEST(test_equality_operator) + { + Compare_Data same = { N1, N2, N3, N4, N5, N6 }; + Compare_Data different = { N6, N5, N4, N3, N2, N1 }; + + DataNDC deque1(same.begin(), same.end()); + DataNDC deque2(deque1); + + CHECK(deque1 == deque2); + + // Change deque2's data. + std::copy(different.begin(), different.end(), deque2.begin()); + + CHECK(!(deque1 == deque2)); + } + + //************************************************************************* + TEST(test_inequality_operator) + { + Compare_Data same = { N1, N2, N3, N4, N5, N6 }; + Compare_Data different = { N6, N5, N4, N3, N2, N1 }; + + DataNDC deque1(same.begin(), same.end()); + DataNDC deque2(deque1); + + CHECK(!(deque1 != deque2)); + + // Change deque2's data. + std::copy(different.begin(), different.end(), deque2.begin()); + + CHECK(deque1 != deque2); + } + + //************************************************************************* + TEST(test_iterator_comparison_empty) + { + DataNDC data; + + CHECK(data.begin() == data.end()); + CHECK(data.cbegin() == data.cend()); + CHECK(data.rbegin() == data.rend()); + CHECK(data.crbegin() == data.crend()); + } + + //************************************************************************* + TEST(test_memcpy_repair) + { + DataInt data(int_data1.begin(), int_data1.end()); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.insert(data.end(), int_data2.begin(), int_data2.end()); + + char buffer[sizeof(DataInt)]; + + memcpy(&buffer, (const void*)&data, sizeof(data)); + + DataInt& rdata(*reinterpret_cast(buffer)); + rdata.repair(); + + // Check that the memcpy'd vector is the same. + CHECK_EQUAL(data.size(), rdata.size()); + CHECK(!rdata.empty()); + CHECK(rdata.full()); + + bool is_equal = std::equal(rdata.begin(), + rdata.end(), + data.begin()); + + CHECK(is_equal); + + // Modify the original and check that the memcpy'd vector is not the same. + std::reverse(data.begin(), data.end()); + + is_equal = std::equal(rdata.begin(), + rdata.end(), + data.begin()); + + CHECK(!is_equal); + } + + //************************************************************************* + TEST(test_memcpy_repair_virtual) + { + DataInt data(int_data1.begin(), int_data1.end()); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.pop_front(); + data.insert(data.end(), int_data2.begin(), int_data2.end()); + + char buffer[sizeof(DataInt)]; + + memcpy(&buffer, (const void*)&data, sizeof(data)); + + IDataInt& idata(*reinterpret_cast(buffer)); + idata.repair(); + + // Check that the memcpy'd vector is the same. + CHECK_EQUAL(data.size(), idata.size()); + CHECK(!idata.empty()); + CHECK(idata.full()); + + bool is_equal = std::equal(idata.begin(), + idata.end(), + data.begin()); + + CHECK(is_equal); + + // Modify the original and check that the memcpy'd vector is not the same. + std::reverse(data.begin(), data.end()); + + is_equal = std::equal(idata.begin(), + idata.end(), + data.begin()); + + CHECK(!is_equal); + } + + //************************************************************************* + TEST(test_move) + { + const size_t SIZE = 10UL; + typedef etl::deque, SIZE> Data; + + Data data1; + + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + std::unique_ptr p5(new uint32_t(5U)); + + // Move items to data1. + data1.push_front(std::move(p1)); + data1.push_back(std::move(p2)); + data1.insert(data1.begin(), std::move(p3)); + data1.insert(data1.begin() + 1, std::move(p4)); + data1.insert(data1.end(), std::move(p5)); + + const size_t ACTUAL_SIZE = data1.size(); + + CHECK(!bool(p1)); + CHECK(!bool(p2)); + CHECK(!bool(p3)); + CHECK(!bool(p4)); + CHECK(!bool(p5)); + + CHECK_EQUAL(3U, *(*(data1.begin() + 0))); + CHECK_EQUAL(4U, *(*(data1.begin() + 1))); + CHECK_EQUAL(1U, *(*(data1.begin() + 2))); + CHECK_EQUAL(2U, *(*(data1.begin() + 3))); + CHECK_EQUAL(5U, *(*(data1.begin() + 4))); + + // Move constructor. + Data data2(std::move(data1)); + + CHECK_EQUAL(3U, *(*(data2.begin() + 0))); + CHECK_EQUAL(4U, *(*(data2.begin() + 1))); + CHECK_EQUAL(1U, *(*(data2.begin() + 2))); + CHECK_EQUAL(2U, *(*(data2.begin() + 3))); + CHECK_EQUAL(5U, *(*(data2.begin() + 4))); + + CHECK_EQUAL(ACTUAL_SIZE, data2.size()); + + // Move assignment. + Data data3; + data3 = std::move(data2); + + CHECK_EQUAL(3U, *(*(data3.begin() + 0))); + CHECK_EQUAL(4U, *(*(data3.begin() + 1))); + CHECK_EQUAL(1U, *(*(data3.begin() + 2))); + CHECK_EQUAL(2U, *(*(data3.begin() + 3))); + CHECK_EQUAL(5U, *(*(data3.begin() + 4))); + + CHECK_EQUAL(ACTUAL_SIZE, data3.size()); + } + + //************************************************************************* + TEST(test_two_parameter_constructor_same_type_not_iterator) + { + // No compilation error. + etl::deque v(5, 5); + } + + //************************************************************************* + TEST(test_sort) + { + std::array initial = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; + std::array result = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + etl::deque data(initial.begin(), initial.end()); + std::sort(data.begin(), data.end()); + + bool is_equal = std::equal(data.begin(), + data.end(), + result.begin()); + + CHECK(is_equal); + } + + //************************************************************************* +#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) + TEST(test_deque_template_deduction) + { + etl::deque data{ char(0), short(1), 2, long(3), 4, 5, 6, 7, 8, 9 }; + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif + + //************************************************************************* +#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST + TEST(test_make_deque) + { + auto data = etl::make_deque(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif + + //************************************************************************* + TEST(test_fill) + { + DataNDC data(initial_data.begin(), initial_data.end()); + + data.fill(N999); + + CHECK(std::equal(blank_data.begin(), blank_data.end(), data.begin())); } -// -// //************************************************************************* -// TEST(test_destruct_via_ideque) -// { -// int current_count = NDC::get_instance_count(); -// -// DataNDC* pdata = new DataNDC(SIZE, N999); -// CHECK_EQUAL(int(current_count + SIZE), NDC::get_instance_count()); -// -// IDataNDC* pidata = pdata; -// delete pidata; -// CHECK_EQUAL(current_count, NDC::get_instance_count()); -// } -// -// //************************************************************************* -// TEST(test_constructor_fill_excess) -// { -// CHECK_THROW(DataNDC(SIZE + 1, N999), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_constructor_range) -// { -// Compare_Data compare_data(initial_data.begin(), initial_data.end()); -// DataNDC data(initial_data.begin(), initial_data.end()); -// -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -//#if ETL_HAS_INITIALIZER_LIST -// //************************************************************************* -// TEST(test_constructor_initializer_list) -// { -// Compare_Data compare_data = { N0, N1, N2, N3 }; -// DataNDC data = { N0, N1, N2, N3 }; -// -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -//#endif -// -// //************************************************************************* -// TEST(test_copy_constructor) -// { -// DataNDC deque1(initial_data.begin(), initial_data.end()); -// DataNDC deque2(deque1); -// -// CHECK_EQUAL(deque1.size(), deque2.size()); -// CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); -// } -// -// //************************************************************************* -// TEST(test_move_constructor) -// { -// const size_t SIZE = 10UL; -// typedef etl::deque, SIZE> Data; -// -// std::unique_ptr p1(new uint32_t(1U)); -// std::unique_ptr p2(new uint32_t(2U)); -// std::unique_ptr p3(new uint32_t(3U)); -// std::unique_ptr p4(new uint32_t(4U)); -// -// Data deque1; -// deque1.push_back(std::move(p1)); -// deque1.push_back(std::move(p2)); -// deque1.push_back(std::move(p3)); -// deque1.push_back(std::move(p4)); -// -// Data deque2(std::move(deque1)); -// -// CHECK_EQUAL(4U, deque2.size()); -// -// std::unique_ptr pr = std::move(*deque2.begin()); -// -// CHECK_EQUAL(1U, *pr); -// CHECK_EQUAL(2U, *deque2[1]); -// CHECK_EQUAL(3U, *deque2[2]); -// CHECK_EQUAL(4U, *deque2[3]); -// } -// -// //************************************************************************* -// TEST(test_move_insert_erase) -// { -// const size_t SIZE = 10UL; -// typedef etl::deque, SIZE> Data; -// -// std::unique_ptr p1(new uint32_t(1U)); -// std::unique_ptr p2(new uint32_t(2U)); -// std::unique_ptr p3(new uint32_t(3U)); -// std::unique_ptr p4(new uint32_t(4U)); -// -// Data deque1; -// deque1.push_back(std::move(p1)); -// deque1.push_back(std::move(p2)); -// deque1.push_back(std::move(p4)); -// -// deque1.insert(deque1.begin() + 2U, std::move(p3)); -// -// CHECK_EQUAL(4U, deque1.size()); -// -// CHECK(bool(deque1[0])); -// CHECK(bool(deque1[1])); -// CHECK(bool(deque1[2])); -// CHECK(bool(deque1[3])); -// -// CHECK_EQUAL(1U, *deque1[0]); -// CHECK_EQUAL(2U, *deque1[1]); -// CHECK_EQUAL(3U, *deque1[2]); -// CHECK_EQUAL(4U, *deque1[3]); -// -// deque1.erase(deque1.begin() + 1); -// -// CHECK(bool(deque1[0])); -// CHECK(bool(deque1[1])); -// CHECK(bool(deque1[2])); -// -// CHECK_EQUAL(1U, *deque1[0]); -// CHECK_EQUAL(3U, *deque1[1]); -// CHECK_EQUAL(4U, *deque1[2]); -// } -// -// //************************************************************************* -// TEST(test_assignment) -// { -// DataNDC deque1(initial_data.begin(), initial_data.end()); -// DataNDC deque2; -// -// deque2 = deque1; -// -// CHECK_EQUAL(deque1.size(), deque2.size()); -// CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); -// } -// -// //************************************************************************* -// TEST(test_move_assignment) -// { -// const size_t SIZE = 10UL; -// typedef etl::deque, SIZE> Data; -// -// std::unique_ptr p1(new uint32_t(1U)); -// std::unique_ptr p2(new uint32_t(2U)); -// std::unique_ptr p3(new uint32_t(3U)); -// std::unique_ptr p4(new uint32_t(4U)); -// std::unique_ptr p5(new uint32_t(5U)); -// -// Data deque1; -// deque1.push_back(std::move(p1)); -// deque1.push_back(std::move(p2)); -// deque1.push_back(std::move(p3)); -// deque1.push_back(std::move(p4)); -// -// Data deque2; -// deque2.push_back(std::move(p5)); -// deque2 = std::move(deque1); -// -// CHECK_EQUAL(4U, deque2.size()); -// -// CHECK_EQUAL(1U, *deque2[0]); -// CHECK_EQUAL(2U, *deque2[1]); -// CHECK_EQUAL(3U, *deque2[2]); -// CHECK_EQUAL(4U, *deque2[3]); -// } -// -// //************************************************************************* -// TEST(test_assignment_interface) -// { -// DataNDC deque1(initial_data.begin(), initial_data.end()); -// DataNDC deque2; -// -// IDataNDC& ideque1 = deque1; -// IDataNDC& ideque2 = deque2; -// -// ideque2 = ideque1; -// -// CHECK_EQUAL(deque1.size(), deque2.size()); -// CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); -// } -// -// //************************************************************************* -// TEST(test_move_assignment_interface) -// { -// const size_t SIZE = 10UL; -// typedef etl::deque, SIZE> Data; -// typedef etl::ideque> IData; -// -// std::unique_ptr p1(new uint32_t(1U)); -// std::unique_ptr p2(new uint32_t(2U)); -// std::unique_ptr p3(new uint32_t(3U)); -// std::unique_ptr p4(new uint32_t(4U)); -// std::unique_ptr p5(new uint32_t(5U)); -// -// Data deque1; -// deque1.push_back(std::move(p1)); -// deque1.push_back(std::move(p2)); -// deque1.push_back(std::move(p3)); -// deque1.push_back(std::move(p4)); -// -// Data deque2; -// deque2.push_back(std::move(p5)); -// -// IData& ideque1 = deque1; -// IData& ideque2 = deque2; -// -// ideque2 = std::move(ideque1); -// -// CHECK_EQUAL(0U, deque1.size()); -// CHECK_EQUAL(4U, deque2.size()); -// -// CHECK_EQUAL(1U, *deque2[0]); -// CHECK_EQUAL(2U, *deque2[1]); -// CHECK_EQUAL(3U, *deque2[2]); -// CHECK_EQUAL(4U, *deque2[3]); -// } -// -// //************************************************************************* -// TEST(test_self_assignment) -// { -// DataNDC deque1(initial_data.begin(), initial_data.end()); -// DataNDC deque2(deque1); -// -//#include "etl/private/diagnostic_self_assign_overloaded_push.h" -// deque2 = deque2; -//#include "etl/private/diagnostic_pop.h" -// -// CHECK_EQUAL(deque1.size(), deque2.size()); -// CHECK(std::equal(deque1.begin(), deque1.end(), deque2.begin())); -// } -// -// //************************************************************************* -// TEST(test_assign_range) -// { -// DataNDC data; -// -// CHECK_NO_THROW(data.assign(initial_data.begin(), initial_data.end())); -// -// CHECK_EQUAL(initial_data.size(), data.size()); -// CHECK(std::equal(initial_data.begin(), initial_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_assign_range_excess) -// { -// DataNDC data; -// -// CHECK_THROW(data.assign(initial_data_excess.begin(), initial_data_excess.end()), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_assign_fill) -// { -// Compare_Data compare_data; -// DataNDC data; -// -// compare_data.assign(SIZE, N999); -// -// CHECK_NO_THROW(data.assign(SIZE, N999)); -// -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_assign_fill_excess) -// { -// DataNDC data; -// -// CHECK_THROW(data.assign(SIZE + 1, N999), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_at) -// { -// Compare_Data compare_data(initial_data.begin(), initial_data.end()); -// DataNDC data(initial_data.begin(), initial_data.end()); -// -// CHECK_EQUAL(compare_data.at(0), data.at(0)); -// CHECK_EQUAL(compare_data.at(1), data.at(1)); -// CHECK_EQUAL(compare_data.at(2), data.at(2)); -// CHECK_EQUAL(compare_data.at(3), data.at(3)); -// CHECK_EQUAL(compare_data.at(4), data.at(4)); -// CHECK_EQUAL(compare_data.at(5), data.at(5)); -// } -// -// //************************************************************************* -// TEST(test_at_const) -// { -// const Compare_Data compare_data(initial_data.begin(), initial_data.end()); -// const DataNDC data(initial_data.begin(), initial_data.end()); -// -// CHECK_EQUAL(compare_data.at(0), data.at(0)); -// CHECK_EQUAL(compare_data.at(1), data.at(1)); -// CHECK_EQUAL(compare_data.at(2), data.at(2)); -// CHECK_EQUAL(compare_data.at(3), data.at(3)); -// CHECK_EQUAL(compare_data.at(4), data.at(4)); -// CHECK_EQUAL(compare_data.at(5), data.at(5)); -// } -// -// //************************************************************************* -// TEST(test_index_operator) -// { -// Compare_Data compare_data(initial_data.begin(), initial_data.end()); -// DataNDC data(initial_data.begin(), initial_data.end()); -// -// CHECK_EQUAL(compare_data[0], data[0]); -// CHECK_EQUAL(compare_data[1], data[1]); -// CHECK_EQUAL(compare_data[2], data[2]); -// CHECK_EQUAL(compare_data[3], data[3]); -// CHECK_EQUAL(compare_data[4], data[4]); -// CHECK_EQUAL(compare_data[5], data[5]); -// } -// -// //************************************************************************* -// TEST(test_index_operator_const) -// { -// const Compare_Data compare_data(initial_data.begin(), initial_data.end()); -// const DataNDC data(initial_data.begin(), initial_data.end()); -// -// CHECK_EQUAL(compare_data[0], data[0]); -// CHECK_EQUAL(compare_data[1], data[1]); -// CHECK_EQUAL(compare_data[2], data[2]); -// CHECK_EQUAL(compare_data[3], data[3]); -// CHECK_EQUAL(compare_data[4], data[4]); -// CHECK_EQUAL(compare_data[5], data[5]); -// } -// -// //************************************************************************* -// TEST(test_front) -// { -// DataNDC data; -// -// data.push_front(N1); -// CHECK_EQUAL(N1, data.front()); -// -// data.push_front(N2); -// CHECK_EQUAL(N2, data.front()); -// -// data.push_front(N3); -// CHECK_EQUAL(N3, data.front()); -// -// data.push_front(N4); -// CHECK_EQUAL(N4, data.front()); -// -// data.push_front(N5); -// CHECK_EQUAL(N5, data.front()); -// -// data.push_front(N6); -// CHECK_EQUAL(N6, data.front()); -// } -// -// //************************************************************************* -// TEST(test_front_const) -// { -// DataNDC data; -// const DataNDC& ctestDeque = data; -// -// data.push_front(N1); -// CHECK_EQUAL(N1, ctestDeque.front()); -// -// data.push_front(N2); -// CHECK_EQUAL(N2, ctestDeque.front()); -// -// data.push_front(N3); -// CHECK_EQUAL(N3, ctestDeque.front()); -// -// data.push_front(N4); -// CHECK_EQUAL(N4, ctestDeque.front()); -// -// data.push_front(N5); -// CHECK_EQUAL(N5, ctestDeque.front()); -// -// data.push_front(N6); -// CHECK_EQUAL(N6, ctestDeque.front()); -// } -// -// //************************************************************************* -// TEST(test_back) -// { -// DataNDC data; -// -// data.push_back(N1); -// CHECK_EQUAL(N1, data.back()); -// -// data.push_back(N2); -// CHECK_EQUAL(N2, data.back()); -// -// data.push_back(N3); -// CHECK_EQUAL(N3, data.back()); -// -// data.push_back(N4); -// CHECK_EQUAL(N4, data.back()); -// -// data.push_back(N5); -// CHECK_EQUAL(N5, data.back()); -// -// data.push_back(N6); -// CHECK_EQUAL(N6, data.back()); -// } -// -// //************************************************************************* -// TEST(test_back_const) -// { -// DataNDC data; -// const DataNDC& ctestDeque = data; -// -// data.push_back(N1); -// CHECK_EQUAL(N1, ctestDeque.back()); -// -// data.push_back(N2); -// CHECK_EQUAL(N2, ctestDeque.back()); -// -// data.push_back(N3); -// CHECK_EQUAL(N3, ctestDeque.back()); -// -// data.push_back(N4); -// CHECK_EQUAL(N4, ctestDeque.back()); -// -// data.push_back(N5); -// CHECK_EQUAL(N5, ctestDeque.back()); -// -// data.push_back(N6); -// CHECK_EQUAL(N6, ctestDeque.back()); -// } -// -// //************************************************************************* -// TEST(test_iterator_comparison) -// { -// DataNDC data(SIZE, N0); -// -// DataNDC::iterator first = data.begin() + 1; -// DataNDC::iterator second = data.begin() + 1; -// DataNDC::iterator third = data.begin() + 4; -// -// CHECK(first == second); -// CHECK(second == first); -// CHECK(!(first == third)); -// CHECK(!(third == first)); -// -// CHECK(!(first != second)); -// CHECK(!(second != first)); -// CHECK(first != third); -// CHECK(third != first); -// -// CHECK(!(first < second)); -// CHECK(!(second < first)); -// CHECK(first < third); -// CHECK(!(third < first)); -// -// CHECK(first <= second); -// CHECK(second <= first); -// CHECK(first <= third); -// CHECK(!(third <= first)); -// -// CHECK(!(first > second)); -// CHECK(!(second > first)); -// CHECK(!(first > third)); -// CHECK(third > first); -// -// CHECK(first >= second); -// CHECK(second >= first); -// CHECK(!(first >= third)); -// CHECK(third >= first); -// } -// -// //************************************************************************* -// TEST(test_const_iterator_comparison) -// { -// DataNDC data(SIZE, N0); -// -// DataNDC::const_iterator first = data.begin() + 1; -// DataNDC::const_iterator second = data.begin() + 1; -// DataNDC::const_iterator third = data.begin() + 4; -// -// CHECK(first == second); -// CHECK(second == first); -// CHECK(!(first == third)); -// CHECK(!(third == first)); -// -// CHECK(!(first != second)); -// CHECK(!(second != first)); -// CHECK(first != third); -// CHECK(third != first); -// -// CHECK(!(first < second)); -// CHECK(!(second < first)); -// CHECK(first < third); -// CHECK(!(third < first)); -// -// CHECK(first <= second); -// CHECK(second <= first); -// CHECK(first <= third); -// CHECK(!(third <= first)); -// -// CHECK(!(first > second)); -// CHECK(!(second > first)); -// CHECK(!(first > third)); -// CHECK(third > first); -// -// CHECK(first >= second); -// CHECK(second >= first); -// CHECK(!(first >= third)); -// CHECK(third >= first); -// } -// -// //************************************************************************* -// TEST(test_iterator_comparison_rollover_left) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// -// DataNDC::const_iterator first = data.cbegin() + 1; -// DataNDC::const_iterator second = data.cbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_const_iterator_comparison_rollover_left) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// -// DataNDC::const_iterator first = data.cbegin() + 1; -// DataNDC::const_iterator second = data.cbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_iterator_comparison_rollover_right) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// -// DataNDC::iterator first = data.begin() + 1; -// DataNDC::iterator second = data.begin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_const_iterator_comparison_rollover_right) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// -// DataNDC::const_iterator first = data.cbegin() + 1; -// DataNDC::const_iterator second = data.cbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_reverse_iterator_comparison) -// { -// DataNDC data(SIZE, N0); -// -// DataNDC::reverse_iterator first = data.rbegin() + 1; -// DataNDC::reverse_iterator second = data.rbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_const_reverse_iterator_comparison) -// { -// DataNDC data(SIZE, N0); -// -// DataNDC::const_reverse_iterator first = data.crbegin() + 1; -// DataNDC::const_reverse_iterator second = data.crbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_reverse_iterator_comparison_rollover_left) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// -// DataNDC::reverse_iterator first = data.rbegin() + 1; -// DataNDC::reverse_iterator second = data.rbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_const_reverse_iterator_comparison_rollover_left) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// data.push_front(N1); -// -// DataNDC::const_reverse_iterator first = data.crbegin() + 1; -// DataNDC::const_reverse_iterator second = data.crbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_reverse_iterator_comparison_rollover_right) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// -// DataNDC::reverse_iterator first = data.rbegin() + 1; -// DataNDC::reverse_iterator second = data.rbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_const_reverse_iterator_comparison_rollover_right) -// { -// DataNDC data(SIZE, N0); -// -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// data.push_back(N1); -// -// DataNDC::const_reverse_iterator first = data.crbegin() + 1; -// DataNDC::const_reverse_iterator second = data.crbegin() + 4; -// -// CHECK(first < second); -// CHECK(!(second < first)); -// } -// -// //************************************************************************* -// TEST(test_empty) -// { -// DataNDC data; -// -// CHECK(data.empty()); -// } -// -// //************************************************************************* -// TEST(test_full) -// { -// DataDC data; -// data.resize(SIZE); -// -// CHECK(data.full()); -// } -// -// //************************************************************************* -// TEST(test_clear) -// { -// DataDC data; -// -// data.resize(SIZE); -// data.clear(); -// CHECK(data.empty()); -// -// // Do it again to check that clear() didn't screw up the internals. -// data.resize(SIZE); -// CHECK_EQUAL(SIZE, data.size()); -// data.clear(); -// CHECK(data.empty()); -// } -// -// //************************************************************************* -// TEST(test_clear_pod) -// { -// DataInt data; -// -// data.resize(SIZE); -// data.clear(); -// CHECK(data.empty()); -// -// // Do it again to check that clear() didn't screw up the internals. -// data.resize(SIZE); -// data.clear(); -// CHECK(data.empty()); -// } -// -// //************************************************************************* -// TEST(test_insert_to_empty) -// { -// const int value(5); -// const size_t insertCount = 2UL; -// etl::deque valuesToInsert(insertCount, value); -// etl::deque data; -// -// data.insert(data.cbegin(), valuesToInsert.begin(), valuesToInsert.end()); -// -// CHECK_EQUAL(insertCount, std::distance(data.begin(), data.end())); -// CHECK(data.size() == insertCount); -// CHECK(data[0] == value); -// CHECK(data[1] == value); -// CHECK(std::equal(data.begin(), data.end(), valuesToInsert.begin())); -// } -// -// //************************************************************************* -// TEST(test_insert_value_begin) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.insert(compare_data.cbegin(), N14); -// DataNDC::iterator position = data.insert(data.cbegin(), N14); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_emplace_value_begin) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin(), N14.value); -// DataNDC::iterator position = data.emplace(data.begin(), N14.value); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_insert_value_end) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.insert(compare_data.cend(), N14); -// DataNDC::iterator position = data.insert(data.cend(), N14); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_emplace_value_end) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.emplace(compare_data.end(), N14.value); -// DataNDC::iterator position = data.emplace(data.end(), N14.value); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_insert_value) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.insert(compare_data.cbegin() + 3, N14); -// DataNDC::iterator position = data.insert(data.cbegin() + 3, N14); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// -// compare_data.assign(initial_data_under.begin(), initial_data_under.end()); -// data.assign(compare_data.begin(), compare_data.end()); -// -// cposition = compare_data.insert(compare_data.cbegin() + 4, N14); -// position = data.insert(data.cbegin() + 4, N14); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_emplace_value) -// { -// Compare_Data compare_data(initial_data_under.begin(), initial_data_under.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin() + 3, N14.value); -// DataNDC::iterator position = data.emplace(data.begin() + 3, N14.value); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// -// compare_data.assign(initial_data_under.begin(), initial_data_under.end()); -// data.assign(compare_data.begin(), compare_data.end()); -// -// cposition = compare_data.emplace(compare_data.begin() + 4, N14.value); -// position = data.emplace(data.begin() + 4, N14.value); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position)); -// } -// -// //************************************************************************* -// TEST(test_emplace_default) -// { -// const int Initial = 1; -// const int Default = 2; -// -// struct S -// { -// S() -// : value(Default) -// { -// } -// -// S(int v) -// : value(v) -// { -// } -// -// bool operator ==(const S& rhs) const -// { -// return value == rhs.value; -// } -// -// int value; -// }; -// -// // First fill with Initial values. -// etl::deque data; -// data.resize(SIZE, S(Initial)); -// data.clear(); -// -// // Then emplace Default values. -// for (size_t i = 0; i < SIZE; ++i) -// { -// data.emplace(data.end()); -// } -// -// // Compare with an array of default values. -// std::array compare_data; -// compare_data.fill(S()); -// -// CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_front_default) -// { -// const int Initial = 1; -// const int Default = 2; -// -// struct S -// { -// S() -// : value(Default) -// { -// } -// -// S(int v) -// : value(v) -// { -// } -// -// bool operator ==(const S& rhs) const -// { -// return value == rhs.value; -// } -// -// int value; -// }; -// -// // First fill with Initial values. -// etl::deque data; -// data.resize(SIZE, S(Initial)); -// data.clear(); -// -// // Then emplace Default values. -// for (size_t i = 0; i < SIZE; ++i) -// { -// data.emplace_front(); -// } -// -// // Compare with an array of default values. -// std::array compare_data; -// compare_data.fill(S()); -// -// CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_back_default) -// { -// const int Initial = 1; -// const int Default = 2; -// -// struct S -// { -// S() -// : value(Default) -// { -// } -// -// S(int v) -// : value(v) -// { -// } -// -// bool operator ==(const S& rhs) const -// { -// return value == rhs.value; -// } -// -// int value; -// }; -// -// // First fill with Initial values. -// etl::deque data; -// data.resize(SIZE, S(Initial)); -// data.clear(); -// -// // Then emplace Default values. -// for (size_t i = 0; i < SIZE; ++i) -// { -// data.emplace_back(); -// } -// -// // Compare with an array of default values. -// std::array compare_data; -// compare_data.fill(S()); -// -// CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_insert_n_value_position) -// { -// size_t max_insert = SIZE - initial_data_small.size(); -// -// for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size) -// { -// for (size_t offset = 0UL; offset <= initial_data_small.size(); ++offset) -// { -// Compare_Data compare_data(initial_data_small.begin(), initial_data_small.end()); -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// compare_data.insert(compare_data.cbegin() + offset, insert_size, N14); -// data.insert(data.cbegin() + offset, insert_size, N14); -// -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// } -// } -// -// //************************************************************************* -// TEST(test_insert_n_value_excess) -// { -// DataNDC data(initial_data_under.begin(), initial_data_under.end()); -// -// size_t insert_size = SIZE - initial_data_under.size() + 1; -// -// CHECK_THROW(data.insert(data.cbegin(), insert_size, N14), etl::deque_full); -// CHECK_THROW(data.insert(data.cend(), insert_size, N14), etl::deque_full); -// CHECK_THROW(data.insert(data.cbegin() + 6, insert_size, N14), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_insert_range) -// { -// size_t max_insert = SIZE - initial_data_small.size(); -// -// for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size) -// { -// Compare_Data range(insert_data.begin(), insert_data.begin() + insert_size); -// -// for (size_t offset = 0UL; offset <= initial_data_small.size(); ++offset) -// { -// Compare_Data compare_data(initial_data_small.begin(), initial_data_small.end()); -// DataNDC data(blank_data.begin(), blank_data.end()); -// data.assign(compare_data.begin(), compare_data.end()); -// -// compare_data.insert(compare_data.cbegin() + offset, range.begin(), range.end()); -// data.insert(data.cbegin() + offset, range.begin(), range.end()); -// -// CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end())); -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// } -// } -// -// //************************************************************************* -// TEST(test_insert_range_excess) -// { -// Compare_Data range = { N12, N13, N14, N15 }; -// DataNDC data(initial_data_under.begin(), initial_data_under.end()); -// -// CHECK_THROW(data.insert(data.cbegin(), range.begin(), range.end()), etl::deque_full); -// CHECK_THROW(data.insert(data.cend(), range.begin(), range.end()), etl::deque_full); -// CHECK_THROW(data.insert(data.cbegin() + 6, range.begin(), range.end()), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_erase_begin) -// { -// Compare_Data compare_data = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// DataNDC::const_iterator i_next = data.erase(data.cbegin()); -// Compare_Data::const_iterator i_cnext = compare_data.erase(compare_data.cbegin()); -// -// CHECK_EQUAL(DataNDC::difference_type(data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.cbegin(), i_cnext), std::distance(data.cbegin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_erase_end) -// { -// Compare_Data compare_data = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// DataNDC data(compare_data.begin(), compare_data.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// DataNDC::iterator i_erase = data.end() - 1; -// DataNDC::iterator i_next = data.erase(i_erase); -// -// Compare_Data::const_iterator i_cerase = compare_data.cend() - 1U; -// Compare_Data::iterator i_cnext = compare_data.erase(i_cerase); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_erase_middle) -// { -// std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// -// Compare_Data compare_data(initial.begin(), initial.end()); -// DataNDC data(initial.begin(), initial.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// // Erase near beginning. -// DataNDC::const_iterator i_erase = data.begin() + 2; -// DataNDC::iterator i_next = data.erase(i_erase); -// -// Compare_Data::const_iterator i_cerase = compare_data.begin() + 2; -// Compare_Data::iterator i_cnext = compare_data.erase(i_cerase); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// -// compare_data.assign(initial.begin(), initial.end()); -// data.assign(initial.begin(), initial.end()); -// -// // Cause rollover. -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// // Erase near end. -// i_erase = data.begin() + 3; -// i_next = data.erase(i_erase); -// -// i_cerase = compare_data.begin() + 3; -// i_cnext = compare_data.erase(i_cerase); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_erase_range_begin) -// { -// std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// -// Compare_Data compare_data(initial.begin(), initial.end()); -// DataNDC data(initial.begin(), initial.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// DataNDC::iterator i_next = data.erase(data.cbegin(), data.cbegin() + 3); -// Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cbegin(), compare_data.cbegin() + 3); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_erase_range_end) -// { -// std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// -// Compare_Data compare_data(initial.begin(), initial.end()); -// DataNDC data(initial.begin(), initial.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// DataNDC::iterator i_next = data.erase(data.cend() - 3, data.cend()); -// Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cend() - 3, compare_data.cend()); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_erase_range_middle) -// { -// std::vector initial = { N0, N0, N0, N0, N0, N0, N0, N0, N0, N1, N2, N3 }; -// -// Compare_Data compare_data(initial.begin(), initial.end()); -// DataNDC data(initial.begin(), initial.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// DataNDC::iterator i_next = data.erase(data.cbegin() + 1, data.cbegin() + 3); -// Compare_Data::iterator i_cnext = compare_data.erase(compare_data.cbegin() + 1, compare_data.cbegin() + 3); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// -// compare_data.assign(initial.begin(), initial.end()); -// data.assign(initial.begin(), initial.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N4); -// data.push_back(N5); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// data.push_back(N9); -// data.push_back(N10); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(N4); -// compare_data.push_back(N5); -// compare_data.push_back(N6); -// compare_data.push_back(N7); -// compare_data.push_back(N8); -// compare_data.push_back(N9); -// compare_data.push_back(N10); -// -// i_next = data.erase(data.cbegin() + 3, data.cbegin() + 5); -// i_cnext = compare_data.erase(compare_data.cbegin() + 3, compare_data.cbegin() + 5); -// -// CHECK_EQUAL(DataNDC::difference_type(compare_data.size()), std::distance(data.begin(), data.end())); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// CHECK_EQUAL(std::distance(compare_data.begin(), i_cnext), std::distance(data.begin(), i_next)); -// } -// -// //************************************************************************* -// TEST(test_push_back) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// CHECK_NO_THROW(data.push_back(N1)); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); -// -// CHECK_NO_THROW(data.push_back(N2)); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); -// -// CHECK_NO_THROW(data.push_back(N3)); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); -// -// CHECK_NO_THROW(data.push_back(N4)); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); -// -// CHECK_NO_THROW(data.push_back(N5)); -// CHECK_EQUAL(size_t(5), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_back) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// CHECK_NO_THROW(data.emplace_back("1")); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); -// -// CHECK_NO_THROW(data.emplace_back("2")); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); -// -// CHECK_NO_THROW(data.emplace_back("3")); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); -// -// CHECK_NO_THROW(data.emplace_back("4")); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); -// -// CHECK_NO_THROW(data.emplace_back("5")); -// CHECK_EQUAL(size_t(5), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_back_return) -// { -// DataNDC data; -// -// data.emplace_back("24"); -// auto& back = data.emplace_back("42"); -// CHECK_EQUAL(back, data.back()); -// } -// -// //************************************************************************* -// TEST(test_push_back_excess) -// { -// DataNDC data; -// -// for (size_t i = 0UL; i < SIZE; ++i) -// { -// CHECK_NO_THROW(data.push_back(N0)); -// } -// -// CHECK_THROW(data.push_back(N999), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_pop_back) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// data.assign(compare_data.begin(), compare_data.end()); -// -// data.pop_back(); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 1, data.begin())); -// -// data.pop_back(); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 2, data.begin())); -// -// data.pop_back(); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 3, data.begin())); -// -// data.pop_back(); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end() - 4, data.begin())); -// -// data.pop_back(); -// CHECK_EQUAL(size_t(0), data.size()); -// } -// -// //************************************************************************* -// TEST(test_pop_back_exception) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// data.assign(compare_data.begin(), compare_data.end()); -// -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// data.pop_back(); -// -// CHECK_THROW(data.pop_back(), etl::deque_empty); -// } -// -// //************************************************************************* -// TEST(test_push_front) -// { -// Compare_Data compare_data = { N5, N4, N3, N2, N1 }; -// DataNDC data; -// -// CHECK_NO_THROW(data.push_front(N1)); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.push_front(N2)); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.push_front(N3)); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.push_front(N4)); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.push_front(N5)); -// CHECK_EQUAL(size_t(5), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_front) -// { -// Compare_Data compare_data = { N5, N4, N3, N2, N1 }; -// DataNDC data; -// -// CHECK_NO_THROW(data.emplace_front("1")); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.emplace_front("2")); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.emplace_front("3")); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.emplace_front("4")); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); -// -// CHECK_NO_THROW(data.emplace_front("5")); -// CHECK_EQUAL(size_t(5), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_emplace_front_return) -// { -// DataNDC data; -// -// data.emplace_front("24"); -// auto& front = data.emplace_front("42"); -// CHECK_EQUAL(front, data.front()); -// } -// -// //************************************************************************* -// TEST(test_push_front_excess) -// { -// DataNDC data; -// -// for (size_t i = 0UL; i < SIZE; ++i) -// { -// CHECK_NO_THROW(data.push_front(N1)); -// } -// -// CHECK_THROW(data.push_front(N999), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_pop_front_exception) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// data.assign(compare_data.begin(), compare_data.end()); -// -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// -// CHECK_THROW(data.pop_front(), etl::deque_empty); -// } -// -// //************************************************************************* -// TEST(test_push_front_push_back) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5}; -// DataNDC data; -// -// CHECK_NO_THROW(data.push_back(N3)); -// CHECK_NO_THROW(data.push_front(N2)); -// CHECK_NO_THROW(data.push_back(N4)); -// CHECK_NO_THROW(data.push_front(N1)); -// CHECK_NO_THROW(data.push_back(N5)); -// -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_push_back_pop_front_push_back) -// { -// Compare_Data compare_data = { N6, N7, N8 }; -// DataNDC data; -// -// data.push_back(N1); -// data.push_back(N2); -// data.push_back(N3); -// data.push_back(N4); -// data.push_back(N5); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(N6); -// data.push_back(N7); -// data.push_back(N8); -// -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_pop_front) -// { -// Compare_Data compare_data = { N1, N2, N3, N4, N5 }; -// DataNDC data; -// -// data.assign(compare_data.begin(), compare_data.end()); -// -// data.pop_front(); -// CHECK_EQUAL(size_t(4), data.size()); -// CHECK(std::equal(compare_data.begin() + 1, compare_data.end(), data.begin())); -// -// data.pop_front(); -// CHECK_EQUAL(size_t(3), data.size()); -// CHECK(std::equal(compare_data.begin() + 2, compare_data.end(), data.begin())); -// -// data.pop_front(); -// CHECK_EQUAL(size_t(2), data.size()); -// CHECK(std::equal(compare_data.begin() + 3, compare_data.end(), data.begin())); -// -// data.pop_front(); -// CHECK_EQUAL(size_t(1), data.size()); -// CHECK(std::equal(compare_data.begin() + 4, compare_data.end(), data.begin())); -// -// data.pop_front(); -// CHECK_EQUAL(size_t(0), data.size()); -// } -// -// //************************************************************************* -// TEST(test_resize_up) -// { -// Compare_DataDC compare_data(initial_data_dc.begin(), initial_data_dc.end()); -// DataDC data(initial_data_dc.begin(), initial_data_dc.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(DC("14")); -// data.push_back(DC("15")); -// data.push_back(DC("16")); -// data.push_back(DC("17")); -// data.resize(SIZE); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(DC("14")); -// compare_data.push_back(DC("15")); -// compare_data.push_back(DC("16")); -// compare_data.push_back(DC("17")); -// compare_data.resize(SIZE); -// -// CHECK_EQUAL(size_t(SIZE), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_resize_down) -// { -// Compare_DataDC compare_data(initial_data_dc.begin(), initial_data_dc.end()); -// DataDC data(initial_data_dc.begin(), initial_data_dc.end()); -// -// // Cause rollover. -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.push_back(DC("14")); -// data.push_back(DC("15")); -// data.push_back(DC("16")); -// data.push_back(DC("17")); -// data.resize(SIZE / 2); -// -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.pop_front(); -// compare_data.push_back(DC("14")); -// compare_data.push_back(DC("15")); -// compare_data.push_back(DC("16")); -// compare_data.push_back(DC("17")); -// compare_data.resize(SIZE / 2); -// -// CHECK_EQUAL(compare_data.size(), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_resize_value) -// { -// Compare_Data compare_data = { N1, N2, N3, N3, N3 }; -// DataNDC data; -// -// data.push_front(N1); -// data.push_back(N2); -// data.resize(SIZE, N3); -// -// CHECK_EQUAL(size_t(SIZE), data.size()); -// CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); -// } -// -// //************************************************************************* -// TEST(test_resize_excess) -// { -// DataDC data; -// -// CHECK_THROW(data.resize(SIZE + 1), etl::deque_full); -// } -// -// //************************************************************************* -// TEST(test_equality_operator) -// { -// Compare_Data same = { N1, N2, N3, N4, N5, N6 }; -// Compare_Data different = { N6, N5, N4, N3, N2, N1 }; -// -// DataNDC deque1(same.begin(), same.end()); -// DataNDC deque2(deque1); -// -// CHECK(deque1 == deque2); -// -// // Change deque2's data. -// std::copy(different.begin(), different.end(), deque2.begin()); -// -// CHECK(!(deque1 == deque2)); -// } -// -// //************************************************************************* -// TEST(test_inequality_operator) -// { -// Compare_Data same = { N1, N2, N3, N4, N5, N6 }; -// Compare_Data different = { N6, N5, N4, N3, N2, N1 }; -// -// DataNDC deque1(same.begin(), same.end()); -// DataNDC deque2(deque1); -// -// CHECK(!(deque1 != deque2)); -// -// // Change deque2's data. -// std::copy(different.begin(), different.end(), deque2.begin()); -// -// CHECK(deque1 != deque2); -// } -// -// //************************************************************************* -// TEST(test_iterator_comparison_empty) -// { -// DataNDC data; -// -// CHECK(data.begin() == data.end()); -// CHECK(data.cbegin() == data.cend()); -// CHECK(data.rbegin() == data.rend()); -// CHECK(data.crbegin() == data.crend()); -// } -// -// //************************************************************************* -// TEST(test_memcpy_repair) -// { -// DataInt data(int_data1.begin(), int_data1.end()); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.insert(data.end(), int_data2.begin(), int_data2.end()); -// -// char buffer[sizeof(DataInt)]; -// -// memcpy(&buffer, (const void*)&data, sizeof(data)); -// -// DataInt& rdata(*reinterpret_cast(buffer)); -// rdata.repair(); -// -// // Check that the memcpy'd vector is the same. -// CHECK_EQUAL(data.size(), rdata.size()); -// CHECK(!rdata.empty()); -// CHECK(rdata.full()); -// -// bool is_equal = std::equal(rdata.begin(), -// rdata.end(), -// data.begin()); -// -// CHECK(is_equal); -// -// // Modify the original and check that the memcpy'd vector is not the same. -// std::reverse(data.begin(), data.end()); -// -// is_equal = std::equal(rdata.begin(), -// rdata.end(), -// data.begin()); -// -// CHECK(!is_equal); -// } -// -// //************************************************************************* -// TEST(test_memcpy_repair_virtual) -// { -// DataInt data(int_data1.begin(), int_data1.end()); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.pop_front(); -// data.insert(data.end(), int_data2.begin(), int_data2.end()); -// -// char buffer[sizeof(DataInt)]; -// -// memcpy(&buffer, (const void*)&data, sizeof(data)); -// -// IDataInt& idata(*reinterpret_cast(buffer)); -// idata.repair(); -// -// // Check that the memcpy'd vector is the same. -// CHECK_EQUAL(data.size(), idata.size()); -// CHECK(!idata.empty()); -// CHECK(idata.full()); -// -// bool is_equal = std::equal(idata.begin(), -// idata.end(), -// data.begin()); -// -// CHECK(is_equal); -// -// // Modify the original and check that the memcpy'd vector is not the same. -// std::reverse(data.begin(), data.end()); -// -// is_equal = std::equal(idata.begin(), -// idata.end(), -// data.begin()); -// -// CHECK(!is_equal); -// } -// -// //************************************************************************* -// TEST(test_move) -// { -// const size_t SIZE = 10UL; -// typedef etl::deque, SIZE> Data; -// -// Data data1; -// -// std::unique_ptr p1(new uint32_t(1U)); -// std::unique_ptr p2(new uint32_t(2U)); -// std::unique_ptr p3(new uint32_t(3U)); -// std::unique_ptr p4(new uint32_t(4U)); -// std::unique_ptr p5(new uint32_t(5U)); -// -// // Move items to data1. -// data1.push_front(std::move(p1)); -// data1.push_back(std::move(p2)); -// data1.insert(data1.begin(), std::move(p3)); -// data1.insert(data1.begin() + 1, std::move(p4)); -// data1.insert(data1.end(), std::move(p5)); -// -// const size_t ACTUAL_SIZE = data1.size(); -// -// CHECK(!bool(p1)); -// CHECK(!bool(p2)); -// CHECK(!bool(p3)); -// CHECK(!bool(p4)); -// CHECK(!bool(p5)); -// -// CHECK_EQUAL(3U, *(*(data1.begin() + 0))); -// CHECK_EQUAL(4U, *(*(data1.begin() + 1))); -// CHECK_EQUAL(1U, *(*(data1.begin() + 2))); -// CHECK_EQUAL(2U, *(*(data1.begin() + 3))); -// CHECK_EQUAL(5U, *(*(data1.begin() + 4))); -// -// // Move constructor. -// Data data2(std::move(data1)); -// -// CHECK_EQUAL(3U, *(*(data2.begin() + 0))); -// CHECK_EQUAL(4U, *(*(data2.begin() + 1))); -// CHECK_EQUAL(1U, *(*(data2.begin() + 2))); -// CHECK_EQUAL(2U, *(*(data2.begin() + 3))); -// CHECK_EQUAL(5U, *(*(data2.begin() + 4))); -// -// CHECK_EQUAL(ACTUAL_SIZE, data2.size()); -// -// // Move assignment. -// Data data3; -// data3 = std::move(data2); -// -// CHECK_EQUAL(3U, *(*(data3.begin() + 0))); -// CHECK_EQUAL(4U, *(*(data3.begin() + 1))); -// CHECK_EQUAL(1U, *(*(data3.begin() + 2))); -// CHECK_EQUAL(2U, *(*(data3.begin() + 3))); -// CHECK_EQUAL(5U, *(*(data3.begin() + 4))); -// -// CHECK_EQUAL(ACTUAL_SIZE, data3.size()); -// } -// -// //************************************************************************* -// TEST(test_two_parameter_constructor_same_type_not_iterator) -// { -// // No compilation error. -// etl::deque v(5, 5); -// } -// -// //************************************************************************* -// TEST(test_sort) -// { -// std::array initial = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; -// std::array result = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; -// -// etl::deque data(initial.begin(), initial.end()); -// std::sort(data.begin(), data.end()); -// -// bool is_equal = std::equal(data.begin(), -// data.end(), -// result.begin()); -// -// CHECK(is_equal); -// } -// -// //************************************************************************* -//#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED) -// TEST(test_deque_template_deduction) -// { -// etl::deque data{ char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9 }; -// -// using Type = std::remove_reference_t; -// CHECK((std::is_same_v)); -// -// CHECK_EQUAL(0, data[0]); -// CHECK_EQUAL(1, data[1]); -// CHECK_EQUAL(2, data[2]); -// CHECK_EQUAL(3, data[3]); -// CHECK_EQUAL(4, data[4]); -// CHECK_EQUAL(5, data[5]); -// CHECK_EQUAL(6, data[6]); -// CHECK_EQUAL(7, data[7]); -// CHECK_EQUAL(8, data[8]); -// CHECK_EQUAL(9, data[9]); -// } -//#endif -// -// //************************************************************************* -//#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST -// TEST(test_make_deque) -// { -// auto data = etl::make_deque(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); -// -// CHECK_EQUAL(0, data[0]); -// CHECK_EQUAL(1, data[1]); -// CHECK_EQUAL(2, data[2]); -// CHECK_EQUAL(3, data[3]); -// CHECK_EQUAL(4, data[4]); -// CHECK_EQUAL(5, data[5]); -// CHECK_EQUAL(6, data[6]); -// CHECK_EQUAL(7, data[7]); -// CHECK_EQUAL(8, data[8]); -// CHECK_EQUAL(9, data[9]); -// } -//#endif -// -// //************************************************************************* -// TEST(test_fill) -// { -// DataNDC data(initial_data.begin(), initial_data.end()); -// -// data.fill(N999); -// -// CHECK(std::equal(blank_data.begin(), blank_data.end(), data.begin())); -// } }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index fc35e756..272ebe10 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -330,7 +330,7 @@ namespace { DataDC data; - CHECK(data.size()== size_t(0UL)); + CHECK(data.size()== 0UL); CHECK(data.empty()); CHECK(data.capacity()== SIZE); CHECK(data.max_size()== SIZE); @@ -1182,13 +1182,13 @@ namespace DataNDC data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(compare_data.begin(), compare_data.end()); CHECK(data.size() == compare_data.size()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* @@ -1196,13 +1196,13 @@ namespace { DataInt data(int_data.begin(), int_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(int_data.begin(), int_data.end()); CHECK(data.size() == int_data.size()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index 9be71afb..50999b56 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -290,7 +290,7 @@ namespace { DataDC data; - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); CHECK(data.empty()); CHECK(data.capacity() == SIZE); CHECK(data.max_size() == SIZE); @@ -917,13 +917,13 @@ namespace DataNDC data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(compare_data.begin(), compare_data.end()); CHECK(data.size() == compare_data.size()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* @@ -932,13 +932,13 @@ namespace DataInt data(int_data.begin(), int_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(int_data.begin(), int_data.end()); CHECK(data.size() == int_data.size()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index 03e284af..057a0ab3 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -284,7 +284,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -917,13 +917,13 @@ namespace DataNDC data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(compare_data.begin(), compare_data.end()); CHECK_EQUAL(data.size(), compare_data.size()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* @@ -932,13 +932,13 @@ namespace DataInt data(int_data.begin(), int_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(int_data.begin(), int_data.end()); CHECK_EQUAL(data.size(), int_data.size()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index 88608669..2bb14cea 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -187,7 +187,7 @@ namespace //bool operator == (const D4& lhs, const D4& rhs) //{ - // return (lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c) && (lhs.d == rhs.d); + // return (lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c) && (lhs.d == rhs.d); //} //bool operator != (const D1& lhs, const D1& rhs) @@ -297,7 +297,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -907,13 +907,13 @@ namespace DataNDC data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(compare_data.begin(), compare_data.end()); CHECK_EQUAL(data.size(), compare_data.size()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* @@ -921,13 +921,13 @@ namespace { DataInt data(int_data.begin(), int_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); // Do it again to check that clear() didn't screw up the internals. data.assign(int_data.begin(), int_data.end()); CHECK_EQUAL(data.size(), int_data.size()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index 56be536d..3c23aa0b 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -425,7 +425,7 @@ namespace data.assign(sorted_data.begin(), sorted_data.end()); CHECK_EQUAL(SIZE, data.size()); data.clear(); - CHECK_EQUAL(size_t(0UL), data.size()); + CHECK_EQUAL(0UL, data.size()); } //************************************************************************* @@ -440,7 +440,7 @@ namespace data.resize(SIZE); CHECK_EQUAL(SIZE, data.size()); data.clear(); - CHECK_EQUAL(size_t(0UL), data.size()); + CHECK_EQUAL(0UL, data.size()); } //************************************************************************* diff --git a/test/test_forward_list_shared_pool.cpp b/test/test_forward_list_shared_pool.cpp index 5ac72e0e..82830124 100644 --- a/test/test_forward_list_shared_pool.cpp +++ b/test/test_forward_list_shared_pool.cpp @@ -96,7 +96,7 @@ namespace PoolDC pool; DataDC data(pool); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK(!data.full()); CHECK_EQUAL(data.available(), SIZE); @@ -496,9 +496,9 @@ namespace data2.assign(sorted_data.begin(), sorted_data.end()); CHECK_EQUAL(sorted_data.size(), data2.size()); data1.clear(); - CHECK_EQUAL(size_t(0UL), data1.size()); + CHECK_EQUAL(0UL, data1.size()); data2.clear(); - CHECK_EQUAL(size_t(0UL), data2.size()); + CHECK_EQUAL(0UL, data2.size()); } //************************************************************************* @@ -520,12 +520,12 @@ namespace data1.resize(SIZE); CHECK_EQUAL(SIZE, data1.size()); data1.clear(); - CHECK_EQUAL(size_t(0UL), data1.size()); + CHECK_EQUAL(0UL, data1.size()); data2.resize(SIZE); CHECK_EQUAL(SIZE, data2.size()); data2.clear(); - CHECK_EQUAL(size_t(0UL), data2.size()); + CHECK_EQUAL(0UL, data2.size()); } //************************************************************************* diff --git a/test/test_hash.cpp b/test/test_hash.cpp index 037422e1..c8eecc49 100644 --- a/test/test_hash.cpp +++ b/test/test_hash.cpp @@ -49,8 +49,6 @@ namespace etl namespace { - - SUITE(test_hash) { //************************************************************************* @@ -66,7 +64,7 @@ namespace //************************************************************************* TEST(test_hash_char) { - size_t hash = etl::hash()((char)(0x5A)); + size_t hash = etl::hash()(0x5A); CHECK_EQUAL(0x5AU, hash); } @@ -74,7 +72,7 @@ namespace //************************************************************************* TEST(test_hash_signed_char) { - size_t hash = etl::hash()((signed char)(0x5A)); + size_t hash = etl::hash()(0x5A); CHECK_EQUAL(0x5AU, hash); } @@ -82,7 +80,7 @@ namespace //************************************************************************* TEST(test_hash_unsigned_char) { - size_t hash = etl::hash()((unsigned char)(0x5AU)); + size_t hash = etl::hash()(0x5AU); CHECK_EQUAL(0x5AU, hash); } @@ -90,7 +88,7 @@ namespace //************************************************************************* TEST(test_hash_short) { - size_t hash = etl::hash()((short)(0x5AA5)); + size_t hash = etl::hash()(0x5AA5); CHECK_EQUAL(0x5AA5U, hash); } @@ -98,7 +96,7 @@ namespace //************************************************************************* TEST(test_hash_unsigned_short) { - size_t hash = etl::hash()((unsigned short)(0x5AA5U)); + size_t hash = etl::hash()(0x5AA5U); CHECK_EQUAL(0x5AA5U, hash); } @@ -106,7 +104,7 @@ namespace //************************************************************************* TEST(test_hash_int) { - size_t hash = etl::hash()((int)(0x5AA555AAL)); + size_t hash = etl::hash()(0x5AA555AA); CHECK_EQUAL(0x5AA555AAUL, hash); } @@ -114,7 +112,7 @@ namespace //************************************************************************* TEST(test_hash_unsigned_int) { - size_t hash = etl::hash()((unsigned int)(0x5AA555AAUL)); + size_t hash = etl::hash()(0x5AA555AAU); CHECK_EQUAL(0x5AA555AAUL, hash); } @@ -122,7 +120,7 @@ namespace //************************************************************************* TEST(test_hash_long) { - size_t hash = etl::hash()((long)(0x5AA555AAL)); + size_t hash = etl::hash()(0x5AA555AAL); CHECK_EQUAL(0x5AA555AAUL, hash); } @@ -130,7 +128,7 @@ namespace //************************************************************************* TEST(test_hash_unsigned_long) { - size_t hash = etl::hash()((unsigned long)(0x5AA555AAUL)); + size_t hash = etl::hash()(0x5AA555AAUL); CHECK_EQUAL(0x5AA555AAUL, hash); } @@ -138,7 +136,7 @@ namespace //************************************************************************* TEST(test_hash_long_long) { - size_t hash = etl::hash()((long long)(0x5AA555AA3CC333CCULL)); + size_t hash = etl::hash()(0x5AA555AA3CC333CCLL); if (ETL_PLATFORM_32BIT) { @@ -154,7 +152,7 @@ namespace //************************************************************************* TEST(test_hash_unsigned_long_long) { - size_t hash = etl::hash()((unsigned long long)(0x5AA555AA3CC333CCULL)); + size_t hash = etl::hash()(0x5AA555AA3CC333CCULL); if (ETL_PLATFORM_32BIT) { @@ -186,7 +184,7 @@ namespace //************************************************************************* TEST(test_hash_double) { - size_t hash = etl::hash()((double)(1.2345)); + size_t hash = etl::hash()(1.2345); if (ETL_PLATFORM_32BIT) { diff --git a/test/test_indirect_vector.cpp b/test/test_indirect_vector.cpp index f4af48d8..8cfff65b 100644 --- a/test/test_indirect_vector.cpp +++ b/test/test_indirect_vector.cpp @@ -1222,7 +1222,7 @@ namespace DataNDC data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_indirect_vector_external_buffer.cpp b/test/test_indirect_vector_external_buffer.cpp index 1172434b..138029a8 100644 --- a/test/test_indirect_vector_external_buffer.cpp +++ b/test/test_indirect_vector_external_buffer.cpp @@ -149,7 +149,7 @@ namespace DataDC data(lookup, pool); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -223,7 +223,7 @@ namespace const NDC INITIAL_VALUE("1"); std::vector compare_data(INITIAL_SIZE, INITIAL_VALUE); - DataNDC data(size_t(5UL), NDC("1"), lookup, pool); + DataNDC data(5UL, NDC("1"), lookup, pool); CHECK(data.size() == INITIAL_SIZE); CHECK(!data.empty()); @@ -1256,7 +1256,7 @@ namespace DataNDC data(compare_data.begin(), compare_data.end(), lookup, pool); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_list.cpp b/test/test_list.cpp index ac01fb42..baed08a0 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -99,7 +99,7 @@ namespace { DataNDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.max_size(), SIZE); CHECK(data.begin() == data.end()); @@ -404,7 +404,7 @@ namespace data.assign(sorted_data.begin(), sorted_data.end()); CHECK_EQUAL(SIZE, data.size()); data.clear(); - CHECK_EQUAL(size_t(0UL), data.size()); + CHECK_EQUAL(0UL, data.size()); } //************************************************************************* @@ -419,7 +419,7 @@ namespace data.resize(SIZE); CHECK_EQUAL(SIZE, data.size()); data.clear(); - CHECK_EQUAL(size_t(0UL), data.size()); + CHECK_EQUAL(0UL, data.size()); } //************************************************************************* diff --git a/test/test_list_shared_pool.cpp b/test/test_list_shared_pool.cpp index eb76d425..e87203d9 100644 --- a/test/test_list_shared_pool.cpp +++ b/test/test_list_shared_pool.cpp @@ -126,7 +126,7 @@ namespace Pool pool; DataNDC data(pool); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK(!data.full()); CHECK_EQUAL(data.available(), SIZE); @@ -143,12 +143,12 @@ namespace DataNDC data1(pool); DataNDC data2(pool); - CHECK_EQUAL(data1.size(), size_t(0UL)); + CHECK_EQUAL(data1.size(), 0UL); CHECK(data1.empty()); CHECK_EQUAL(data1.max_size(), SIZE); CHECK(data1.begin() == data1.end()); - CHECK_EQUAL(data2.size(), size_t(0UL)); + CHECK_EQUAL(data2.size(), 0UL); CHECK(data2.empty()); CHECK_EQUAL(data2.max_size(), SIZE); CHECK(data2.begin() == data2.end()); @@ -509,7 +509,7 @@ namespace DataInt data2(SIZE / 2UL, 2, pool); data1.clear(); - CHECK_EQUAL(size_t(0UL), data1.size()); + CHECK_EQUAL(0UL, data1.size()); CHECK_EQUAL(SIZE / 2UL, data2.size()); // Do it again to check that clear() didn't screw up the internals. @@ -517,7 +517,7 @@ namespace CHECK_EQUAL(SIZE / 2UL, data1.size()); CHECK_EQUAL(SIZE / 2UL, data2.size()); data1.clear(); - CHECK_EQUAL(size_t(0UL), data1.size()); + CHECK_EQUAL(0UL, data1.size()); CHECK_EQUAL(SIZE / 2UL, data2.size()); } diff --git a/test/test_map.cpp b/test/test_map.cpp index a105cee2..ee6f0eae 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -206,7 +206,7 @@ namespace { Data data; - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); CHECK(data.empty()); CHECK(data.capacity() == MAX_SIZE); CHECK(data.max_size() == MAX_SIZE); @@ -1058,7 +1058,7 @@ namespace Data data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* @@ -1066,9 +1066,9 @@ namespace { const Data data(initial_data.begin(), initial_data.end()); - CHECK(data.count("3") == size_t(1UL)); + CHECK(data.count("3") == 1UL); - CHECK(data.count("A") == size_t(0UL)); + CHECK(data.count("A") == 0UL); } //************************************************************************* @@ -1078,9 +1078,9 @@ namespace const EMap data(initial_data.begin(), initial_data.end()); - CHECK(data.count(Key("3")) == size_t(1UL)); + CHECK(data.count(Key("3")) == 1UL); - CHECK(data.count(Key("A")) == size_t(0UL)); + CHECK(data.count(Key("A")) == 0UL); } //************************************************************************* diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 9e91d2e4..afba0d69 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -208,7 +208,7 @@ namespace { Data data; - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); CHECK(data.empty()); CHECK(data.capacity() == MAX_SIZE); CHECK(data.max_size() == MAX_SIZE); @@ -888,7 +888,7 @@ namespace Data data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK(data.size() == size_t(0UL)); + CHECK(data.size() == 0UL); } //************************************************************************* diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index f966a696..45d98fab 100644 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -223,7 +223,7 @@ namespace { Data data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), MAX_SIZE); CHECK_EQUAL(data.max_size(), MAX_SIZE); @@ -552,16 +552,16 @@ namespace // Check that elements in multiset are the same bool isEqual = Check_Equal(data.begin(), - data.end(), - compare_data.begin()); + data.end(), + compare_data.begin()); CHECK(isEqual); data.insert(Data::const_iterator(data_result), 1); - compare_data.insert(Compare_Data::const_iterator(compare_result), 1); + compare_data.insert(compare_result, 1); isEqual = Check_Equal(data.begin(), - data.end(), - compare_data.begin()); + data.end(), + compare_data.begin()); CHECK(isEqual); } @@ -834,7 +834,7 @@ namespace Data data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* @@ -1551,7 +1551,7 @@ namespace for (int eltNum = 0; eltNum != 10; ++eltNum) { - data.insert(Data::value_type(keys[eltNum])); + data.insert(keys[eltNum]); } data.erase(2); diff --git a/test/test_numeric.cpp b/test/test_numeric.cpp index 4029c484..8cb8b238 100644 --- a/test/test_numeric.cpp +++ b/test/test_numeric.cpp @@ -60,23 +60,23 @@ namespace //************************************************************************* TEST(test_midpoint_signed_integral) { - CHECK_EQUAL(int32_t(0), (etl::midpoint(int32_t(0), int32_t(0)))); - CHECK_EQUAL(int32_t(0), (etl::midpoint(int32_t(0), int32_t(1)))); - CHECK_EQUAL(int32_t(1), (etl::midpoint(int32_t(1), int32_t(0)))); + CHECK_EQUAL(0, (etl::midpoint(0, 0))); + CHECK_EQUAL(0, (etl::midpoint(0, 1))); + CHECK_EQUAL(1, (etl::midpoint(1, 0))); CHECK_EQUAL(std::numeric_limits::max() / 2, (etl::midpoint(0, std::numeric_limits::max()))); CHECK_EQUAL((std::numeric_limits::max() / 2) + 1, (etl::midpoint(std::numeric_limits::max(), 0))); - CHECK_EQUAL(int32_t(-1), (etl::midpoint(std::numeric_limits::min(), std::numeric_limits::max()))); - CHECK_EQUAL(int32_t(0), (etl::midpoint(std::numeric_limits::max(), std::numeric_limits::min()))); + CHECK_EQUAL(-1, (etl::midpoint(std::numeric_limits::min(), std::numeric_limits::max()))); + CHECK_EQUAL(0, (etl::midpoint(std::numeric_limits::max(), std::numeric_limits::min()))); } //************************************************************************* TEST(test_midpoint_unsigned_integral) { - CHECK_EQUAL(uint32_t(0), (etl::midpoint(uint32_t(0), uint32_t(0)))); - CHECK_EQUAL(uint32_t(0), (etl::midpoint(uint32_t(0), uint32_t(1)))); - CHECK_EQUAL(uint32_t(1), (etl::midpoint(uint32_t(1), uint32_t(0)))); + CHECK_EQUAL(0, (etl::midpoint(0U, 0U))); + CHECK_EQUAL(0, (etl::midpoint(0U, 1U))); + CHECK_EQUAL(1, (etl::midpoint(1U, 0U))); CHECK_EQUAL((std::numeric_limits::max() / 2U), (etl::midpoint(std::numeric_limits::min(), std::numeric_limits::max()))); CHECK_EQUAL((std::numeric_limits::max() / 2U) + 1, (etl::midpoint(std::numeric_limits::max(), std::numeric_limits::min()))); diff --git a/test/test_observer.cpp b/test/test_observer.cpp index a0a0c8f5..39716462 100644 --- a/test/test_observer.cpp +++ b/test/test_observer.cpp @@ -460,31 +460,31 @@ namespace Observer observer5; observable.add_observer(observer1); - CHECK_EQUAL(size_t(1UL), observable.number_of_observers()); + CHECK_EQUAL(1UL, observable.number_of_observers()); observable.add_observer(observer2); - CHECK_EQUAL(size_t(2UL), observable.number_of_observers()); + CHECK_EQUAL(2UL, observable.number_of_observers()); observable.add_observer(observer3); - CHECK_EQUAL(size_t(3UL), observable.number_of_observers()); + CHECK_EQUAL(3UL, observable.number_of_observers()); observable.add_observer(observer2); - CHECK_EQUAL(size_t(3UL), observable.number_of_observers()); + CHECK_EQUAL(3UL, observable.number_of_observers()); observable.add_observer(observer4); - CHECK_EQUAL(size_t(4UL), observable.number_of_observers()); + CHECK_EQUAL(4UL, observable.number_of_observers()); CHECK_THROW(observable.add_observer(observer5), etl::observer_list_full); CHECK(observable.remove_observer(observer3)); - CHECK_EQUAL(size_t(3UL), observable.number_of_observers()); + CHECK_EQUAL(3UL, observable.number_of_observers()); // Try again. CHECK(!observable.remove_observer(observer3)); - CHECK_EQUAL(size_t(3UL), observable.number_of_observers()); + CHECK_EQUAL(3UL, observable.number_of_observers()); observable.clear_observers(); - CHECK_EQUAL(size_t(0UL), observable.number_of_observers()); + CHECK_EQUAL(0UL, observable.number_of_observers()); } } } diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 71f15915..8f07862b 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -132,7 +132,7 @@ namespace result.emplace(); CHECK_TRUE(result.has_value()); - CHECK_EQUAL(int(0), int(result.value())); + CHECK_EQUAL(0, int(result.value())); } //************************************************************************* diff --git a/test/test_priority_queue.cpp b/test/test_priority_queue.cpp index f2e079bb..c1f2d072 100644 --- a/test/test_priority_queue.cpp +++ b/test/test_priority_queue.cpp @@ -89,7 +89,7 @@ namespace { etl::priority_queue priority_queue; - CHECK_EQUAL(priority_queue.size(), size_t(0UL)); + CHECK_EQUAL(priority_queue.size(), 0UL); CHECK_EQUAL(priority_queue.available(), SIZE); CHECK_EQUAL(priority_queue.max_size(), SIZE); } diff --git a/test/test_reference_flat_map.cpp b/test/test_reference_flat_map.cpp index e7b98861..f16bf664 100644 --- a/test/test_reference_flat_map.cpp +++ b/test/test_reference_flat_map.cpp @@ -198,7 +198,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -680,7 +680,7 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_reference_flat_multimap.cpp b/test/test_reference_flat_multimap.cpp index 446f1c6a..2c68e161 100644 --- a/test/test_reference_flat_multimap.cpp +++ b/test/test_reference_flat_multimap.cpp @@ -157,7 +157,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -516,7 +516,7 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_reference_flat_multiset.cpp b/test/test_reference_flat_multiset.cpp index 9520a7c0..52f55c94 100644 --- a/test/test_reference_flat_multiset.cpp +++ b/test/test_reference_flat_multiset.cpp @@ -142,7 +142,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -494,7 +494,7 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_reference_flat_set.cpp b/test/test_reference_flat_set.cpp index a4858297..1df4bb59 100644 --- a/test/test_reference_flat_set.cpp +++ b/test/test_reference_flat_set.cpp @@ -170,7 +170,7 @@ namespace { DataDC data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -518,7 +518,7 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* diff --git a/test/test_set.cpp b/test/test_set.cpp index aa25fc2a..4dcd6725 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -179,7 +179,7 @@ namespace { Data data; - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(MAX_SIZE, data.available()); CHECK_EQUAL(MAX_SIZE, data.capacity()); @@ -512,8 +512,8 @@ namespace compare_data.begin()); CHECK(isEqual); - data.insert(Data::const_iterator(data_result.first), 1); - compare_data.insert(Compare_Data::const_iterator(compare_result.first), 1); + data.insert(data_result.first, 1); + compare_data.insert(compare_result.first, 1); isEqual = Check_Equal(data.begin(), data.end(), @@ -816,7 +816,7 @@ namespace Data data(compare_data.begin(), compare_data.end()); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* @@ -824,9 +824,9 @@ namespace { const Data data(initial_data.begin(), initial_data.end()); - CHECK_EQUAL(data.count(3), size_t(1UL)); + CHECK_EQUAL(data.count(3), 1UL); - CHECK_EQUAL(data.count(11), size_t(0UL)); + CHECK_EQUAL(data.count(11), 0UL); } //************************************************************************* @@ -835,9 +835,9 @@ namespace using EMap = etl::set>; const EMap data(initial_data.begin(), initial_data.end()); - CHECK_EQUAL(data.count(Key(3)), size_t(1UL)); + CHECK_EQUAL(data.count(Key(3)), 1UL); - CHECK_EQUAL(data.count(Key(11)), size_t(0UL)); + CHECK_EQUAL(data.count(Key(11)), 0UL); } //************************************************************************* diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index b1ba376c..7d529521 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -64,7 +64,7 @@ namespace SUITE(test_string_char16_t) { - static const size_t SIZE = 11; + static const size_t SIZE = 11; using Text = etl::u16string; using IText = etl::iu16string; @@ -2156,9 +2156,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2170,9 +2170,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2184,9 +2184,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2198,9 +2198,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2212,9 +2212,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2226,9 +2226,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2240,9 +2240,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2254,9 +2254,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2272,9 +2272,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2286,9 +2286,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2300,9 +2300,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2314,9 +2314,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2332,9 +2332,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2346,9 +2346,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2360,9 +2360,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2374,9 +2374,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2388,9 +2388,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2402,9 +2402,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2416,9 +2416,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2430,9 +2430,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2448,9 +2448,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2464,7 +2464,7 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); @@ -2480,9 +2480,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2496,9 +2496,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_u16_external_buffer.cpp b/test/test_string_u16_external_buffer.cpp index 21176e78..8e271ad6 100644 --- a/test/test_string_u16_external_buffer.cpp +++ b/test/test_string_u16_external_buffer.cpp @@ -62,7 +62,7 @@ namespace // return os; //} - + SUITE(test_string_char16_t_external_buffer) { static constexpr size_t SIZE = 11; @@ -2423,9 +2423,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2437,9 +2437,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2451,9 +2451,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2465,9 +2465,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2479,9 +2479,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2493,9 +2493,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2507,9 +2507,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2521,9 +2521,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2541,9 +2541,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2555,9 +2555,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2569,9 +2569,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2583,9 +2583,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2603,9 +2603,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2617,9 +2617,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2631,9 +2631,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2645,9 +2645,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2659,9 +2659,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2673,9 +2673,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2687,9 +2687,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2701,9 +2701,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2721,9 +2721,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2737,9 +2737,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2753,9 +2753,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2769,9 +2769,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 3465d530..fa1c199c 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -2156,9 +2156,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2170,9 +2170,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2184,9 +2184,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2198,9 +2198,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2212,9 +2212,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2226,9 +2226,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2240,9 +2240,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2254,9 +2254,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2272,9 +2272,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2286,9 +2286,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2300,9 +2300,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2314,9 +2314,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2332,9 +2332,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2346,9 +2346,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2360,9 +2360,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2374,9 +2374,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2388,9 +2388,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2402,9 +2402,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2416,9 +2416,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2430,9 +2430,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2448,9 +2448,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2464,9 +2464,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2480,9 +2480,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2496,9 +2496,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_u32_external_buffer.cpp b/test/test_string_u32_external_buffer.cpp index 05aafd49..96650015 100644 --- a/test/test_string_u32_external_buffer.cpp +++ b/test/test_string_u32_external_buffer.cpp @@ -2411,9 +2411,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2425,9 +2425,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2439,9 +2439,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2453,9 +2453,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2467,9 +2467,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2481,9 +2481,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2495,9 +2495,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2509,9 +2509,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2529,9 +2529,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2543,9 +2543,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2557,9 +2557,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2571,9 +2571,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2591,9 +2591,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2605,9 +2605,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2619,9 +2619,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2633,9 +2633,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2647,9 +2647,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2661,9 +2661,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2675,9 +2675,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2689,9 +2689,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2709,9 +2709,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2725,9 +2725,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2741,9 +2741,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2757,9 +2757,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_u8.cpp b/test/test_string_u8.cpp index 0e890387..2165231f 100644 --- a/test/test_string_u8.cpp +++ b/test/test_string_u8.cpp @@ -71,19 +71,19 @@ namespace using Text = etl::u8string; using IText = etl::iu8string; - using Compare_Text = std::u8string; + using CompareText = std::u8string; using value_t = Text::value_type; using TextL = etl::u8string<52>; using TextS = etl::u8string<4>; - Compare_Text initial_text; - Compare_Text less_text; - Compare_Text greater_text; - Compare_Text shorter_text; - Compare_Text different_text; - Compare_Text insert_text; - Compare_Text longer_text; - Compare_Text short_text; + CompareText initial_text; + CompareText less_text; + CompareText greater_text; + CompareText shorter_text; + CompareText different_text; + CompareText insert_text; + CompareText longer_text; + CompareText short_text; const value_t* pinitial_text = STR("Hello World"); @@ -146,7 +146,7 @@ namespace const size_t INITIAL_SIZE = 5; const value_t INITIAL_VALUE = STR('A'); - Compare_Text compare_text(INITIAL_SIZE, INITIAL_VALUE); + CompareText compare_text(INITIAL_SIZE, INITIAL_VALUE); Text text(INITIAL_SIZE, INITIAL_VALUE); CHECK(text.size() == INITIAL_SIZE); @@ -174,7 +174,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); @@ -190,7 +190,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_excess) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(longer_text.c_str()); @@ -206,7 +206,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_size) { - Compare_Text compare_text(SIZE, STR('A')); + CompareText compare_text(SIZE, STR('A')); Text text(SIZE, STR('A')); @@ -222,7 +222,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_size_excess) { - Compare_Text compare_text(SIZE, STR('A')); + CompareText compare_text(SIZE, STR('A')); Text text(SIZE + 1, STR('A')); @@ -238,7 +238,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_char) { - Compare_Text compare_text(initial_text.c_str(), initial_text.size() / 2); + CompareText compare_text(initial_text.c_str(), initial_text.size() / 2); Text text(initial_text.c_str(), initial_text.size() / 2); @@ -254,7 +254,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_char_excess) { - Compare_Text compare_text(initial_text.c_str(), initial_text.size()); + CompareText compare_text(initial_text.c_str(), initial_text.size()); Text text(longer_text.c_str(), longer_text.size()); @@ -270,7 +270,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_range) { - Compare_Text compare_text(initial_text.begin(), initial_text.end()); + CompareText compare_text(initial_text.begin(), initial_text.end()); Text text(compare_text.begin(), compare_text.end()); @@ -366,8 +366,8 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_position_length) { - Compare_Text compare_text(initial_text.c_str()); - Compare_Text compare_text2(compare_text, 2, 4); + CompareText compare_text(initial_text.c_str()); + CompareText compare_text2(compare_text, 2, 4); Text text(initial_text.c_str()); Text text2(text, 2, 4); @@ -382,8 +382,8 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_position_length_excess) { - Compare_Text compare_text(longer_text.c_str()); - Compare_Text compare_text2(compare_text, 2, 11); + CompareText compare_text(longer_text.c_str()); + CompareText compare_text2(compare_text, 2, 11); TextL textl(longer_text.c_str()); Text text2(textl, 2, 12); @@ -399,7 +399,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { - Compare_Text compare_text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; + CompareText compare_text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; Text text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; bool is_equal = Equal(compare_text, text); @@ -412,7 +412,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list_excess) { - Compare_Text compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), + CompareText compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), STR('W'), STR('o'), STR('r'), STR('l'), STR('d') }; Text text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), STR('W'), STR('o'), STR('r'), STR('l'), STR('d'), STR(' '), @@ -860,7 +860,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_index) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); for (size_t i = 0UL; i < text.size(); ++i) @@ -876,7 +876,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_index_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); const Text text(initial_text.c_str()); for (size_t i = 0UL; i < text.size(); ++i) @@ -892,7 +892,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_at) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); for (size_t i = 0UL; i < text.size(); ++i) @@ -910,7 +910,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_at_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); const Text text(initial_text.c_str()); for (size_t i = 0UL; i < text.size(); ++i) @@ -928,7 +928,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_front) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); @@ -940,7 +940,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_front_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); @@ -952,7 +952,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_back) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); @@ -964,7 +964,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_back_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); @@ -976,7 +976,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_data) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(compare_text.begin(), compare_text.end()); @@ -993,7 +993,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_data_const) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); const Text text(compare_text.begin(), compare_text.end()); @@ -1010,10 +1010,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_string) { - Compare_Text compare_input(initial_text.c_str()); + CompareText compare_input(initial_text.c_str()); Text input(initial_text.c_str()); - Compare_Text compare_text; + CompareText compare_text; Text text; compare_text.assign(compare_input); @@ -1029,10 +1029,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_string_excess) { - Compare_Text compare_input(initial_text.c_str()); + CompareText compare_input(initial_text.c_str()); TextL input(longer_text.c_str()); - Compare_Text compare_text; + CompareText compare_text; Text text; compare_text.assign(compare_input); @@ -1048,7 +1048,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text; text.assign(initial_text.c_str()); @@ -1063,7 +1063,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_excess) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text; text.assign(longer_text.c_str()); @@ -1078,7 +1078,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_length) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text; text.assign(initial_text.c_str(), initial_text.size()); @@ -1093,7 +1093,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_length_excess) { - Compare_Text compare_text(longer_text.c_str()); + CompareText compare_text(longer_text.c_str()); Text text; text.assign(longer_text.c_str(), longer_text.size()); @@ -1110,7 +1110,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_range) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text; @@ -1182,7 +1182,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back) { - Compare_Text compare_text; + CompareText compare_text; Text text; for (size_t i = 0UL; i < SIZE; ++i) @@ -1208,7 +1208,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back_excess) { - Compare_Text compare_text; + CompareText compare_text; Text text; for (size_t i = 0UL; i < SIZE; ++i) @@ -1239,7 +1239,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_pop_back) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); compare_text.pop_back(); @@ -1263,7 +1263,7 @@ namespace for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) { - Compare_Text compare_text; + CompareText compare_text; Text text; text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); @@ -1283,7 +1283,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { - Compare_Text compare_text(initial_text.begin(), initial_text.end()); + CompareText compare_text(initial_text.begin(), initial_text.end()); Text text(initial_text.begin(), initial_text.end()); const value_t INITIAL_VALUE = STR('A'); @@ -1328,7 +1328,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value) { - Compare_Text compare_text; + CompareText compare_text; Text text; const size_t INITIAL_SIZE = 5; @@ -1354,7 +1354,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value_excess) { - Compare_Text compare_text; + CompareText compare_text; Text text; const size_t INSERT_SIZE = 4; @@ -1427,7 +1427,7 @@ namespace for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) { - Compare_Text compare_text; + CompareText compare_text; Text text; text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); @@ -1450,7 +1450,7 @@ namespace const size_t INITIAL_SIZE = 5; const value_t INITIAL_VALUE = STR('A'); - Compare_Text compare_text; + CompareText compare_text; Text text; size_t offset = 0; @@ -1508,7 +1508,7 @@ namespace for (size_t offset = 10; offset < length; ++offset) { - Compare_Text compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + CompareText compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextL text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); text.insert(text.begin() + offset, text.begin() + 5, text.begin() + 10); @@ -1527,7 +1527,7 @@ namespace { for (size_t offset = 0; offset <= short_text.size(); ++offset) { - Compare_Text compare_text(short_text.begin(), short_text.end()); + CompareText compare_text(short_text.begin(), short_text.end()); Text text(short_text.begin(), short_text.end()); Text insert(insert_text.begin(), insert_text.end()); @@ -1548,7 +1548,7 @@ namespace { for (size_t offset = 0; offset <= initial_text.size(); ++offset) { - Compare_Text compare_text(initial_text.begin(), initial_text.end()); + CompareText compare_text(initial_text.begin(), initial_text.end()); Text text(initial_text.begin(), initial_text.end()); Text insert(insert_text.begin(), insert_text.end()); @@ -1569,7 +1569,7 @@ namespace { for (size_t offset = 0; offset <= short_text.size(); ++offset) { - Compare_Text compare_text(short_text.begin(), short_text.end()); + CompareText compare_text(short_text.begin(), short_text.end()); Text text(short_text.begin(), short_text.end()); Text insert(longer_text.begin(), longer_text.end()); insert.erase(insert.begin(), insert.end()); @@ -1590,7 +1590,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - Compare_Text compare_text(short_text.begin(), short_text.end()); + CompareText compare_text(short_text.begin(), short_text.end()); Text text(short_text.begin(), short_text.end()); Text insert(insert_text.begin(), insert_text.end()); @@ -1636,7 +1636,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); Text append(insert_text.c_str()); @@ -1686,7 +1686,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string_to_self) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); // Non-overflow. @@ -1717,7 +1717,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string_subpos_sublen) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); Text append(insert_text.c_str()); @@ -1781,7 +1781,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_c_string) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); // Whole string. @@ -1813,7 +1813,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_n_c) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); // Non-overflow. @@ -1845,7 +1845,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_range) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); Text append(insert_text.c_str()); @@ -1878,12 +1878,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_string) { // Non-overflow short text, npos. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace"))); + text.replace(2, Text::npos, TextL(STR("Replace"))); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1895,9 +1895,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace"))); + compare_text.replace(2, 2, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, Text(STR("Replace"))); + text.replace(2, 2, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1909,9 +1909,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, 2, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, Text(STR("Replace with some text"))); + text.replace(2, 2, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1923,9 +1923,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text"))); + text.replace(2, Text::npos, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1937,9 +1937,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace"))); + compare_text.replace(2, 7, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, Text(STR("Replace"))); + text.replace(2, 7, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1951,9 +1951,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, 2, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, Text(STR("Replace with some text"))); + text.replace(2, 2, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1965,9 +1965,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text"))); + text.replace(2, Text::npos, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1980,12 +1980,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_string) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace"))); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1997,9 +1997,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2011,9 +2011,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, Text(STR("Replace"))); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2025,9 +2025,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2040,12 +2040,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_string_subposition_sublength) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")), 1, 5); + compare_text.replace(2, 4, CompareText(STR("Replace")), 1, 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace")), 1, 5); + text.replace(2, 4, TextL(STR("Replace")), 1, 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2057,9 +2057,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2071,9 +2071,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")), 1, 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")), 1, 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")), 1, 15); + text.replace(2, 4, TextL(STR("Replace with some text")), 1, 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2085,9 +2085,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace with some text")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2099,9 +2099,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")), 1, 5); + compare_text.replace(2, 7, CompareText(STR("Replace")), 1, 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, Text(STR("Replace")), 1, 5); + text.replace(2, 7, TextL(STR("Replace")), 1, 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2113,9 +2113,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2127,9 +2127,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")), 1, 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")), 1, 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")), 1, 15); + text.replace(2, 4, TextL(STR("Replace with some text")), 1, 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2141,9 +2141,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace with some text")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2156,12 +2156,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_pointer) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace")).c_str()); + text.replace(2, 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2173,9 +2173,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2187,9 +2187,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")).c_str()); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2201,9 +2201,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2215,9 +2215,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, Text(STR("Replace")).c_str()); + text.replace(2, 7, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2229,9 +2229,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2243,9 +2243,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")).c_str()); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2257,9 +2257,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2272,12 +2272,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_pointer) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2289,9 +2289,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2303,9 +2303,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, Text(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2317,9 +2317,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2332,12 +2332,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_pointer_n) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace")).c_str(), 5); + text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2349,9 +2349,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2363,9 +2363,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2377,9 +2377,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2391,9 +2391,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, Text(STR("Replace")).c_str(), 5); + text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2405,9 +2405,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2419,9 +2419,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, Text(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2433,9 +2433,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, Text(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2448,12 +2448,12 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_pointer_n) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2467,9 +2467,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2483,9 +2483,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, Text(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2499,9 +2499,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, Text(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2516,7 +2516,7 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_n_c) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); compare_text.replace(2, 4, 7, STR('A')); @@ -2533,7 +2533,7 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 7, STR('A')); + compare_text.replace(2, CompareText::npos, 7, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 7, STR('A')); @@ -2561,7 +2561,7 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 15, STR('A')); + compare_text.replace(2, CompareText::npos, 15, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 15, STR('A')); @@ -2589,7 +2589,7 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 7, STR('A')); + compare_text.replace(2, CompareText::npos, 7, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 7, STR('A')); @@ -2617,7 +2617,7 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 15, STR('A')); + compare_text.replace(2, CompareText::npos, 15, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 15, STR('A')); @@ -2632,7 +2632,7 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_n_c) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, 7, STR('A')); @@ -2692,11 +2692,11 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_first_last) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - Compare_Text replace(STR("Replace")); - Compare_Text replace_long(STR("Replace with some text")); + CompareText replace(STR("Replace")); + CompareText replace_long(STR("Replace with some text")); compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, replace.begin() + 1, replace.begin() + 5); compare_text.resize(std::min(compare_text.size(), SIZE)); @@ -2754,10 +2754,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_single_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); - Compare_Text::iterator citr = compare_text.erase(compare_text.begin() + 2); + CompareText::iterator citr = compare_text.erase(compare_text.begin() + 2); Text::iterator ditr = text.erase(text.begin() + 2); CHECK(*citr == *ditr); @@ -2771,10 +2771,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_single_const_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); - Compare_Text::iterator citr = compare_text.erase(compare_text.cbegin() + 2); + CompareText::iterator citr = compare_text.erase(compare_text.cbegin() + 2); Text::iterator ditr = text.erase(text.cbegin() + 2); CHECK(*citr == *ditr); @@ -2788,10 +2788,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_range) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); - Compare_Text::iterator citr = compare_text.erase(compare_text.cbegin() + 2, compare_text.cbegin() + 4); + CompareText::iterator citr = compare_text.erase(compare_text.cbegin() + 2, compare_text.cbegin() + 4); Text::iterator ditr = text.erase(text.cbegin() + 2, text.cbegin() + 4); CHECK(*citr == *ditr); @@ -2817,7 +2817,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); @@ -2830,7 +2830,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_const_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); @@ -2843,7 +2843,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_reverse_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); @@ -2856,7 +2856,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_const_reverse_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); @@ -3043,7 +3043,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); value_t buffer1[SIZE]; @@ -3084,13 +3084,13 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy_count_equals_npos) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); value_t buffer1[SIZE]; value_t buffer2[SIZE]; - size_t length1 = compare_text.copy(buffer1, Compare_Text::npos, 2); + size_t length1 = compare_text.copy(buffer1, CompareText::npos, 2); buffer1[length1] = STR('\0'); size_t length2 = text.copy(buffer2, Text::npos, 2); @@ -3110,7 +3110,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy_count_too_large) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); value_t buffer1[SIZE]; @@ -3325,10 +3325,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_substr) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str()); - Compare_Text compare_result; + CompareText compare_result; Text result; // Equal. @@ -3363,34 +3363,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_string) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); int compare_result; int result; // Equal. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEF"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEF"))); result = text.compare(Text(STR("ABCDEF"))); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEE"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEE"))); result = text.compare(Text(STR("ABCDEE"))); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEG"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEG"))); result = text.compare(Text(STR("ABCDEG"))); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(Compare_Text(STR("ABCDE"))); + compare_result = compare_text.compare(CompareText(STR("ABCDE"))); result = text.compare(Text(STR("ABCDE"))); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEFG"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEFG"))); result = text.compare(Text(STR("ABCDEFG"))); CHECK(compares_agree(compare_result, result)); } @@ -3398,34 +3398,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_string) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); Text text(STR("xxxABCDEFyyy")); int compare_result; int result; // Equal. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEF"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEF"))); result = text.compare(3, 6, Text(STR("ABCDEF"))); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEE"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEE"))); result = text.compare(3, 6, Text(STR("ABCDEE"))); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEG"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEG"))); result = text.compare(3, 6, Text(STR("ABCDEG"))); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDE"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDE"))); result = text.compare(3, 6, Text(STR("ABCDE"))); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEFG"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEFG"))); result = text.compare(3, 6, Text(STR("ABCDEFG"))); CHECK(compares_agree(compare_result, result)); } @@ -3433,34 +3433,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_string_subposition_sublength) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); Text text(STR("xxxABCDEFyyy")); int compare_result; int result; // Equal. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEFbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEFbb")), 2, 6); result = text.compare(3, 6, Text(STR("aaABCDEFbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEEbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEEbb")), 2, 6); result = text.compare(3, 6, Text(STR("aaABCDEEbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEGbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEGbb")), 2, 6); result = text.compare(3, 6, Text(STR("aaABCDEGbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEbb")), 2, 5); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEbb")), 2, 5); result = text.compare(3, 6, Text(STR("aaABCDEbb")), 2, 5); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEFGbb")), 2, 7); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEFGbb")), 2, 7); result = text.compare(3, 6, Text(STR("aaABCDEFGbb")), 2, 7); CHECK(compares_agree(compare_result, result)); } @@ -3468,7 +3468,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_c_string) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); int compare_result; @@ -3503,7 +3503,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_c_string) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); Text text(STR("xxxABCDEFyyy")); int compare_result; @@ -3538,7 +3538,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_c_string_n) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); Text text(STR("xxxABCDEFyyy")); int compare_result; @@ -3573,26 +3573,26 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_string_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); - size_t position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF"))); + size_t position1 = compare_text.find_first_of(CompareText(STR("ZCXF"))); size_t position2 = text.find_first_of(Text(STR("ZCXF"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_of(Compare_Text(STR("WXYZ"))); + position1 = compare_text.find_first_of(CompareText(STR("WXYZ"))); position2 = text.find_first_of(Text(STR("WXYZ"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF")), 3); + position1 = compare_text.find_first_of(CompareText(STR("ZCXF")), 3); position2 = text.find_first_of(Text(STR("ZCXF")), 3); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF")), 100); + position1 = compare_text.find_first_of(CompareText(STR("ZCXF")), 100); position2 = text.find_first_of(Text(STR("ZCXF")), 100); CHECK_EQUAL(position1, position2); @@ -3602,7 +3602,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_of(STR("ZCXF")); @@ -3631,7 +3631,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_of(STR("ZCXF"), 0, 4); @@ -3665,7 +3665,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_of(STR('C')); @@ -3704,31 +3704,31 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_string_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); - size_t position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE"))); + size_t position1 = compare_text.find_last_of(CompareText(STR("ZCXE"))); size_t position2 = text.find_last_of(Text(STR("ZCXE"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("WXYZ")), 3); + position1 = compare_text.find_last_of(CompareText(STR("WXYZ")), 3); position2 = text.find_last_of(Text(STR("WXYZ")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), 5); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), 5); position2 = text.find_last_of(Text(STR("ZCXE")), 5); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), compare_text.size()); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), compare_text.size()); position2 = text.find_last_of(Text(STR("ZCXE")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), 100); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), 100); position2 = text.find_last_of(Text(STR("ZCXE")), 100); CHECK_EQUAL(position1, position2); @@ -3738,7 +3738,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); size_t position1 = compare_text.find_last_of(STR("ZCXE")); @@ -3777,7 +3777,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); size_t position1 = compare_text.find_last_of(STR("AZCXE"), 0, 4); @@ -3814,7 +3814,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_last_of(STR('C')); @@ -3853,31 +3853,31 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_string_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); - size_t position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB"))); + size_t position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB"))); size_t position2 = text.find_first_not_of(Text(STR("ZAXB"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB"))); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB"))); position2 = text.find_first_not_of(Text(STR("ZAXB"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), 3); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), 3); position2 = text.find_first_not_of(Text(STR("ZAXB")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), compare_text.size()); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), compare_text.size()); position2 = text.find_first_not_of(Text(STR("ZAXB")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), 100); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), 100); position2 = text.find_first_not_of(Text(STR("ZAXB")), 100); CHECK_EQUAL(position1, position2); @@ -3887,7 +3887,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_not_of(STR("ZAXB")); @@ -3921,7 +3921,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_not_of(STR("ZAXB"), 0, 4); @@ -3960,7 +3960,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_first_not_of(STR('A')); @@ -3999,31 +3999,31 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_string_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); - size_t position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD"))); + size_t position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD"))); size_t position2 = text.find_last_not_of(Text(STR("ZEXD"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 3); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 3); position2 = text.find_last_not_of(Text(STR("ZEXD")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 5); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 5); position2 = text.find_last_not_of(Text(STR("ZEXD")), 5); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), compare_text.size()); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), compare_text.size()); position2 = text.find_last_not_of(Text(STR("ZEXD")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 100); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 100); position2 = text.find_last_not_of(Text(STR("ZEXD")), 100); CHECK_EQUAL(position1, position2); @@ -4033,7 +4033,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); size_t position1 = compare_text.find_last_not_of(STR("ZEXD")); @@ -4067,7 +4067,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); Text text(STR("ABCDEFABCDE")); size_t position1 = compare_text.find_last_not_of(STR("ZEXD"), 0, 4); @@ -4099,7 +4099,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); Text text(STR("ABCDEF")); size_t position1 = compare_text.find_last_not_of(STR('F')); diff --git a/test/test_string_u8_external_buffer.cpp b/test/test_string_u8_external_buffer.cpp index aa532457..bc2caaaf 100644 --- a/test/test_string_u8_external_buffer.cpp +++ b/test/test_string_u8_external_buffer.cpp @@ -72,23 +72,23 @@ namespace static constexpr size_t SIZE_L = 52; static constexpr size_t SIZE_S = 4; - using Text = etl::u8string_ext; - using IText = etl::iu8string; - using TextT = etl::u8string; - using Compare_Text = std::u8string; - using value_t = Text::value_type; - using TextBuffer = std::array; - using TextBufferL = std::array; - using TextBufferS = std::array; + using Text = etl::u8string_ext; + using IText = etl::iu8string; + using TextL = etl::u8string; + using CompareText = std::u8string; + using value_t = Text::value_type; + using TextBuffer = std::array; + using TextBufferL = std::array; + using TextBufferS = std::array; - Compare_Text initial_text; - Compare_Text less_text; - Compare_Text greater_text; - Compare_Text shorter_text; - Compare_Text different_text; - Compare_Text insert_text; - Compare_Text longer_text; - Compare_Text short_text; + CompareText initial_text; + CompareText less_text; + CompareText greater_text; + CompareText shorter_text; + CompareText different_text; + CompareText insert_text; + CompareText longer_text; + CompareText short_text; const value_t* pinitial_text = STR("Hello World"); @@ -219,7 +219,7 @@ namespace const value_t INITIAL_VALUE = STR('A'); TextBuffer buffer{0}; - Compare_Text compare_text(INITIAL_SIZE, INITIAL_VALUE); + CompareText compare_text(INITIAL_SIZE, INITIAL_VALUE); Text text(INITIAL_SIZE, INITIAL_VALUE, buffer.data(), buffer.size()); CHECK(text.size() == INITIAL_SIZE); @@ -249,7 +249,7 @@ namespace TEST_FIXTURE(SetupFixture, test_constructor_char_pointer) { TextBuffer buffer{0}; - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -265,7 +265,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_excess) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); @@ -282,7 +282,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_size) { - Compare_Text compare_text(SIZE, STR('A')); + CompareText compare_text(SIZE, STR('A')); TextBuffer buffer{0}; Text text(SIZE, STR('A'), buffer.data(), buffer.size()); @@ -299,7 +299,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_char_pointer_size_excess) { - Compare_Text compare_text(SIZE, STR('A')); + CompareText compare_text(SIZE, STR('A')); TextBuffer buffer{0}; Text text(SIZE + 1, STR('A'), buffer.data(), buffer.size()); @@ -316,7 +316,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_char) { - Compare_Text compare_text(initial_text.c_str(), initial_text.size() / 2); + CompareText compare_text(initial_text.c_str(), initial_text.size() / 2); TextBuffer buffer{0}; Text text(initial_text.c_str(), initial_text.size() / 2, buffer.data(), buffer.size()); @@ -333,7 +333,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_char_excess) { - Compare_Text compare_text(initial_text.c_str(), initial_text.size()); + CompareText compare_text(initial_text.c_str(), initial_text.size()); TextBuffer buffer{0}; Text text(longer_text.c_str(), longer_text.size(), buffer.data(), buffer.size()); @@ -350,7 +350,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_range) { - Compare_Text compare_text(initial_text.begin(), initial_text.end()); + CompareText compare_text(initial_text.begin(), initial_text.end()); TextBuffer buffer{0}; Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); @@ -466,8 +466,8 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_position_length) { - Compare_Text compare_text(initial_text.c_str()); - Compare_Text compare_text2(compare_text, 2, 4); + CompareText compare_text(initial_text.c_str()); + CompareText compare_text2(compare_text, 2, 4); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -485,8 +485,8 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_position_length_excess) { - Compare_Text compare_text(longer_text.c_str()); - Compare_Text compare_text2(compare_text, 2, 11); + CompareText compare_text(longer_text.c_str()); + CompareText compare_text2(compare_text, 2, 11); TextBufferL bufferl{0}; Text textl(longer_text.c_str(), bufferl.data(), bufferl.size()); @@ -505,7 +505,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { - Compare_Text compare_text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; + CompareText compare_text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; std::initializer_list il = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') }; TextBuffer buffer{0}; @@ -521,7 +521,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list_excess) { - Compare_Text compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), + CompareText compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), STR('W'), STR('o'), STR('r'), STR('l'), STR('d') }; std::initializer_list il = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), @@ -1017,7 +1017,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_index) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1035,7 +1035,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_index_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; const Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1053,7 +1053,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_at) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1073,7 +1073,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_at_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; const Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1093,7 +1093,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_front) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1107,7 +1107,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_front_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; const Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1121,7 +1121,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_back) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1135,7 +1135,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_back_const) { - const Compare_Text compare_text(initial_text.c_str()); + const CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; const Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1149,7 +1149,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_data) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); @@ -1167,7 +1167,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_data_const) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); @@ -1185,12 +1185,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_string) { - Compare_Text compare_input(initial_text.c_str()); + CompareText compare_input(initial_text.c_str()); TextBuffer buffer{0}; Text input(initial_text.c_str(), buffer.data(), buffer.size()); - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer2{0}; Text text(buffer2.data(), buffer2.size()); @@ -1208,12 +1208,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_string_excess) { - Compare_Text compare_input(initial_text.c_str()); + CompareText compare_input(initial_text.c_str()); TextBufferL bufferl{0}; Text input(longer_text.c_str(), bufferl.data(), bufferl.size()); - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1231,7 +1231,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1247,7 +1247,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_excess) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1263,7 +1263,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_length) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1279,7 +1279,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_pointer_length_excess) { - Compare_Text compare_text(longer_text.c_str()); + CompareText compare_text(longer_text.c_str()); TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1297,7 +1297,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_range) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1373,7 +1373,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1401,7 +1401,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_back_excess) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1434,7 +1434,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_pop_back) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -1460,7 +1460,7 @@ namespace for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1482,7 +1482,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { - Compare_Text compare_text(initial_text.begin(), initial_text.end()); + CompareText compare_text(initial_text.begin(), initial_text.end()); TextBuffer buffer{0}; Text text(initial_text.begin(), initial_text.end(), buffer.data(), buffer.size()); @@ -1528,7 +1528,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1555,7 +1555,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value_excess) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1629,7 +1629,7 @@ namespace for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1653,7 +1653,7 @@ namespace const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); - Compare_Text compare_text; + CompareText compare_text; TextBuffer buffer{0}; Text text(buffer.data(), buffer.size()); @@ -1712,7 +1712,7 @@ namespace for (size_t offset = 10UL; offset < length; ++offset) { - Compare_Text compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + CompareText compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextBufferL bufferl{0}; Text text(bufferl.data(), bufferl.size()); text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); @@ -1738,7 +1738,7 @@ namespace for (size_t offset = s; offset <= short_text.size(); ++offset) { - Compare_Text compare_text(short_text.cbegin(), short_text.cend()); + CompareText compare_text(short_text.cbegin(), short_text.cend()); TextBuffer buffer{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Text text(short_text.begin(), short_text.end(), buffer.data(), buffer.size()); @@ -1769,7 +1769,7 @@ namespace #include "etl/private/diagnostic_array_bounds_push.h" for (size_t offset = 0UL; offset <= initial_text.size(); ++offset) { - Compare_Text compare_text(initial_text.cbegin(), initial_text.cend()); + CompareText compare_text(initial_text.cbegin(), initial_text.cend()); TextBuffer buffer{ 0 }; Text text(initial_text.begin(), initial_text.end(), buffer.data(), buffer.size()); @@ -1795,7 +1795,7 @@ namespace { for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - Compare_Text compare_text(short_text.cbegin(), short_text.cend()); + CompareText compare_text(short_text.cbegin(), short_text.cend()); TextBuffer buffer{0}; Text text(short_text.begin(), short_text.end(), buffer.data(), buffer.size()); @@ -1821,7 +1821,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - Compare_Text compare_text(short_text.cbegin(), short_text.cend()); + CompareText compare_text(short_text.cbegin(), short_text.cend()); TextBuffer buffer{0}; Text text(short_text.begin(), short_text.end(), buffer.data(), buffer.size()); @@ -1871,7 +1871,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -1928,7 +1928,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string_to_self) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -1961,7 +1961,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_string_subpos_sublen) { - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2032,7 +2032,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_c_string) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2066,7 +2066,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_n_c) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2100,7 +2100,7 @@ namespace TEST_FIXTURE(SetupFixture, test_append_range) { // Non-overflow. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2137,14 +2137,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_string) { // Non-overflow short text, npos. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace"))); + text.replace(2, Text::npos, TextL(STR("Replace"))); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2156,9 +2156,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace"))); + compare_text.replace(2, 2, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, TextT(STR("Replace"))); + text.replace(2, 2, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2170,9 +2170,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, 2, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, TextT(STR("Replace with some text"))); + text.replace(2, 2, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2184,9 +2184,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text"))); + text.replace(2, Text::npos, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2198,9 +2198,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace"))); + compare_text.replace(2, 7, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextT(STR("Replace"))); + text.replace(2, 7, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2212,9 +2212,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 2, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, 2, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 2, TextT(STR("Replace with some text"))); + text.replace(2, 2, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2226,9 +2226,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text"))); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text"))); + text.replace(2, Text::npos, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2241,14 +2241,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_string) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace"))); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2260,9 +2260,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2274,9 +2274,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextT(STR("Replace"))); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2288,9 +2288,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text"))); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text"))); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text"))); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text"))); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2303,14 +2303,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_string_subposition_sublength) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")), 1, 5); + compare_text.replace(2, 4, CompareText(STR("Replace")), 1, 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace")), 1, 5); + text.replace(2, 4, TextL(STR("Replace")), 1, 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2322,9 +2322,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2336,9 +2336,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")), 1, 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")), 1, 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")), 1, 15); + text.replace(2, 4, TextL(STR("Replace with some text")), 1, 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2350,9 +2350,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace with some text")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2364,9 +2364,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")), 1, 5); + compare_text.replace(2, 7, CompareText(STR("Replace")), 1, 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextT(STR("Replace")), 1, 5); + text.replace(2, 7, TextL(STR("Replace")), 1, 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2378,9 +2378,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2392,9 +2392,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")), 1, 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")), 1, 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")), 1, 15); + text.replace(2, 4, TextL(STR("Replace with some text")), 1, 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2406,9 +2406,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")), 1, Compare_Text::npos); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")), 1, CompareText::npos); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")), 1, Text::npos); + text.replace(2, Text::npos, TextL(STR("Replace with some text")), 1, Text::npos); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2421,14 +2421,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_pointer) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace")).c_str()); + text.replace(2, 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2440,9 +2440,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2454,9 +2454,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")).c_str()); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2468,9 +2468,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2482,9 +2482,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextT(STR("Replace")).c_str()); + text.replace(2, 7, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2496,9 +2496,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2510,9 +2510,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")).c_str()); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2524,9 +2524,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2539,14 +2539,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_pointer) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2558,9 +2558,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2572,9 +2572,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextT(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2586,9 +2586,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2601,14 +2601,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_pointer_n) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace")).c_str(), 5); + text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2620,9 +2620,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2634,9 +2634,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2648,9 +2648,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2662,9 +2662,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextT(STR("Replace")).c_str(), 5); + text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2676,9 +2676,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2690,9 +2690,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2704,9 +2704,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2719,14 +2719,14 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_pointer_n) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2740,9 +2740,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2756,9 +2756,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, Compare_Text(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextT(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2772,9 +2772,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, Compare_Text(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextT(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2789,7 +2789,7 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_position_length_n_c) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2808,7 +2808,7 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 7, STR('A')); + compare_text.replace(2, CompareText::npos, 7, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 7, STR('A')); @@ -2836,7 +2836,7 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 15, STR('A')); + compare_text.replace(2, CompareText::npos, 15, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 15, STR('A')); @@ -2864,7 +2864,7 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 7, STR('A')); + compare_text.replace(2, CompareText::npos, 7, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 7, STR('A')); @@ -2892,7 +2892,7 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, Compare_Text::npos, 15, STR('A')); + compare_text.replace(2, CompareText::npos, 15, STR('A')); compare_text.resize(std::min(compare_text.size(), SIZE)); text.replace(2, Text::npos, 15, STR('A')); @@ -2907,7 +2907,7 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_n_c) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); @@ -2969,13 +2969,13 @@ namespace TEST_FIXTURE(SetupFixture, test_replace_first_last_first_last) { // Non-overflow short text. - Compare_Text compare_text(short_text.c_str()); + CompareText compare_text(short_text.c_str()); TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - Compare_Text replace(STR("Replace")); - Compare_Text replace_long(STR("Replace with some text")); + CompareText replace(STR("Replace")); + CompareText replace_long(STR("Replace with some text")); compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, replace.begin() + 1, replace.begin() + 5); compare_text.resize(std::min(compare_text.size(), SIZE)); @@ -3033,11 +3033,11 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_single_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); - Compare_Text::iterator citr = compare_text.erase(compare_text.begin() + 2); + CompareText::iterator citr = compare_text.erase(compare_text.begin() + 2); Text::iterator ditr = text.erase(text.begin() + 2); CHECK(*citr == *ditr); @@ -3051,11 +3051,11 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_single_const_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); - Compare_Text::iterator citr = compare_text.erase(compare_text.cbegin() + 2); + CompareText::iterator citr = compare_text.erase(compare_text.cbegin() + 2); Text::iterator ditr = text.erase(text.cbegin() + 2); CHECK(*citr == *ditr); @@ -3069,11 +3069,11 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_erase_range) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); - Compare_Text::iterator citr = compare_text.erase(compare_text.cbegin() + 2, compare_text.cbegin() + 4); + CompareText::iterator citr = compare_text.erase(compare_text.cbegin() + 2, compare_text.cbegin() + 4); Text::iterator ditr = text.erase(text.cbegin() + 2, text.cbegin() + 4); CHECK(*citr == *ditr); @@ -3100,7 +3100,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3115,7 +3115,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_const_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3130,7 +3130,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_reverse_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3145,7 +3145,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_const_reverse_iterator) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3364,7 +3364,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3408,7 +3408,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy_count_equals_npos) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3416,7 +3416,7 @@ namespace value_t buffer1[SIZE]; value_t buffer2[SIZE]; - size_t length1 = compare_text.copy(buffer1, Compare_Text::npos, 2); + size_t length1 = compare_text.copy(buffer1, CompareText::npos, 2); buffer1[length1] = STR('\0'); size_t length2 = text.copy(buffer2, Text::npos, 2); @@ -3436,7 +3436,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_copy_count_too_large) { - Compare_Text compare_text(initial_text.c_str()); + CompareText compare_text(initial_text.c_str()); TextBuffer buffer{0}; Text text(initial_text.c_str(), buffer.data(), buffer.size()); @@ -3674,7 +3674,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_string) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -3683,35 +3683,35 @@ namespace int result; // Equal. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEF"))); - result = text.compare(TextT(STR("ABCDEF"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEF"))); + result = text.compare(TextL(STR("ABCDEF"))); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEE"))); - result = text.compare(TextT(STR("ABCDEE"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEE"))); + result = text.compare(TextL(STR("ABCDEE"))); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEG"))); - result = text.compare(TextT(STR("ABCDEG"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEG"))); + result = text.compare(TextL(STR("ABCDEG"))); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(Compare_Text(STR("ABCDE"))); - result = text.compare(TextT(STR("ABCDE"))); + compare_result = compare_text.compare(CompareText(STR("ABCDE"))); + result = text.compare(TextL(STR("ABCDE"))); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(Compare_Text(STR("ABCDEFG"))); - result = text.compare(TextT(STR("ABCDEFG"))); + compare_result = compare_text.compare(CompareText(STR("ABCDEFG"))); + result = text.compare(TextL(STR("ABCDEFG"))); CHECK(compares_agree(compare_result, result)); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_string) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); TextBuffer buffer{0}; Text text(STR("xxxABCDEFyyy"), buffer.data(), buffer.size()); @@ -3720,35 +3720,35 @@ namespace int result; // Equal. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEF"))); - result = text.compare(3, 6, TextT(STR("ABCDEF"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEF"))); + result = text.compare(3, 6, TextL(STR("ABCDEF"))); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEE"))); - result = text.compare(3, 6, TextT(STR("ABCDEE"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEE"))); + result = text.compare(3, 6, TextL(STR("ABCDEE"))); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEG"))); - result = text.compare(3, 6, TextT(STR("ABCDEG"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEG"))); + result = text.compare(3, 6, TextL(STR("ABCDEG"))); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDE"))); - result = text.compare(3, 6, TextT(STR("ABCDE"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDE"))); + result = text.compare(3, 6, TextL(STR("ABCDE"))); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("ABCDEFG"))); - result = text.compare(3, 6, TextT(STR("ABCDEFG"))); + compare_result = compare_text.compare(3, 6, CompareText(STR("ABCDEFG"))); + result = text.compare(3, 6, TextL(STR("ABCDEFG"))); CHECK(compares_agree(compare_result, result)); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_string_subposition_sublength) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); TextBuffer buffer{0}; Text text(STR("xxxABCDEFyyy"), buffer.data(), buffer.size()); @@ -3757,35 +3757,35 @@ namespace int result; // Equal. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEFbb")), 2, 6); - result = text.compare(3, 6, TextT(STR("aaABCDEFbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEFbb")), 2, 6); + result = text.compare(3, 6, TextL(STR("aaABCDEFbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Less. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEEbb")), 2, 6); - result = text.compare(3, 6, TextT(STR("aaABCDEEbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEEbb")), 2, 6); + result = text.compare(3, 6, TextL(STR("aaABCDEEbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Greater. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEGbb")), 2, 6); - result = text.compare(3, 6, TextT(STR("aaABCDEGbb")), 2, 6); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEGbb")), 2, 6); + result = text.compare(3, 6, TextL(STR("aaABCDEGbb")), 2, 6); CHECK(compares_agree(compare_result, result)); // Shorter. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEbb")), 2, 5); - result = text.compare(3, 6, TextT(STR("aaABCDEbb")), 2, 5); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEbb")), 2, 5); + result = text.compare(3, 6, TextL(STR("aaABCDEbb")), 2, 5); CHECK(compares_agree(compare_result, result)); // Longer. - compare_result = compare_text.compare(3, 6, Compare_Text(STR("aaABCDEFGbb")), 2, 7); - result = text.compare(3, 6, TextT(STR("aaABCDEFGbb")), 2, 7); + compare_result = compare_text.compare(3, 6, CompareText(STR("aaABCDEFGbb")), 2, 7); + result = text.compare(3, 6, TextL(STR("aaABCDEFGbb")), 2, 7); CHECK(compares_agree(compare_result, result)); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_c_string) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -3822,7 +3822,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_c_string) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); TextBuffer buffer{0}; Text text(STR("xxxABCDEFyyy"), buffer.data(), buffer.size()); @@ -3859,7 +3859,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_position_length_c_string_n) { - Compare_Text compare_text(STR("xxxABCDEFyyy")); + CompareText compare_text(STR("xxxABCDEFyyy")); TextBuffer buffer{0}; Text text(STR("xxxABCDEFyyy"), buffer.data(), buffer.size()); @@ -3896,29 +3896,29 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_string_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); - size_t position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF"))); - size_t position2 = text.find_first_of(TextT(STR("ZCXF"))); + size_t position1 = compare_text.find_first_of(CompareText(STR("ZCXF"))); + size_t position2 = text.find_first_of(TextL(STR("ZCXF"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_of(Compare_Text(STR("WXYZ"))); - position2 = text.find_first_of(TextT(STR("WXYZ"))); + position1 = compare_text.find_first_of(CompareText(STR("WXYZ"))); + position2 = text.find_first_of(TextL(STR("WXYZ"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF")), 3); - position2 = text.find_first_of(TextT(STR("ZCXF")), 3); + position1 = compare_text.find_first_of(CompareText(STR("ZCXF")), 3); + position2 = text.find_first_of(TextL(STR("ZCXF")), 3); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_first_of(Compare_Text(STR("ZCXF")), 100); - position2 = text.find_first_of(TextT(STR("ZCXF")), 100); + position1 = compare_text.find_first_of(CompareText(STR("ZCXF")), 100); + position2 = text.find_first_of(TextL(STR("ZCXF")), 100); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_pop.h" @@ -3927,7 +3927,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -3958,7 +3958,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -3994,7 +3994,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4035,34 +4035,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_string_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); - size_t position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE"))); - size_t position2 = text.find_last_of(TextT(STR("ZCXE"))); + size_t position1 = compare_text.find_last_of(CompareText(STR("ZCXE"))); + size_t position2 = text.find_last_of(TextL(STR("ZCXE"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("WXYZ")), 3); - position2 = text.find_last_of(TextT(STR("WXYZ")), 3); + position1 = compare_text.find_last_of(CompareText(STR("WXYZ")), 3); + position2 = text.find_last_of(TextL(STR("WXYZ")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), 5); - position2 = text.find_last_of(TextT(STR("ZCXE")), 5); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), 5); + position2 = text.find_last_of(TextL(STR("ZCXE")), 5); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), compare_text.size()); - position2 = text.find_last_of(TextT(STR("ZCXE")), text.size()); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), compare_text.size()); + position2 = text.find_last_of(TextL(STR("ZCXE")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_last_of(Compare_Text(STR("ZCXE")), 100); - position2 = text.find_last_of(TextT(STR("ZCXE")), 100); + position1 = compare_text.find_last_of(CompareText(STR("ZCXE")), 100); + position2 = text.find_last_of(TextL(STR("ZCXE")), 100); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_pop.h" @@ -4071,7 +4071,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); @@ -4112,7 +4112,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); @@ -4151,7 +4151,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4192,34 +4192,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_string_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); - size_t position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB"))); - size_t position2 = text.find_first_not_of(TextT(STR("ZAXB"))); + size_t position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB"))); + size_t position2 = text.find_first_not_of(TextL(STR("ZAXB"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB"))); - position2 = text.find_first_not_of(TextT(STR("ZAXB"))); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB"))); + position2 = text.find_first_not_of(TextL(STR("ZAXB"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), 3); - position2 = text.find_first_not_of(TextT(STR("ZAXB")), 3); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), 3); + position2 = text.find_first_not_of(TextL(STR("ZAXB")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), compare_text.size()); - position2 = text.find_first_not_of(TextT(STR("ZAXB")), text.size()); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), compare_text.size()); + position2 = text.find_first_not_of(TextL(STR("ZAXB")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), 100); - position2 = text.find_first_not_of(TextT(STR("ZAXB")), 100); + position1 = compare_text.find_first_not_of(CompareText(STR("ZAXB")), 100); + position2 = text.find_first_not_of(TextL(STR("ZAXB")), 100); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_pop.h" @@ -4228,7 +4228,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4264,7 +4264,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4305,7 +4305,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_first_not_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4346,34 +4346,34 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_string_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); - size_t position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD"))); - size_t position2 = text.find_last_not_of(TextT(STR("ZEXD"))); + size_t position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD"))); + size_t position2 = text.find_last_not_of(TextL(STR("ZEXD"))); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 3); - position2 = text.find_last_not_of(TextT(STR("ZEXD")), 3); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 3); + position2 = text.find_last_not_of(TextL(STR("ZEXD")), 3); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 5); - position2 = text.find_last_not_of(TextT(STR("ZEXD")), 5); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 5); + position2 = text.find_last_not_of(TextL(STR("ZEXD")), 5); CHECK_EQUAL(position1, position2); - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), compare_text.size()); - position2 = text.find_last_not_of(TextT(STR("ZEXD")), text.size()); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), compare_text.size()); + position2 = text.find_last_not_of(TextL(STR("ZEXD")), text.size()); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_array_bounds_push.h" - position1 = compare_text.find_last_not_of(Compare_Text(STR("ZEXD")), 100); - position2 = text.find_last_not_of(TextT(STR("ZEXD")), 100); + position1 = compare_text.find_last_not_of(CompareText(STR("ZEXD")), 100); + position2 = text.find_last_not_of(TextL(STR("ZEXD")), 100); CHECK_EQUAL(position1, position2); #include "etl/private/diagnostic_pop.h" @@ -4382,7 +4382,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_pointer_position) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); @@ -4418,7 +4418,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_pointer_position_n) { - Compare_Text compare_text(STR("ABCDEFABCDE")); + CompareText compare_text(STR("ABCDEFABCDE")); TextBuffer buffer{0}; Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size()); @@ -4452,7 +4452,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_find_last_not_of_character_position) { - Compare_Text compare_text(STR("ABCDEF")); + CompareText compare_text(STR("ABCDEF")); TextBuffer buffer{0}; Text text(STR("ABCDEF"), buffer.data(), buffer.size()); @@ -4651,7 +4651,7 @@ namespace Text& text = *reinterpret_cast(buffer); text.set_secure(); - CHECK(TextT(STR("ABCDEF")) == text); + CHECK(TextL(STR("ABCDEF")) == text); Text::pointer pb = text.begin(); Text::pointer pe = text.end(); diff --git a/test/test_string_view.cpp b/test/test_string_view.cpp index 8588e3f4..08c28a55 100644 --- a/test/test_string_view.cpp +++ b/test/test_string_view.cpp @@ -31,9 +31,6 @@ SOFTWARE. #include "etl/string_view.h" #include "etl/string.h" #include "etl/wstring.h" -#if ETL_USING_CPP20 - #include "etl/u8string.h" -#endif #include "etl/u16string.h" #include "etl/u32string.h" #include "etl/hash.h" @@ -48,16 +45,12 @@ namespace { using View = etl::string_view; using WView = etl::wstring_view; - using U8View = etl::u8string_view; using U16View = etl::u16string_view; using U32View = etl::u32string_view; etl::string<11> etltext = "Hello World"; std::string text = "Hello World"; std::wstring wtext = L"Hello World"; -#if ETL_USING_CPP20 - std::u8string u8text = u8"Hello World"; -#endif std::u16string u16text = u"Hello World"; std::u32string u32text = U"Hello World"; std::string text_smaller = "Hello Worlc"; @@ -66,17 +59,11 @@ namespace constexpr char cctext[] = { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '\0' }; constexpr wchar_t cwtext[] = { L'H', L'e', L'l', L'l', L'o', L' ', L'W', L'o', L'r', L'l', L'd', L'\0' }; -#if ETL_USING_CPP20 - constexpr char8_t cu8text[] = { u8'H', u8'e', u8'l', u8'l', u8'o', u8' ', u8'W', u8'o', u8'r', u8'l', u8'd', u8'\0' }; -#endif constexpr char16_t cu16text[] = { u'H', u'e', u'l', u'l', u'o', u' ', u'W', u'o', u'r', u'l', u'd', u'\0' }; constexpr char32_t cu32text[] = { U'H', U'e', U'l', U'l', U'o', U' ', U'W', U'o', U'r', U'l', U'd', U'\0' }; const char* pctext = cctext; const wchar_t* pwtext = cwtext; -#if ETL_USING_CPP20 - const char8_t* pu8text = cu8text; -#endif const char16_t* pu16text = cu16text; const char32_t* pu32text = cu32text; @@ -139,20 +126,6 @@ namespace CHECK(isEqual); } - //************************************************************************* -#if ETL_USING_CPP20 - TEST(test_constructor_pointer_range_u8char_t) - { - U8View view(pu8text, pu8text + etl::strlen(pu8text)); - - CHECK(text.size() == view.size()); - CHECK(text.size() == view.max_size()); - - bool isEqual = std::equal(view.begin(), view.end(), text.begin()); - CHECK(isEqual); - } -#endif - //************************************************************************* TEST(test_constructor_pointer_range_u16char_t) { @@ -230,18 +203,12 @@ namespace { auto cview = etl::make_string_view("Hello World"); auto wview = etl::make_string_view(L"Hello World"); -#if ETL_USING_CPP20 - auto u8view = etl::make_string_view(u8"Hello World"); -#endif auto u16view = etl::make_string_view(u"Hello World"); auto u32view = etl::make_string_view(U"Hello World"); CHECK(std::equal(cview.begin(), cview.end(), text.begin())); CHECK(std::equal(wview.begin(), wview.end(), wtext.begin())); CHECK(std::equal(u16view.begin(), u16view.end(), u16text.begin())); -#if ETL_USING_CPP20 - CHECK(std::equal(u8view.begin(), u8view.end(), u8text.begin())); -#endif CHECK(std::equal(u32view.begin(), u32view.end(), u32text.begin())); } @@ -251,19 +218,13 @@ namespace { constexpr auto cview = etl::make_string_view(cctext); constexpr auto wview = etl::make_string_view(cwtext); -#if ETL_USING_CPP20 - constexpr auto u8view = etl::make_string_view(cu8text); -#endif constexpr auto u16view = etl::make_string_view(cu16text); constexpr auto u32view = etl::make_string_view(cu32text); CHECK(std::equal(cview.begin(), cview.end(), text.begin())); - CHECK(std::equal(wview.begin(), wview.end(), wtext.begin())); -#if ETL_USING_CPP20 - CHECK(std::equal(u8view.begin(), u8view.end(), u8text.begin())); -#endif - CHECK(std::equal(u16view.begin(), u16view.end(), u16text.begin())); - CHECK(std::equal(u32view.begin(), u32view.end(), u32text.begin())); + CHECK(std::equal(wview.begin(), wview.end(), text.begin())); + CHECK(std::equal(u16view.begin(), u16view.end(), text.begin())); + CHECK(std::equal(u32view.begin(), u32view.end(), text.begin())); } #endif diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 119404f7..f3e852b7 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -2156,9 +2156,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2170,9 +2170,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2184,9 +2184,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2198,9 +2198,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2212,9 +2212,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2226,9 +2226,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2240,9 +2240,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2254,9 +2254,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2272,9 +2272,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2286,9 +2286,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2300,9 +2300,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2314,9 +2314,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2332,9 +2332,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2346,9 +2346,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2360,9 +2360,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2374,9 +2374,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2388,9 +2388,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2402,9 +2402,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2416,9 +2416,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2430,9 +2430,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2448,9 +2448,9 @@ namespace CompareText compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2464,9 +2464,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2480,9 +2480,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2496,9 +2496,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_wchar_t_external_buffer.cpp b/test/test_string_wchar_t_external_buffer.cpp index c85d8aed..a30dc63f 100644 --- a/test/test_string_wchar_t_external_buffer.cpp +++ b/test/test_string_wchar_t_external_buffer.cpp @@ -69,11 +69,11 @@ namespace static constexpr size_t SIZE_L = 52; static constexpr size_t SIZE_S = 4; - using Text = etl::wstring_ext; - using IText = etl::iwstring; - using TextL = etl::wstring; + using Text = etl::wstring_ext; + using IText = etl::iwstring; + using TextL = etl::wstring; using CompareText = std::wstring; - using value_t = Text::value_type; + using value_t = Text::value_type; using TextBuffer = std::array; using TextBufferL = std::array; @@ -2411,9 +2411,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str()); + text.replace(2, 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2425,9 +2425,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2439,9 +2439,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2453,9 +2453,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2467,9 +2467,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, 7, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str()); + text.replace(2, 7, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2481,9 +2481,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); + text.replace(2, Text::npos, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2495,9 +2495,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); + text.replace(2, 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2509,9 +2509,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(2, CompareText::npos, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); + text.replace(2, Text::npos, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2529,9 +2529,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2545,7 +2545,7 @@ namespace compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2557,9 +2557,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2571,9 +2571,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str()); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str()); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2591,9 +2591,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(2, 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2605,9 +2605,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2619,9 +2619,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2633,9 +2633,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2647,9 +2647,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, 7, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); + text.replace(2, 7, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2661,9 +2661,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(2, CompareText::npos, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); + text.replace(2, Text::npos, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2675,9 +2675,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2689,9 +2689,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, CompareText::npos, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(2, CompareText::npos, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(2, Text::npos, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2709,9 +2709,9 @@ namespace TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2725,9 +2725,9 @@ namespace compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2741,9 +2741,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, CompareText(STR("Replace")).c_str(), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace"), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); + text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2757,9 +2757,9 @@ namespace compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, CompareText(STR("Replace with some text")).c_str(), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text"), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace with some text")).c_str(), 15); + text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text"), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_to_arithmetic.cpp b/test/test_to_arithmetic.cpp index 11b81fa2..76071a2a 100644 --- a/test/test_to_arithmetic.cpp +++ b/test/test_to_arithmetic.cpp @@ -146,13 +146,13 @@ namespace const Text value6(STR("10101100")); const Text value7(STR("-01010100")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); CHECK(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).has_value()); CHECK(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).has_value()); @@ -313,13 +313,13 @@ namespace const Text value6(STR("0254")); const Text value7(STR("-0124")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); } //************************************************************************* @@ -462,13 +462,13 @@ namespace const Text text5(STR("83")); const Text text6(STR("-84")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); } //************************************************************************* @@ -598,13 +598,13 @@ namespace const Text text6(STR("Ac")); const Text text7(STR("-54")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); } //************************************************************************* @@ -1013,19 +1013,19 @@ namespace using ETLText = etl::string<2>; // Default radix - CHECK_EQUAL(int(83), int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size())).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text.c_str(), text.size()).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(ETLText(text.c_str(), text.size())).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size())).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text.c_str(), text.size()).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(ETLText(text.c_str(), text.size())).value())); // Format spec radix - CHECK_EQUAL(int(83), int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size()), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text.c_str(), text.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(ETLText(text.c_str(), text.size()), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size()), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text.c_str(), text.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(ETLText(text.c_str(), text.size()), etl::dec).value())); // Numeric radix - CHECK_EQUAL(int(83), int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size()), etl::radix::decimal).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text.c_str(), text.size(), etl::radix::decimal).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(ETLText(text.c_str(), text.size()), etl::radix::decimal).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(etl::string_view(text.c_str(), text.size()), etl::radix::decimal).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text.c_str(), text.size(), etl::radix::decimal).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(ETLText(text.c_str(), text.size()), etl::radix::decimal).value())); } //************************************************************************* diff --git a/test/test_to_arithmetic_u16.cpp b/test/test_to_arithmetic_u16.cpp index 423c2f29..edbbd9ec 100644 --- a/test/test_to_arithmetic_u16.cpp +++ b/test/test_to_arithmetic_u16.cpp @@ -146,13 +146,13 @@ namespace const Text value6(STR("10101100")); const Text value7(STR("-01010100")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); CHECK(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).has_value()); CHECK(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).has_value()); @@ -313,13 +313,13 @@ namespace const Text value6(STR("0254")); const Text value7(STR("-0124")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); } //************************************************************************* @@ -462,13 +462,13 @@ namespace const Text text5(STR("83")); const Text text6(STR("-84")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); } //************************************************************************* @@ -598,13 +598,13 @@ namespace const Text text6(STR("Ac")); const Text text7(STR("-54")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); } //************************************************************************* diff --git a/test/test_to_arithmetic_u32.cpp b/test/test_to_arithmetic_u32.cpp index a53fb827..60808bfa 100644 --- a/test/test_to_arithmetic_u32.cpp +++ b/test/test_to_arithmetic_u32.cpp @@ -146,13 +146,13 @@ namespace const Text value6(STR("10101100")); const Text value7(STR("-01010100")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); CHECK(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).has_value()); CHECK(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).has_value()); @@ -313,13 +313,13 @@ namespace const Text value6(STR("0254")); const Text value7(STR("-0124")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); } //************************************************************************* @@ -462,13 +462,13 @@ namespace const Text text5(STR("83")); const Text text6(STR("-84")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); } //************************************************************************* @@ -598,13 +598,13 @@ namespace const Text text6(STR("Ac")); const Text text7(STR("-54")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); } //************************************************************************* diff --git a/test/test_to_arithmetic_u8.cpp b/test/test_to_arithmetic_u8.cpp index 1e9e027f..92ec7023 100644 --- a/test/test_to_arithmetic_u8.cpp +++ b/test/test_to_arithmetic_u8.cpp @@ -26,9 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "etl/platform.h" -#if ETL_USING_CPP20 - #include "unit_test_framework.h" #include @@ -40,6 +37,8 @@ SOFTWARE. #include "etl/u8string.h" #include "etl/format_spec.h" +#if ETL_USING_CPP20 + #undef STR #define STR(x) u8##x using Text = std::u8string; @@ -149,13 +148,13 @@ namespace const Text value6(STR("10101100")); const Text value7(STR("-01010100")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); CHECK(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).has_value()); CHECK(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).has_value()); @@ -316,13 +315,13 @@ namespace const Text value6(STR("0254")); const Text value7(STR("-0124")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); } //************************************************************************* @@ -465,13 +464,13 @@ namespace const Text text5(STR("83")); const Text text6(STR("-84")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); } //************************************************************************* @@ -601,13 +600,13 @@ namespace const Text text6(STR("Ac")); const Text text7(STR("-54")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); } //************************************************************************* diff --git a/test/test_to_arithmetic_wchar_t.cpp b/test/test_to_arithmetic_wchar_t.cpp index 2842ea17..9ba5af76 100644 --- a/test/test_to_arithmetic_wchar_t.cpp +++ b/test/test_to_arithmetic_wchar_t.cpp @@ -146,13 +146,13 @@ namespace const Text value6(STR("10101100")); const Text value7(STR("-01010100")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::bin).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::bin).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::bin).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::bin).value())); CHECK(etl::to_arithmetic(value1.c_str(), value1.size(), etl::bin).has_value()); CHECK(etl::to_arithmetic(value2.c_str(), value2.size(), etl::bin).has_value()); @@ -313,13 +313,13 @@ namespace const Text value6(STR("0254")); const Text value7(STR("-0124")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(value1.c_str(), value1.size(), etl::oct).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(value2.c_str(), value2.size(), etl::oct).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(value3.c_str(), value3.size(), etl::oct).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(value4.c_str(), value4.size(), etl::oct).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(value5.c_str(), value5.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value6.c_str(), value6.size(), etl::oct).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(value7.c_str(), value7.size(), etl::oct).value())); } //************************************************************************* @@ -462,13 +462,13 @@ namespace const Text text5(STR("83")); const Text text6(STR("-84")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::dec).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::dec).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::dec).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::dec).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::dec).value())); } //************************************************************************* @@ -598,13 +598,13 @@ namespace const Text text6(STR("Ac")); const Text text7(STR("-54")); - CHECK_EQUAL(int(0), int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); - CHECK_EQUAL(int(1), int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); - CHECK_EQUAL(int(5), int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); - CHECK_EQUAL(int(10), int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); - CHECK_EQUAL(int(83), int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); - CHECK_EQUAL(int(-84), int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); + CHECK_EQUAL(0, int(etl::to_arithmetic(text1.c_str(), text1.size(), etl::hex).value())); + CHECK_EQUAL(1, int(etl::to_arithmetic(text2.c_str(), text2.size(), etl::hex).value())); + CHECK_EQUAL(5, int(etl::to_arithmetic(text3.c_str(), text3.size(), etl::hex).value())); + CHECK_EQUAL(10, int(etl::to_arithmetic(text4.c_str(), text4.size(), etl::hex).value())); + CHECK_EQUAL(83, int(etl::to_arithmetic(text5.c_str(), text5.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text6.c_str(), text6.size(), etl::hex).value())); + CHECK_EQUAL(-84, int(etl::to_arithmetic(text7.c_str(), text7.size(), etl::hex).value())); } //************************************************************************* diff --git a/test/test_to_string.cpp b/test/test_to_string.cpp index 735c1b7a..dfb2ea44 100644 --- a/test/test_to_string.cpp +++ b/test/test_to_string.cpp @@ -69,15 +69,15 @@ namespace CHECK(etl::string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); - CHECK(etl::string<20>(STR("127")) == etl::to_string(int8_t(INT8_MAX), str)); - CHECK(etl::string<20>(STR("32767")) == etl::to_string(int16_t(INT16_MAX), str)); - CHECK(etl::string<20>(STR("2147483647")) == etl::to_string(int32_t(INT32_MAX), str)); - CHECK(etl::string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str)); + CHECK(etl::string<20>(STR("127")) == etl::to_string(INT8_MAX, str)); + CHECK(etl::string<20>(STR("32767")) == etl::to_string(INT16_MAX, str)); + CHECK(etl::string<20>(STR("2147483647")) == etl::to_string(INT32_MAX, str)); + CHECK(etl::string<20>(STR("9223372036854775807")) == etl::to_string(INT64_MAX, str)); - CHECK(etl::string<20>(STR("-128")) == etl::to_string(int8_t(INT8_MIN), str)); - CHECK(etl::string<20>(STR("-32768")) == etl::to_string(int16_t(INT16_MIN), str)); - CHECK(etl::string<20>(STR("-2147483648")) == etl::to_string(int32_t(INT32_MIN), str)); - CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str)); + CHECK(etl::string<20>(STR("-128")) == etl::to_string(INT8_MIN, str)); + CHECK(etl::string<20>(STR("-32768")) == etl::to_string(INT16_MIN, str)); + CHECK(etl::string<20>(STR("-2147483648")) == etl::to_string(INT32_MIN, str)); + CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str)); } //************************************************************************* @@ -95,15 +95,15 @@ namespace CHECK(etl::string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true)); - CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(INT8_MAX), str, true)); - CHECK(etl::string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(INT16_MAX), str, true)); - CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(INT32_MAX), str, true)); - CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, true)); + CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(INT8_MAX, str, true)); + CHECK(etl::string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(INT16_MAX, str, true)); + CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(INT32_MAX, str, true)); + CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(INT64_MAX, str, true)); - CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(INT8_MIN), str, true)); - CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(INT16_MIN), str, true)); - CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, true)); - CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, true)); + CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(INT8_MIN, str, true)); + CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(INT16_MIN, str, true)); + CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(INT32_MIN, str, true)); + CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(INT64_MIN, str, true)); } //************************************************************************* @@ -125,15 +125,15 @@ namespace CHECK(etl::string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::string<20>(STR("#################127")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::string<20>(STR("###############32767")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::string<20>(STR("##########2147483647")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::string<20>(STR("#################127")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::string<20>(STR("###############32767")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::string<20>(STR("##########2147483647")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::string<20>(STR("#9223372036854775807")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::string<20>(STR("################-128")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::string<20>(STR("##############-32768")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::string<20>(STR("################-128")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::string<20>(STR("##############-32768")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::string<20>(STR("#########-2147483648")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -153,15 +153,15 @@ namespace CHECK(etl::string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::string<20>(STR("127#################")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::string<20>(STR("32767###############")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::string<20>(STR("2147483647##########")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::string<20>(STR("127#################")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::string<20>(STR("32767###############")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::string<20>(STR("2147483647##########")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::string<20>(STR("9223372036854775807#")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::string<20>(STR("-128################")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::string<20>(STR("-32768##############")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::string<20>(STR("-128################")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::string<20>(STR("-32768##############")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::string<20>(STR("-2147483648#########")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -179,15 +179,15 @@ namespace CHECK(etl::string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::string<64>(STR("01111111")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::string<64>(STR("0111111111111111")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::string<64>(STR("01111111")) == etl::to_string(INT8_MAX, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::string<64>(STR("0111111111111111")) == etl::to_string(INT16_MAX, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::string<64>(STR("01111111111111111111111111111111")) == etl::to_string(INT32_MAX, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(INT64_MAX, str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::string<64>(STR("10000000")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::string<64>(STR("1000000000000000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::string<64>(STR("10000000")) == etl::to_string(INT8_MIN, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::string<64>(STR("1000000000000000")) == etl::to_string(INT16_MIN, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::string<64>(STR("10000000000000000000000000000000")) == etl::to_string(INT32_MIN, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(2).width(64).fill(STR('0')))); } //************************************************************************* @@ -205,15 +205,15 @@ namespace CHECK(etl::string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::string<22>(STR("177")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::string<22>(STR("077777")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::string<22>(STR("17777777777")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::string<22>(STR("177")) == etl::to_string(INT8_MAX, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::string<22>(STR("077777")) == etl::to_string(INT16_MAX, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::string<22>(STR("17777777777")) == etl::to_string(INT32_MAX, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::string<22>(STR("0777777777777777777777")) == etl::to_string(INT64_MAX, str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::string<22>(STR("200")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::string<22>(STR("100000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::string<22>(STR("20000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::string<22>(STR("200")) == etl::to_string(INT8_MIN, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::string<22>(STR("100000")) == etl::to_string(INT16_MIN, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::string<22>(STR("20000000000")) == etl::to_string(INT32_MIN, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::string<22>(STR("1000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(8).width(22).fill(STR('0')))); } //************************************************************************* @@ -231,15 +231,15 @@ namespace CHECK(etl::string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::string<16>(STR("7f")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::string<16>(STR("7fff")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::string<16>(STR("7fffffff")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::string<16>(STR("7f")) == etl::to_string(INT8_MAX, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::string<16>(STR("7fff")) == etl::to_string(INT16_MAX, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::string<16>(STR("7fffffff")) == etl::to_string(INT32_MAX, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::string<16>(STR("7fffffffffffffff")) == etl::to_string(INT64_MAX, str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::string<16>(STR("80")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::string<16>(STR("8000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::string<16>(STR("80000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::string<16>(STR("8000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::string<16>(STR("80")) == etl::to_string(INT8_MIN, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::string<16>(STR("8000")) == etl::to_string(INT16_MIN, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::string<16>(STR("80000000")) == etl::to_string(INT32_MIN, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::string<16>(STR("8000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(16).width(16).fill(STR('0')))); } //************************************************************************* diff --git a/test/test_to_u16string.cpp b/test/test_to_u16string.cpp index 8f4de9d9..5d964070 100644 --- a/test/test_to_u16string.cpp +++ b/test/test_to_u16string.cpp @@ -56,15 +56,15 @@ namespace CHECK(etl::u16string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::u16string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); - CHECK(etl::u16string<20>(STR("127")) == etl::to_string(int8_t(INT8_MAX), str)); - CHECK(etl::u16string<20>(STR("32767")) == etl::to_string(int16_t(INT16_MAX), str)); - CHECK(etl::u16string<20>(STR("2147483647")) == etl::to_string(int32_t(INT32_MAX), str)); - CHECK(etl::u16string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str)); + CHECK(etl::u16string<20>(STR("127")) == etl::to_string(INT8_MAX, str)); + CHECK(etl::u16string<20>(STR("32767")) == etl::to_string(INT16_MAX, str)); + CHECK(etl::u16string<20>(STR("2147483647")) == etl::to_string(INT32_MAX, str)); + CHECK(etl::u16string<20>(STR("9223372036854775807")) == etl::to_string(INT64_MAX, str)); - CHECK(etl::u16string<20>(STR("-128")) == etl::to_string(int8_t(INT8_MIN), str)); - CHECK(etl::u16string<20>(STR("-32768")) == etl::to_string(int16_t(INT16_MIN), str)); - CHECK(etl::u16string<20>(STR("-2147483648")) == etl::to_string(int32_t(INT32_MIN), str)); - CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str)); + CHECK(etl::u16string<20>(STR("-128")) == etl::to_string(INT8_MIN, str)); + CHECK(etl::u16string<20>(STR("-32768")) == etl::to_string(INT16_MIN, str)); + CHECK(etl::u16string<20>(STR("-2147483648")) == etl::to_string(INT32_MIN, str)); + CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str)); } //************************************************************************* @@ -82,15 +82,15 @@ namespace CHECK(etl::u16string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true)); - CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(INT8_MAX), str, true)); - CHECK(etl::u16string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(INT16_MAX), str, true)); - CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(INT32_MAX), str, true)); - CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, true)); + CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(INT8_MAX, str, true)); + CHECK(etl::u16string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(INT16_MAX, str, true)); + CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(INT32_MAX, str, true)); + CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(INT64_MAX, str, true)); - CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(INT8_MIN), str, true)); - CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(INT16_MIN), str, true)); - CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, true)); - CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, true)); + CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(INT8_MIN, str, true)); + CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(INT16_MIN, str, true)); + CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(INT32_MIN, str, true)); + CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(INT64_MIN, str, true)); } //************************************************************************* @@ -110,15 +110,15 @@ namespace CHECK(etl::u16string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u16string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u16string<20>(STR("#################127")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u16string<20>(STR("###############32767")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u16string<20>(STR("##########2147483647")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u16string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u16string<20>(STR("#################127")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u16string<20>(STR("###############32767")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u16string<20>(STR("##########2147483647")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u16string<20>(STR("#9223372036854775807")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u16string<20>(STR("################-128")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u16string<20>(STR("##############-32768")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u16string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u16string<20>(STR("################-128")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u16string<20>(STR("##############-32768")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u16string<20>(STR("#########-2147483648")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -138,15 +138,15 @@ namespace CHECK(etl::u16string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u16string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u16string<20>(STR("127#################")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u16string<20>(STR("32767###############")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u16string<20>(STR("2147483647##########")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u16string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u16string<20>(STR("127#################")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u16string<20>(STR("32767###############")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u16string<20>(STR("2147483647##########")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u16string<20>(STR("9223372036854775807#")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u16string<20>(STR("-128################")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u16string<20>(STR("-32768##############")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u16string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u16string<20>(STR("-128################")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u16string<20>(STR("-32768##############")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u16string<20>(STR("-2147483648#########")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -164,15 +164,15 @@ namespace CHECK(etl::u16string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("01111111")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("0111111111111111")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("01111111")) == etl::to_string(INT8_MAX, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("0111111111111111")) == etl::to_string(INT16_MAX, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("01111111111111111111111111111111")) == etl::to_string(INT32_MAX, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(INT64_MAX, str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("10000000")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("1000000000000000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("10000000")) == etl::to_string(INT8_MIN, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("1000000000000000")) == etl::to_string(INT16_MIN, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("10000000000000000000000000000000")) == etl::to_string(INT32_MIN, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(2).width(64).fill(STR('0')))); } //************************************************************************* @@ -190,15 +190,15 @@ namespace CHECK(etl::u16string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u16string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("177")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("077777")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("17777777777")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("177")) == etl::to_string(INT8_MAX, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("077777")) == etl::to_string(INT16_MAX, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("17777777777")) == etl::to_string(INT32_MAX, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("0777777777777777777777")) == etl::to_string(INT64_MAX, str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("200")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("100000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("20000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u16string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("200")) == etl::to_string(INT8_MIN, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("100000")) == etl::to_string(INT16_MIN, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("20000000000")) == etl::to_string(INT32_MIN, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u16string<22>(STR("1000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(8).width(22).fill(STR('0')))); } //************************************************************************* @@ -216,15 +216,15 @@ namespace CHECK(etl::u16string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u16string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("7f")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("7fff")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("7fffffff")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("7f")) == etl::to_string(INT8_MAX, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("7fff")) == etl::to_string(INT16_MAX, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("7fffffff")) == etl::to_string(INT32_MAX, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("7fffffffffffffff")) == etl::to_string(INT64_MAX, str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("80")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("8000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("80000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u16string<16>(STR("8000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("80")) == etl::to_string(INT8_MIN, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("8000")) == etl::to_string(INT16_MIN, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("80000000")) == etl::to_string(INT32_MIN, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u16string<16>(STR("8000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(16).width(16).fill(STR('0')))); } //************************************************************************* diff --git a/test/test_to_u32string.cpp b/test/test_to_u32string.cpp index cd5ad7b1..a5a75c82 100644 --- a/test/test_to_u32string.cpp +++ b/test/test_to_u32string.cpp @@ -58,15 +58,15 @@ namespace CHECK(etl::u32string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::u32string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); - CHECK(etl::u32string<20>(STR("127")) == etl::to_string(int8_t(INT8_MAX), str)); - CHECK(etl::u32string<20>(STR("32767")) == etl::to_string(int16_t(INT16_MAX), str)); - CHECK(etl::u32string<20>(STR("2147483647")) == etl::to_string(int32_t(INT32_MAX), str)); - CHECK(etl::u32string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str)); + CHECK(etl::u32string<20>(STR("127")) == etl::to_string(INT8_MAX, str)); + CHECK(etl::u32string<20>(STR("32767")) == etl::to_string(INT16_MAX, str)); + CHECK(etl::u32string<20>(STR("2147483647")) == etl::to_string(INT32_MAX, str)); + CHECK(etl::u32string<20>(STR("9223372036854775807")) == etl::to_string(INT64_MAX, str)); - CHECK(etl::u32string<20>(STR("-128")) == etl::to_string(int8_t(INT8_MIN), str)); - CHECK(etl::u32string<20>(STR("-32768")) == etl::to_string(int16_t(INT16_MIN), str)); - CHECK(etl::u32string<20>(STR("-2147483648")) == etl::to_string(int32_t(INT32_MIN), str)); - CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str)); + CHECK(etl::u32string<20>(STR("-128")) == etl::to_string(INT8_MIN, str)); + CHECK(etl::u32string<20>(STR("-32768")) == etl::to_string(INT16_MIN, str)); + CHECK(etl::u32string<20>(STR("-2147483648")) == etl::to_string(INT32_MIN, str)); + CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str)); } //************************************************************************* @@ -84,15 +84,15 @@ namespace CHECK(etl::u32string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true)); - CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(INT8_MAX), str, true)); - CHECK(etl::u32string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(INT16_MAX), str, true)); - CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(INT32_MAX), str, true)); - CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, true)); + CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(INT8_MAX, str, true)); + CHECK(etl::u32string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(INT16_MAX, str, true)); + CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(INT32_MAX, str, true)); + CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(INT64_MAX, str, true)); - CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(INT8_MIN), str, true)); - CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(INT16_MIN), str, true)); - CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, true)); - CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, true)); + CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(INT8_MIN, str, true)); + CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(INT16_MIN, str, true)); + CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(INT32_MIN, str, true)); + CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(INT64_MIN, str, true)); } //************************************************************************* @@ -112,15 +112,15 @@ namespace CHECK(etl::u32string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u32string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u32string<20>(STR("#################127")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u32string<20>(STR("###############32767")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u32string<20>(STR("##########2147483647")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u32string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u32string<20>(STR("#################127")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u32string<20>(STR("###############32767")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u32string<20>(STR("##########2147483647")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u32string<20>(STR("#9223372036854775807")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u32string<20>(STR("################-128")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u32string<20>(STR("##############-32768")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u32string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u32string<20>(STR("################-128")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u32string<20>(STR("##############-32768")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u32string<20>(STR("#########-2147483648")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -140,15 +140,15 @@ namespace CHECK(etl::u32string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u32string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u32string<20>(STR("127#################")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u32string<20>(STR("32767###############")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u32string<20>(STR("2147483647##########")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u32string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u32string<20>(STR("127#################")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u32string<20>(STR("32767###############")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u32string<20>(STR("2147483647##########")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u32string<20>(STR("9223372036854775807#")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u32string<20>(STR("-128################")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u32string<20>(STR("-32768##############")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u32string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u32string<20>(STR("-128################")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u32string<20>(STR("-32768##############")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u32string<20>(STR("-2147483648#########")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -166,15 +166,15 @@ namespace CHECK(etl::u32string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("01111111")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("0111111111111111")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("01111111")) == etl::to_string(INT8_MAX, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("0111111111111111")) == etl::to_string(INT16_MAX, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("01111111111111111111111111111111")) == etl::to_string(INT32_MAX, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(INT64_MAX, str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("10000000")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("1000000000000000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("10000000")) == etl::to_string(INT8_MIN, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("1000000000000000")) == etl::to_string(INT16_MIN, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("10000000000000000000000000000000")) == etl::to_string(INT32_MIN, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(2).width(64).fill(STR('0')))); } //************************************************************************* @@ -192,15 +192,15 @@ namespace CHECK(etl::u32string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u32string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("177")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("077777")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("17777777777")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("177")) == etl::to_string(INT8_MAX, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("077777")) == etl::to_string(INT16_MAX, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("17777777777")) == etl::to_string(INT32_MAX, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("0777777777777777777777")) == etl::to_string(INT64_MAX, str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("200")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("100000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("20000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u32string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("200")) == etl::to_string(INT8_MIN, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("100000")) == etl::to_string(INT16_MIN, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("20000000000")) == etl::to_string(INT32_MIN, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u32string<22>(STR("1000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(8).width(22).fill(STR('0')))); } //************************************************************************* @@ -218,15 +218,15 @@ namespace CHECK(etl::u32string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u32string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("7f")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("7fff")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("7fffffff")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("7f")) == etl::to_string(INT8_MAX, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("7fff")) == etl::to_string(INT16_MAX, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("7fffffff")) == etl::to_string(INT32_MAX, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("7fffffffffffffff")) == etl::to_string(INT64_MAX, str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("80")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("8000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("80000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u32string<16>(STR("8000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("80")) == etl::to_string(INT8_MIN, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("8000")) == etl::to_string(INT16_MIN, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("80000000")) == etl::to_string(INT32_MIN, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u32string<16>(STR("8000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(16).width(16).fill(STR('0')))); } diff --git a/test/test_to_u8string.cpp b/test/test_to_u8string.cpp index f551799e..c7bf6f80 100644 --- a/test/test_to_u8string.cpp +++ b/test/test_to_u8string.cpp @@ -5,7 +5,7 @@ Embedded Template Library. https://github.com/ETLCPP/etl https://www.etlcpp.com -Copyright(c) 2023 John Wellbelove +Copyright(c) 2019 John Wellbelove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal @@ -26,15 +26,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "etl/platform.h" -#if ETL_USING_CPP20 - #include "unit_test_framework.h" #include "etl/to_u8string.h" #include "etl/u8string.h" #include "etl/format_spec.h" +#if ETL_USING_CPP20 + #undef STR #define STR(x) u8##x @@ -49,25 +48,25 @@ namespace { etl::u8string<20> str; - CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint8_t(0), str)); - CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint16_t(0), str)); - CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint32_t(0), str)); - CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint64_t(0), str)); + CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint8_t(0), str)); + CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint16_t(0), str)); + CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint32_t(0), str)); + CHECK(etl::u8string<20>(STR("0")) == etl::to_string(uint64_t(0), str)); - CHECK(etl::u8string<20>(STR("128")) == etl::to_string(uint8_t(128), str)); - CHECK(etl::u8string<20>(STR("32768")) == etl::to_string(uint16_t(32768), str)); - CHECK(etl::u8string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); - CHECK(etl::u8string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); + CHECK(etl::u8string<20>(STR("128")) == etl::to_string(uint8_t(128), str)); + CHECK(etl::u8string<20>(STR("32768")) == etl::to_string(uint16_t(32768), str)); + CHECK(etl::u8string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); + CHECK(etl::u8string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); - CHECK(etl::u8string<20>(STR("127")) == etl::to_string(int8_t(INT8_MAX), str)); - CHECK(etl::u8string<20>(STR("32767")) == etl::to_string(int16_t(INT16_MAX), str)); - CHECK(etl::u8string<20>(STR("2147483647")) == etl::to_string(int32_t(INT32_MAX), str)); - CHECK(etl::u8string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str)); + CHECK(etl::u8string<20>(STR("127")) == etl::to_string(INT8_MAX, str)); + CHECK(etl::u8string<20>(STR("32767")) == etl::to_string(INT16_MAX, str)); + CHECK(etl::u8string<20>(STR("2147483647")) == etl::to_string(INT32_MAX, str)); + CHECK(etl::u8string<20>(STR("9223372036854775807")) == etl::to_string(INT64_MAX, str)); - CHECK(etl::u8string<20>(STR("-128")) == etl::to_string(int8_t(INT8_MIN), str)); - CHECK(etl::u8string<20>(STR("-32768")) == etl::to_string(int16_t(INT16_MIN), str)); - CHECK(etl::u8string<20>(STR("-2147483648")) == etl::to_string(int32_t(INT32_MIN), str)); - CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str)); + CHECK(etl::u8string<20>(STR("-128")) == etl::to_string(INT8_MIN, str)); + CHECK(etl::u8string<20>(STR("-32768")) == etl::to_string(INT16_MIN, str)); + CHECK(etl::u8string<20>(STR("-2147483648")) == etl::to_string(INT32_MIN, str)); + CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str)); } //************************************************************************* @@ -75,25 +74,25 @@ namespace { etl::u8string<120> str; - CHECK(etl::u8string<120>(STR("0")) == etl::to_string(uint8_t(0), str, true)); - CHECK(etl::u8string<120>(STR("00")) == etl::to_string(uint16_t(0), str, true)); - CHECK(etl::u8string<120>(STR("000")) == etl::to_string(uint32_t(0), str, true)); - CHECK(etl::u8string<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true)); + CHECK(etl::u8string<120>(STR("0")) == etl::to_string(uint8_t(0), str, true)); + CHECK(etl::u8string<120>(STR("00")) == etl::to_string(uint16_t(0), str, true)); + CHECK(etl::u8string<120>(STR("000")) == etl::to_string(uint32_t(0), str, true)); + CHECK(etl::u8string<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true)); - CHECK(etl::u8string<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true)); - CHECK(etl::u8string<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true)); - CHECK(etl::u8string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); + CHECK(etl::u8string<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true)); + CHECK(etl::u8string<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true)); + CHECK(etl::u8string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::u8string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true)); - CHECK(etl::u8string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(INT8_MAX), str, true)); - CHECK(etl::u8string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(INT16_MAX), str, true)); - CHECK(etl::u8string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(INT32_MAX), str, true)); - CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, true)); + CHECK(etl::u8string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(INT8_MAX, str, true)); + CHECK(etl::u8string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(INT16_MAX, str, true)); + CHECK(etl::u8string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(INT32_MAX, str, true)); + CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(INT64_MAX, str, true)); - CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(INT8_MIN), str, true)); - CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(INT16_MIN), str, true)); - CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, true)); - CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, true)); + CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(INT8_MIN, str, true)); + CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(INT16_MIN, str, true)); + CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(INT32_MIN, str, true)); + CHECK(etl::u8string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(INT64_MIN, str, true)); } //************************************************************************* @@ -103,7 +102,7 @@ namespace Format format = Format().base(10).width(20).fill(STR('#')); - CHECK(etl::u8string<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format)); + CHECK(etl::u8string<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format)); CHECK(etl::u8string<20>(STR("###################0")) == etl::to_string(uint16_t(0), str, format)); CHECK(etl::u8string<20>(STR("###################0")) == etl::to_string(uint32_t(0), str, format)); CHECK(etl::u8string<20>(STR("###################0")) == etl::to_string(uint64_t(0), str, format)); @@ -113,15 +112,15 @@ namespace CHECK(etl::u8string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u8string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u8string<20>(STR("#################127")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u8string<20>(STR("###############32767")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u8string<20>(STR("##########2147483647")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u8string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u8string<20>(STR("#################127")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u8string<20>(STR("###############32767")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u8string<20>(STR("##########2147483647")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u8string<20>(STR("#9223372036854775807")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u8string<20>(STR("################-128")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u8string<20>(STR("##############-32768")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u8string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u8string<20>(STR("################-128")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u8string<20>(STR("##############-32768")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u8string<20>(STR("#########-2147483648")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -131,7 +130,7 @@ namespace Format format = Format().base(10).width(20).fill(STR('#')).left(); - CHECK(etl::u8string<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format)); + CHECK(etl::u8string<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format)); CHECK(etl::u8string<20>(STR("0###################")) == etl::to_string(uint16_t(0), str, format)); CHECK(etl::u8string<20>(STR("0###################")) == etl::to_string(uint32_t(0), str, format)); CHECK(etl::u8string<20>(STR("0###################")) == etl::to_string(uint64_t(0), str, format)); @@ -141,15 +140,15 @@ namespace CHECK(etl::u8string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u8string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::u8string<20>(STR("127#################")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::u8string<20>(STR("32767###############")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::u8string<20>(STR("2147483647##########")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::u8string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::u8string<20>(STR("127#################")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::u8string<20>(STR("32767###############")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::u8string<20>(STR("2147483647##########")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::u8string<20>(STR("9223372036854775807#")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::u8string<20>(STR("-128################")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::u8string<20>(STR("-32768##############")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::u8string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::u8string<20>(STR("-128################")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::u8string<20>(STR("-32768##############")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::u8string<20>(STR("-2147483648#########")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::u8string<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -157,25 +156,25 @@ namespace { etl::u8string<64> str; - CHECK(etl::u8string<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("01111111")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("0111111111111111")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("01111111")) == etl::to_string(INT8_MAX, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("0111111111111111")) == etl::to_string(INT16_MAX, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("01111111111111111111111111111111")) == etl::to_string(INT32_MAX, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(INT64_MAX, str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("10000000")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("1000000000000000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::u8string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("10000000")) == etl::to_string(INT8_MIN, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("1000000000000000")) == etl::to_string(INT16_MIN, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("10000000000000000000000000000000")) == etl::to_string(INT32_MIN, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::u8string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(2).width(64).fill(STR('0')))); } //************************************************************************* @@ -183,25 +182,25 @@ namespace { etl::u8string<22> str; - CHECK(etl::u8string<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u8string<22>(STR("0000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u8string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("177")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("077777")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("17777777777")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("177")) == etl::to_string(INT8_MAX, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("077777")) == etl::to_string(INT16_MAX, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("17777777777")) == etl::to_string(INT32_MAX, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("0777777777777777777777")) == etl::to_string(INT64_MAX, str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("200")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("100000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("20000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::u8string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("200")) == etl::to_string(INT8_MIN, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("100000")) == etl::to_string(INT16_MIN, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("20000000000")) == etl::to_string(INT32_MIN, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::u8string<22>(STR("1000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(8).width(22).fill(STR('0')))); } //************************************************************************* @@ -209,25 +208,25 @@ namespace { etl::u8string<16> str; - CHECK(etl::u8string<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u8string<16>(STR("0000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u8string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("7f")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("7fff")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("7fffffff")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("7f")) == etl::to_string(INT8_MAX, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("7fff")) == etl::to_string(INT16_MAX, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("7fffffff")) == etl::to_string(INT32_MAX, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("7fffffffffffffff")) == etl::to_string(INT64_MAX, str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("80")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("8000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("80000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::u8string<16>(STR("8000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("80")) == etl::to_string(INT8_MIN, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("8000")) == etl::to_string(INT16_MIN, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("80000000")) == etl::to_string(INT32_MIN, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::u8string<16>(STR("8000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(16).width(16).fill(STR('0')))); } //************************************************************************* @@ -235,10 +234,10 @@ namespace { etl::u8string<17> str; - CHECK(etl::u8string<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary())); - CHECK(etl::u8string<17>(STR("361100")) == etl::to_string(123456, str, Format().octal())); - CHECK(etl::u8string<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal())); - CHECK(etl::u8string<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex())); + CHECK(etl::u8string<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary())); + CHECK(etl::u8string<17>(STR("361100")) == etl::to_string(123456, str, Format().octal())); + CHECK(etl::u8string<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal())); + CHECK(etl::u8string<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex())); } //************************************************************************* @@ -295,15 +294,15 @@ namespace etl::u8string<20> str; CHECK(etl::u8string<20>(STR("0.00001")) == etl::to_string(0.000009, str, Format().precision(5).width(7).right())); - CHECK(etl::u8string<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right())); - CHECK(etl::u8string<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right())); - CHECK(etl::u8string<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right())); - CHECK(etl::u8string<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right())); - CHECK(etl::u8string<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right())); - CHECK(etl::u8string<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right())); - CHECK(etl::u8string<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right())); - CHECK(etl::u8string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right())); - CHECK(etl::u8string<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right())); + CHECK(etl::u8string<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right())); + CHECK(etl::u8string<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right())); + CHECK(etl::u8string<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right())); + CHECK(etl::u8string<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right())); + CHECK(etl::u8string<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right())); + CHECK(etl::u8string<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right())); + CHECK(etl::u8string<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right())); + CHECK(etl::u8string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right())); + CHECK(etl::u8string<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right())); } //************************************************************************* diff --git a/test/test_to_wstring.cpp b/test/test_to_wstring.cpp index 6e6b80aa..ca97b3b4 100644 --- a/test/test_to_wstring.cpp +++ b/test/test_to_wstring.cpp @@ -60,15 +60,15 @@ namespace CHECK(etl::wstring<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::wstring<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str)); - CHECK(etl::wstring<20>(STR("127")) == etl::to_string(int8_t(INT8_MAX), str)); - CHECK(etl::wstring<20>(STR("32767")) == etl::to_string(int16_t(INT16_MAX), str)); - CHECK(etl::wstring<20>(STR("2147483647")) == etl::to_string(int32_t(INT32_MAX), str)); - CHECK(etl::wstring<20>(STR("9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str)); + CHECK(etl::wstring<20>(STR("127")) == etl::to_string(INT8_MAX, str)); + CHECK(etl::wstring<20>(STR("32767")) == etl::to_string(INT16_MAX, str)); + CHECK(etl::wstring<20>(STR("2147483647")) == etl::to_string(INT32_MAX, str)); + CHECK(etl::wstring<20>(STR("9223372036854775807")) == etl::to_string(INT64_MAX, str)); - CHECK(etl::wstring<20>(STR("-128")) == etl::to_string(int8_t(INT8_MIN), str)); - CHECK(etl::wstring<20>(STR("-32768")) == etl::to_string(int16_t(INT16_MIN), str)); - CHECK(etl::wstring<20>(STR("-2147483648")) == etl::to_string(int32_t(INT32_MIN), str)); - CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str)); + CHECK(etl::wstring<20>(STR("-128")) == etl::to_string(INT8_MIN, str)); + CHECK(etl::wstring<20>(STR("-32768")) == etl::to_string(INT16_MIN, str)); + CHECK(etl::wstring<20>(STR("-2147483648")) == etl::to_string(INT32_MIN, str)); + CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str)); } //************************************************************************* @@ -86,15 +86,15 @@ namespace CHECK(etl::wstring<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true)); - CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(INT8_MAX), str, true)); - CHECK(etl::wstring<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(INT16_MAX), str, true)); - CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(INT32_MAX), str, true)); - CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, true)); + CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(INT8_MAX, str, true)); + CHECK(etl::wstring<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(INT16_MAX, str, true)); + CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(INT32_MAX, str, true)); + CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(INT64_MAX, str, true)); - CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(INT8_MIN), str, true)); - CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(INT16_MIN), str, true)); - CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, true)); - CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, true)); + CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(INT8_MIN, str, true)); + CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(INT16_MIN, str, true)); + CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(INT32_MIN, str, true)); + CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(INT64_MIN, str, true)); } //************************************************************************* @@ -114,15 +114,15 @@ namespace CHECK(etl::wstring<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::wstring<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::wstring<20>(STR("#################127")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::wstring<20>(STR("###############32767")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::wstring<20>(STR("##########2147483647")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::wstring<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::wstring<20>(STR("#################127")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::wstring<20>(STR("###############32767")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::wstring<20>(STR("##########2147483647")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::wstring<20>(STR("#9223372036854775807")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::wstring<20>(STR("################-128")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::wstring<20>(STR("##############-32768")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::wstring<20>(STR("#########-2147483648")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::wstring<20>(STR("################-128")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::wstring<20>(STR("##############-32768")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::wstring<20>(STR("#########-2147483648")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -142,15 +142,15 @@ namespace CHECK(etl::wstring<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::wstring<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format)); - CHECK(etl::wstring<20>(STR("127#################")) == etl::to_string(int8_t(INT8_MAX), str, format)); - CHECK(etl::wstring<20>(STR("32767###############")) == etl::to_string(int16_t(INT16_MAX), str, format)); - CHECK(etl::wstring<20>(STR("2147483647##########")) == etl::to_string(int32_t(INT32_MAX), str, format)); - CHECK(etl::wstring<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(INT64_MAX), str, format)); + CHECK(etl::wstring<20>(STR("127#################")) == etl::to_string(INT8_MAX, str, format)); + CHECK(etl::wstring<20>(STR("32767###############")) == etl::to_string(INT16_MAX, str, format)); + CHECK(etl::wstring<20>(STR("2147483647##########")) == etl::to_string(INT32_MAX, str, format)); + CHECK(etl::wstring<20>(STR("9223372036854775807#")) == etl::to_string(INT64_MAX, str, format)); - CHECK(etl::wstring<20>(STR("-128################")) == etl::to_string(int8_t(INT8_MIN), str, format)); - CHECK(etl::wstring<20>(STR("-32768##############")) == etl::to_string(int16_t(INT16_MIN), str, format)); - CHECK(etl::wstring<20>(STR("-2147483648#########")) == etl::to_string(int32_t(INT32_MIN), str, format)); - CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(INT64_MIN), str, format)); + CHECK(etl::wstring<20>(STR("-128################")) == etl::to_string(INT8_MIN, str, format)); + CHECK(etl::wstring<20>(STR("-32768##############")) == etl::to_string(INT16_MIN, str, format)); + CHECK(etl::wstring<20>(STR("-2147483648#########")) == etl::to_string(INT32_MIN, str, format)); + CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(INT64_MIN, str, format)); } //************************************************************************* @@ -168,15 +168,15 @@ namespace CHECK(etl::wstring<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("01111111")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("0111111111111111")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("01111111")) == etl::to_string(INT8_MAX, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("0111111111111111")) == etl::to_string(INT16_MAX, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("01111111111111111111111111111111")) == etl::to_string(INT32_MAX, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(INT64_MAX, str, Format().base(2).width(64).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("10000000")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(2).width(8).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("1000000000000000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(2).width(16).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(2).width(32).fill(STR('0')))); - CHECK(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(2).width(64).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("10000000")) == etl::to_string(INT8_MIN, str, Format().base(2).width(8).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("1000000000000000")) == etl::to_string(INT16_MIN, str, Format().base(2).width(16).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("10000000000000000000000000000000")) == etl::to_string(INT32_MIN, str, Format().base(2).width(32).fill(STR('0')))); + CHECK(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(2).width(64).fill(STR('0')))); } //************************************************************************* @@ -194,15 +194,15 @@ namespace CHECK(etl::wstring<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::wstring<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("177")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("077777")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("17777777777")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("177")) == etl::to_string(INT8_MAX, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("077777")) == etl::to_string(INT16_MAX, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("17777777777")) == etl::to_string(INT32_MAX, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("0777777777777777777777")) == etl::to_string(INT64_MAX, str, Format().base(8).width(22).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("200")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(8).width(3).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("100000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(8).width(6).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("20000000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(8).width(11).fill(STR('0')))); - CHECK(etl::wstring<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(8).width(22).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("200")) == etl::to_string(INT8_MIN, str, Format().base(8).width(3).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("100000")) == etl::to_string(INT16_MIN, str, Format().base(8).width(6).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("20000000000")) == etl::to_string(INT32_MIN, str, Format().base(8).width(11).fill(STR('0')))); + CHECK(etl::wstring<22>(STR("1000000000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(8).width(22).fill(STR('0')))); } //************************************************************************* @@ -220,15 +220,15 @@ namespace CHECK(etl::wstring<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::wstring<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("7f")) == etl::to_string(int8_t(INT8_MAX), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("7fff")) == etl::to_string(int16_t(INT16_MAX), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("7fffffff")) == etl::to_string(int32_t(INT32_MAX), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(INT64_MAX), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("7f")) == etl::to_string(INT8_MAX, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("7fff")) == etl::to_string(INT16_MAX, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("7fffffff")) == etl::to_string(INT32_MAX, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("7fffffffffffffff")) == etl::to_string(INT64_MAX, str, Format().base(16).width(16).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("80")) == etl::to_string(int8_t(INT8_MIN), str, Format().base(16).width(2).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("8000")) == etl::to_string(int16_t(INT16_MIN), str, Format().base(16).width(4).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("80000000")) == etl::to_string(int32_t(INT32_MIN), str, Format().base(16).width(8).fill(STR('0')))); - CHECK(etl::wstring<16>(STR("8000000000000000")) == etl::to_string(int64_t(INT64_MIN), str, Format().base(16).width(16).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("80")) == etl::to_string(INT8_MIN, str, Format().base(16).width(2).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("8000")) == etl::to_string(INT16_MIN, str, Format().base(16).width(4).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("80000000")) == etl::to_string(INT32_MIN, str, Format().base(16).width(8).fill(STR('0')))); + CHECK(etl::wstring<16>(STR("8000000000000000")) == etl::to_string(INT64_MIN, str, Format().base(16).width(16).fill(STR('0')))); } //************************************************************************* diff --git a/test/test_type_lookup.cpp b/test/test_type_lookup.cpp index 7621ab5c..68a6d7d3 100644 --- a/test/test_type_lookup.cpp +++ b/test/test_type_lookup.cpp @@ -32,6 +32,8 @@ SOFTWARE. #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { //*********************************** @@ -425,3 +427,5 @@ namespace #endif }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_unaligned_type.cpp b/test/test_unaligned_type.cpp index 26b41697..3a161a3c 100644 --- a/test/test_unaligned_type.cpp +++ b/test/test_unaligned_type.cpp @@ -31,6 +31,8 @@ SOFTWARE. #include "etl/unaligned_type.h" #include "etl/integral_limits.h" +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { SUITE(test_unaligned_type) @@ -620,23 +622,23 @@ namespace CHECK_EQUAL(int(0x34), int(*itr)); ++itr; *itr = 0x12; - CHECK_EQUAL(int(0x12), int(*itr)); + CHECK_EQUAL(0x12, *itr); ++itr; CHECK(itr == test.end()); //******************************* citr = const_test.begin(); - CHECK_EQUAL(int(0x12), int(*citr)); + CHECK_EQUAL(0x12, *citr); ++citr; - CHECK_EQUAL(int(0x34), int(*citr)); + CHECK_EQUAL(0x34, *citr); ++citr; CHECK(citr == const_test.end()); //******************************* citr = const_test.cbegin(); - CHECK_EQUAL(int(0x12), int(*citr)); + CHECK_EQUAL(0x12, *citr); ++citr; - CHECK_EQUAL(int(0x34), int(*citr)); + CHECK_EQUAL(0x34, *citr); ++citr; CHECK(citr == const_test.cend()); } @@ -655,35 +657,35 @@ namespace //******************************* itr = test.rbegin(); - CHECK_EQUAL(int(0x34), int(*itr)); + CHECK_EQUAL(0x34, *itr); ++itr; - CHECK_EQUAL(int(0x12), int(*itr)); + CHECK_EQUAL(0x12, *itr); ++itr; CHECK(itr == test.rend()); //******************************* itr = test.rbegin(); *itr = 0x12; - CHECK_EQUAL(int(0x12), int(*itr)); + CHECK_EQUAL(0x12, *itr); ++itr; *itr = 0x34; - CHECK_EQUAL(int(0x34), int(*itr)); + CHECK_EQUAL(0x34, *itr); ++itr; CHECK(itr == test.rend()); //******************************* citr = const_test.rbegin(); - CHECK_EQUAL(int(0x34), int(*citr)); + CHECK_EQUAL(0x34, *citr); ++citr; - CHECK_EQUAL(int(0x12), int(*citr)); + CHECK_EQUAL(0x12, *citr); ++citr; CHECK(citr == const_test.rend()); //******************************* citr = const_test.crbegin(); - CHECK_EQUAL(int(0x34), int(*citr)); + CHECK_EQUAL(0x34, *citr); ++citr; - CHECK_EQUAL(int(0x12), int(*citr)); + CHECK_EQUAL(0x12, *citr); ++citr; CHECK(citr == const_test.crend()); } @@ -780,3 +782,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" diff --git a/test/test_unaligned_type_constexpr.cpp b/test/test_unaligned_type_constexpr.cpp index 13cb2234..b12e6ce6 100644 --- a/test/test_unaligned_type_constexpr.cpp +++ b/test/test_unaligned_type_constexpr.cpp @@ -33,6 +33,8 @@ SOFTWARE. #if ETL_USING_CPP14 +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { SUITE(test_unaligned_type_constexpr) @@ -641,4 +643,8 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" + #endif + + diff --git a/test/test_variant_legacy.cpp b/test/test_variant_legacy.cpp index 8dc9f103..afd36fa7 100644 --- a/test/test_variant_legacy.cpp +++ b/test/test_variant_legacy.cpp @@ -35,6 +35,8 @@ SOFTWARE. #include #include +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { // Test classes for polymorphic tests. @@ -690,9 +692,11 @@ namespace ui16 = variant8; CHECK_EQUAL(ui16, variant8.get()); +#include "etl/private/diagnostic_useless_cast_push.h" variant8 = int32_t(5); i32 = variant8; CHECK_EQUAL(i32, variant8.get()); +#include "etl/private/diagnostic_pop.h" variant8 = uint32_t(6); ui32 = variant8; @@ -931,3 +935,5 @@ namespace } }; } + +#include "etl/private/diagnostic_pop.h" \ No newline at end of file diff --git a/test/test_variant_variadic.cpp b/test/test_variant_variadic.cpp index fd6157b9..34e9178c 100644 --- a/test/test_variant_variadic.cpp +++ b/test/test_variant_variadic.cpp @@ -44,6 +44,8 @@ SOFTWARE. #include #endif +#include "etl/private/diagnostic_useless_cast_push.h" + namespace { // Test variant_etl types. @@ -1378,7 +1380,9 @@ namespace CHECK(etl::get_if(&variant_etl) == nullptr); CHECK(etl::get_if(&variant_etl) == nullptr); +#include "etl/private/diagnostic_useless_cast_push.h" variant_etl = int(2); +#include "etl/private/diagnostic_pop.h" CHECK(etl::get_if(&variant_etl) == nullptr); CHECK(etl::get_if(&variant_etl) != nullptr); CHECK(etl::get_if(&variant_etl) == nullptr); @@ -1593,7 +1597,7 @@ namespace //************************************************************************* TEST(test_get_if_by_type) { - int value; + int value = 0; etl::variant v(value); const etl::variant cv(value); @@ -1629,7 +1633,7 @@ namespace //************************************************************************* TEST(test_get_if_by_index) { - int value; + int value = 0; etl::variant v(value); const etl::variant cv(value); @@ -1917,4 +1921,6 @@ namespace }; } +#include "etl/private/diagnostic_pop.h" + #endif diff --git a/test/test_vector_external_buffer.cpp b/test/test_vector_external_buffer.cpp index 595eccff..e1baf1cf 100644 --- a/test/test_vector_external_buffer.cpp +++ b/test/test_vector_external_buffer.cpp @@ -46,7 +46,7 @@ namespace int buffer4[SIZE]; int buffer5[SIZE]; - SUITE(test_vector) + SUITE(test_vector_external_buffer) { typedef etl::vector_ext Data; typedef etl::ivector IData; @@ -511,7 +511,7 @@ namespace Compare_Data compare_data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end(), buffer1, SIZE); - CHECK(data.front() == compare_data.front()); + CHECK_EQUAL(compare_data.front(), data.front()); } //************************************************************************* @@ -520,7 +520,7 @@ namespace const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end(), buffer1, SIZE); - CHECK(data.front() == compare_data.front()); + CHECK_EQUAL(compare_data.front(), data.front()); } //************************************************************************* @@ -529,7 +529,7 @@ namespace Compare_Data compare_data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end(), buffer1, SIZE); - CHECK(data.back() == compare_data.back()); + CHECK_EQUAL(compare_data.back(), data.back()); } //************************************************************************* @@ -538,7 +538,7 @@ namespace const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end(), buffer1, SIZE); - CHECK(data.back() == compare_data.back()); + CHECK_EQUAL(compare_data.back(), data.back()); } @@ -550,8 +550,8 @@ namespace Data data(compare_data.begin(), compare_data.end(), buffer1, SIZE); bool is_equal = std::equal(data.data(), - data.data() + data.size(), - compare_data.begin()); + data.data() + data.size(), + compare_data.begin()); CHECK(is_equal); } @@ -564,8 +564,8 @@ namespace const Data data(compare_data.begin(), compare_data.end(), buffer1, SIZE); bool is_equal = std::equal(data.data(), - data.data() + data.size(), - compare_data.begin()); + data.data() + data.size(), + compare_data.begin()); CHECK(is_equal); } diff --git a/test/test_vector_pointer_external_buffer.cpp b/test/test_vector_pointer_external_buffer.cpp index e029383c..975a8d7c 100644 --- a/test/test_vector_pointer_external_buffer.cpp +++ b/test/test_vector_pointer_external_buffer.cpp @@ -105,7 +105,7 @@ namespace { Data data(buffer1, SIZE); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -116,7 +116,7 @@ namespace { CData data(buffer1, SIZE); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); CHECK(data.empty()); CHECK_EQUAL(data.capacity(), SIZE); CHECK_EQUAL(data.max_size(), SIZE); @@ -1175,9 +1175,9 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { -#include "etl/private/diagnostic_array_bounds_push.h" const size_t INITIAL_SIZE = SIZE; int INITIAL_VALUE = 1; @@ -1194,8 +1194,8 @@ namespace offset = data.size(); CHECK_THROW(data.insert(data.begin() + offset, &INITIAL_VALUE), etl::vector_full); -#include "etl/private/diagnostic_pop.h" } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_emplace_position_value) @@ -1488,7 +1488,7 @@ namespace Data data(compare_data.begin(), compare_data.end(), buffer1, SIZE); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //************************************************************************* @@ -1499,7 +1499,7 @@ namespace CData data(compare_data.begin(), compare_data.end(), buffer1, SIZE); data.clear(); - CHECK_EQUAL(data.size(), size_t(0UL)); + CHECK_EQUAL(data.size(), 0UL); } //*************************************************************************