From 73308ede0061c04c2cf9f99f736fad71a48b44b6 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 12 Apr 2025 15:04:21 +0100 Subject: [PATCH] Made is_truncated available for all configurations --- include/etl/basic_string.h | 10 +- test/test_string_char.cpp | 711 +++++----- test/test_string_char_external_buffer.cpp | 819 ++++++------ test/test_string_u16.cpp | 1209 ++++++++--------- test/test_string_u16_external_buffer.cpp | 902 ++++++------- test/test_string_u32.cpp | 1225 +++++++++--------- test/test_string_u32_external_buffer.cpp | 902 ++++++------- test/test_string_u8.cpp | 1128 ++++++++-------- test/test_string_u8_external_buffer.cpp | 956 +++++++------- test/test_string_wchar_t.cpp | 1209 ++++++++--------- test/test_string_wchar_t_external_buffer.cpp | 883 ++++++------- 11 files changed, 4969 insertions(+), 4985 deletions(-) diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index c17bf933..0b0404b5 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -245,7 +245,6 @@ namespace etl return max_size() - size(); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS //************************************************************************* /// Returns whether the string was truncated by the last operation. /// Deprecated. Use is_truncated() @@ -254,7 +253,11 @@ namespace etl ETL_DEPRECATED bool truncated() const { +#if ETL_HAS_STRING_TRUNCATION_CHECKS return flags.test(); +#else + return false; +#endif } //************************************************************************* @@ -263,9 +266,14 @@ namespace etl //************************************************************************* bool is_truncated() const { +#if ETL_HAS_STRING_TRUNCATION_CHECKS return flags.test(); +#else + return false; +#endif } +#if ETL_HAS_STRING_TRUNCATION_CHECKS //************************************************************************* /// Clears the 'truncated' flag. //************************************************************************* diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index 55e1bdb3..a0789c1c 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/string.h" #include "etl/string_view.h" @@ -104,9 +105,7 @@ namespace CHECK_EQUAL(text.capacity(), SIZE); CHECK_EQUAL(text.max_size(), SIZE); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -118,9 +117,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -138,9 +135,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -150,7 +145,9 @@ namespace CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -165,9 +162,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -182,7 +177,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -197,9 +194,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -214,7 +209,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -229,9 +226,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -246,7 +241,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -259,9 +256,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -274,7 +269,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -307,9 +304,7 @@ namespace Text text(initial_text.c_str()); Text text2(text); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -319,9 +314,7 @@ namespace IText& itext = text; Text text2(itext); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -332,7 +325,9 @@ namespace Text text2(textl); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -342,7 +337,7 @@ namespace Text text(longer_text.c_str()); Text text2(text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -357,9 +352,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -374,7 +367,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -387,9 +380,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -404,7 +395,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -419,10 +412,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -436,8 +427,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -455,10 +449,8 @@ namespace bool is_equal = Equal(text1, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text1.is_truncated()); - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -476,8 +468,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -494,10 +489,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -514,8 +507,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -528,9 +524,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -543,7 +537,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -557,9 +553,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), itext); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); -#endif } //************************************************************************* @@ -586,9 +580,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -622,9 +614,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -642,9 +632,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -658,7 +646,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -672,9 +662,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -694,9 +682,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -837,10 +823,7 @@ namespace bool is_equal = Equal(expected, text); CHECK(is_equal); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -850,9 +833,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -862,9 +843,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -873,9 +852,7 @@ namespace Text text; CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -885,9 +862,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -897,9 +872,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -908,9 +881,7 @@ namespace Text text; CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -924,9 +895,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -940,9 +909,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -956,10 +923,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -974,10 +938,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -988,9 +949,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1000,9 +959,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1012,9 +969,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1024,9 +979,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1041,9 +994,7 @@ namespace compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1058,9 +1009,7 @@ namespace compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1077,9 +1026,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1091,9 +1038,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1111,9 +1056,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1131,7 +1074,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1145,9 +1090,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1161,7 +1104,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1175,9 +1120,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1193,7 +1136,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1208,9 +1153,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1225,7 +1168,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1245,9 +1190,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1265,7 +1208,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1290,9 +1235,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1309,9 +1252,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1322,7 +1263,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1384,7 +1327,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1396,7 +1341,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1408,7 +1355,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1432,9 +1381,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1458,7 +1405,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1473,7 +1422,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1488,7 +1439,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1503,7 +1456,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1525,10 +1480,8 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); +# bool is_equal = Equal(compare_text, text); CHECK(is_equal); } @@ -1552,7 +1505,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1567,7 +1522,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1583,7 +1540,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1606,9 +1565,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1627,9 +1584,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1648,9 +1603,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1670,7 +1623,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1693,7 +1648,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1711,9 +1668,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1726,9 +1681,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1739,9 +1692,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1757,9 +1708,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1773,7 +1722,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1790,9 +1741,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1806,7 +1755,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1822,7 +1773,9 @@ namespace text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif //#include "etl/private/diagnostic_pop.h" } @@ -1840,7 +1793,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1854,7 +1807,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1872,7 +1827,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Partial string. @@ -1887,7 +1842,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1902,7 +1857,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1917,7 +1874,9 @@ namespace text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1935,7 +1894,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1949,7 +1908,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1967,7 +1928,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1981,7 +1942,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1999,7 +1962,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2014,7 +1977,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2032,7 +1997,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2046,7 +2011,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2060,7 +2025,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2074,7 +2041,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2088,7 +2057,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2102,7 +2071,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2116,7 +2087,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2134,7 +2107,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2148,7 +2121,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2162,7 +2135,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2176,7 +2151,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2190,7 +2167,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2204,7 +2181,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2218,7 +2197,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2236,7 +2217,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2250,7 +2231,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2264,7 +2247,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2278,7 +2261,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2296,7 +2281,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2310,7 +2295,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2324,7 +2311,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2338,7 +2325,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2356,7 +2345,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2370,7 +2359,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2384,7 +2373,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2398,7 +2389,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2412,7 +2405,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2426,7 +2419,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2440,7 +2433,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2454,7 +2449,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2472,7 +2469,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2486,7 +2483,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2500,7 +2497,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2514,7 +2513,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2528,7 +2529,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2542,7 +2543,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2556,7 +2557,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2570,7 +2573,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2588,7 +2593,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2602,7 +2607,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2616,7 +2621,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2630,7 +2637,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2644,7 +2653,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2658,7 +2667,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2672,7 +2681,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2686,7 +2697,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2704,7 +2717,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2718,7 +2731,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2732,7 +2747,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2746,7 +2761,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2764,7 +2781,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2778,7 +2795,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2792,7 +2809,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2806,7 +2825,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2820,7 +2841,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2834,7 +2855,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2848,7 +2869,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2862,7 +2885,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2880,7 +2905,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2896,7 +2921,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2912,7 +2939,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2928,7 +2955,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2948,7 +2977,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2962,7 +2991,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2976,7 +3005,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2990,7 +3021,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3004,7 +3037,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -3018,7 +3051,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3032,7 +3065,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3046,7 +3081,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3064,7 +3101,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3078,7 +3115,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3092,7 +3131,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3106,7 +3145,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3127,7 +3168,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3141,7 +3182,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3155,7 +3198,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3169,7 +3212,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3186,7 +3231,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3203,7 +3248,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3220,7 +3265,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3232,7 +3277,7 @@ namespace CHECK_EQUAL(text.size(), size_t(0)); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3245,7 +3290,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3258,7 +3303,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3271,7 +3316,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3284,7 +3329,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3479,7 +3524,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3499,7 +3544,7 @@ namespace CHECK_EQUAL(0U, length1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3520,7 +3565,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3546,7 +3591,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -5048,25 +5093,25 @@ namespace TEST_FIXTURE(SetupFixture, test_truncate_over_many_operations) { Text text(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5075,8 +5120,8 @@ namespace Text text1(short_text.c_str()); TextS text2(short_text.c_str()); - CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_FALSE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5091,7 +5136,7 @@ namespace Text text2(short_text.c_str()); CHECK(text1.is_truncated()); - CHECK(!text2.is_truncated()); + CHECK_FALSE(text2.is_truncated()); // Clear text but not the truncate flag. text1.erase(text1.begin(), text1.end()); @@ -5106,10 +5151,10 @@ namespace TEST_FIXTURE(SetupFixture, test_clear_truncated) { Text text(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5130,7 +5175,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5276,7 +5323,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5291,7 +5338,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5306,7 +5353,9 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } diff --git a/test/test_string_char_external_buffer.cpp b/test/test_string_char_external_buffer.cpp index a2593660..1e9e5e44 100644 --- a/test/test_string_char_external_buffer.cpp +++ b/test/test_string_char_external_buffer.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/string.h" #include "etl/string_view.h" @@ -116,9 +117,7 @@ namespace CHECK_EQUAL(SIZE, text.capacity()); CHECK_EQUAL(SIZE, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -132,9 +131,7 @@ namespace CHECK_EQUAL(length, text.capacity()); CHECK_EQUAL(length, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -147,9 +144,7 @@ namespace CHECK_EQUAL(etl::strlen(p_text), text.capacity()); CHECK_EQUAL(etl::strlen(p_text), text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -162,9 +157,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -177,9 +170,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -192,9 +183,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -213,9 +202,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -226,7 +213,9 @@ namespace CHECK_EQUAL(buffer.size() - 1, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -242,9 +231,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -260,7 +247,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -276,9 +265,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -294,7 +281,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -310,9 +299,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -328,7 +315,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -342,9 +331,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -358,7 +345,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -429,7 +418,9 @@ namespace Text text2(textl, buffer2.data(), buffer2.size()); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -443,7 +434,9 @@ namespace Text text2(text, buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -481,7 +474,9 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -497,9 +492,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -517,7 +510,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -535,10 +530,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -555,8 +548,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -601,8 +597,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -622,10 +621,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -645,8 +642,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -660,9 +660,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -676,7 +674,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -693,6 +693,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -709,6 +711,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -722,9 +726,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -765,9 +767,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -786,9 +786,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -803,7 +801,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -818,9 +818,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -841,9 +839,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -988,9 +984,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1001,9 +995,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1013,9 +1005,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1026,9 +1016,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1039,9 +1027,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1051,9 +1037,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1069,9 +1053,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1087,9 +1069,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1105,9 +1085,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1125,9 +1103,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1141,9 +1117,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1155,9 +1129,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1169,9 +1141,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1183,9 +1153,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1201,9 +1169,7 @@ namespace compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1219,9 +1185,7 @@ namespace compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1242,9 +1206,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1257,9 +1219,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); - #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - #endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1279,9 +1239,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1303,7 +1261,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1318,9 +1278,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1335,7 +1293,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1350,9 +1310,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1369,7 +1327,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1385,9 +1345,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1403,7 +1361,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1424,9 +1384,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1445,7 +1403,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1472,9 +1432,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1493,9 +1451,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1506,7 +1462,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1573,7 +1531,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1585,7 +1545,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1597,7 +1559,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1622,9 +1586,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1649,7 +1611,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1664,7 +1628,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1679,7 +1645,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1694,7 +1662,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1717,9 +1687,7 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1745,7 +1713,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1760,7 +1730,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1776,7 +1748,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1801,9 +1775,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1826,9 +1798,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1849,9 +1819,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1875,7 +1843,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1903,7 +1873,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1925,9 +1897,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1940,9 +1910,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1953,9 +1921,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1975,9 +1941,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1991,7 +1955,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2009,9 +1975,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2025,7 +1989,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2040,11 +2006,15 @@ namespace Text append(short_text.c_str(), buffers.data(), buffers.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" } @@ -2063,9 +2033,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(shorter_text.c_str()); @@ -2078,7 +2046,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2099,9 +2069,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Partial string. compare_text.assign(short_text.c_str()); @@ -2114,9 +2082,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2130,7 +2096,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2144,11 +2112,15 @@ namespace Text append(short_text.c_str(), buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2167,9 +2139,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2182,7 +2152,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2201,9 +2173,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2216,7 +2186,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2237,9 +2209,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2253,7 +2223,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2272,9 +2244,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); @@ -2286,9 +2256,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2301,7 +2269,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2315,7 +2285,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2328,9 +2300,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2343,7 +2313,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2357,7 +2329,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2375,10 +2349,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); @@ -2389,9 +2360,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2404,7 +2373,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2418,7 +2389,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2431,9 +2404,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2446,7 +2417,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2460,7 +2433,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2479,9 +2454,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2494,7 +2467,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2507,9 +2482,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2522,7 +2495,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2540,9 +2515,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2555,7 +2528,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2568,9 +2543,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2583,7 +2556,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2602,9 +2577,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2616,9 +2589,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2631,7 +2602,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2645,7 +2618,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2658,9 +2633,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2672,9 +2645,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2687,7 +2658,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2701,7 +2674,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2719,9 +2694,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2733,9 +2706,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2748,7 +2719,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2762,7 +2735,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2775,9 +2750,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2789,9 +2762,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2804,7 +2775,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2818,7 +2791,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2837,9 +2812,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2851,9 +2824,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2866,7 +2837,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2880,7 +2853,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2893,9 +2868,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2907,9 +2880,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2922,7 +2893,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2936,7 +2909,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2955,9 +2930,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2970,7 +2943,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2983,9 +2958,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2998,7 +2971,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3017,9 +2992,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3031,9 +3004,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3046,7 +3017,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3060,7 +3033,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3073,9 +3048,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3087,9 +3060,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3102,7 +3073,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3116,7 +3089,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3135,9 +3110,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3152,7 +3125,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3167,9 +3142,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3184,7 +3157,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3205,9 +3180,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3219,9 +3192,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3234,7 +3205,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3248,7 +3221,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3261,9 +3236,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3275,9 +3248,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3290,7 +3261,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3304,7 +3277,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3323,9 +3298,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3338,7 +3311,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3351,9 +3326,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3366,7 +3339,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3388,9 +3363,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3403,7 +3376,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3416,9 +3391,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3431,7 +3404,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3448,9 +3423,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3467,9 +3440,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3480,9 +3451,7 @@ namespace text.clear(); CHECK_EQUAL(text.size(), size_t(0)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3495,9 +3464,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3510,9 +3477,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3525,9 +3490,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3540,9 +3503,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3767,9 +3728,7 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, buffer1 + length1, @@ -3788,9 +3747,7 @@ namespace size_t length1 = text.copy(buffer1, 5, SIZE); CHECK_EQUAL(0U, length1); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3811,9 +3768,7 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, buffer1 + length1, @@ -3839,9 +3794,7 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, buffer1 + length1, @@ -5402,25 +5355,25 @@ namespace { TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5433,7 +5386,7 @@ namespace Text text2(short_text.c_str(), buffers.data(), buffers.size()); CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5467,10 +5420,10 @@ namespace { TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5493,7 +5446,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5652,9 +5607,7 @@ namespace std::fill(text.data(), text.data() + text.max_size(), STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size(), text.size()); } @@ -5668,9 +5621,7 @@ namespace std::fill(text.data(), text.data() + text.max_size() - 1, STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5685,7 +5636,9 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 01ee5cf8..d55c64b4 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u16string.h" @@ -97,7 +98,6 @@ namespace { SetupFixture() { - initial_text = STR("Hello World"); initial_text = STR("Hello World"); insert_text = STR("Insert"); less_text = STR("Hello Vorld"); @@ -119,9 +119,7 @@ namespace CHECK_EQUAL(text.capacity(), SIZE); CHECK_EQUAL(text.max_size(), SIZE); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -129,19 +127,17 @@ namespace { Text text; - CHECK(text.begin() == text.end()); - CHECK(text.cbegin() == text.cend()); - CHECK(text.rbegin() == text.rend()); + CHECK(text.begin() == text.end()); + CHECK(text.cbegin() == text.cend()); + CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text(INITIAL_SIZE, INITIAL_VALUE); @@ -153,9 +149,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -165,7 +159,9 @@ namespace CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -180,9 +176,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -197,7 +191,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -212,9 +208,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -229,7 +223,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -244,9 +240,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -261,7 +255,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -274,9 +270,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -289,7 +283,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -322,9 +318,7 @@ namespace Text text(initial_text.c_str()); Text text2(text); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -334,9 +328,7 @@ namespace IText& itext = text; Text text2(itext); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -347,7 +339,9 @@ namespace Text text2(textl); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -357,7 +351,7 @@ namespace Text text(longer_text.c_str()); Text text2(text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -372,9 +366,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -389,7 +381,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -402,24 +394,24 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list_excess) { TextSTD compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), - STR('W'), STR('o'), STR('r'), STR('l'), STR('d') }; + 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(' '), - STR('T'), STR('h'), STR('e'), STR('r'), STR('e') }; + STR('W'), STR('o'), STR('r'), STR('l'), STR('d'), STR(' '), + STR('T'), STR('h'), STR('e'), STR('r'), STR('e') }; bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -434,10 +426,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -451,8 +441,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -470,10 +463,8 @@ namespace bool is_equal = Equal(text1, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text1.is_truncated()); - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -491,8 +482,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -509,10 +503,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -529,8 +521,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -543,9 +538,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -558,7 +551,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -572,9 +567,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), itext); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); -#endif } //************************************************************************* @@ -601,9 +594,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -612,40 +603,39 @@ namespace Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; Text text(initial_text.c_str(), INITIAL_SIZE); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -656,46 +646,44 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -708,24 +696,22 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -739,35 +725,35 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.uninitialized_resize(NEW_SIZE); - CHECK_EQUAL(text.size(), SIZE); + CHECK_EQUAL(SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -780,7 +766,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* @@ -793,16 +779,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); @@ -817,17 +803,17 @@ namespace Text text(initial_text.c_str(), INITIAL_SIZE); // Overwrite from index 1 to one less than the new size and set to that size. - text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -851,10 +837,7 @@ namespace bool is_equal = Equal(expected, text); CHECK(is_equal); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -864,9 +847,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -876,9 +857,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -887,9 +866,7 @@ namespace Text text; CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -899,9 +876,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -911,9 +886,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -922,9 +895,7 @@ namespace Text text; CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -938,9 +909,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -954,9 +923,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -970,10 +937,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -988,10 +952,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1002,9 +963,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1014,9 +973,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1026,9 +983,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1038,9 +993,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1051,13 +1004,11 @@ namespace Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1068,13 +1019,11 @@ namespace const Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1091,9 +1040,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1105,9 +1052,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1125,9 +1070,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1145,7 +1088,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1159,9 +1104,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1175,7 +1118,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1189,9 +1134,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1207,7 +1150,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1222,9 +1167,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1239,14 +1182,16 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; @@ -1259,16 +1204,14 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value_excess) { const size_t INITIAL_SIZE = SIZE; - const size_t EXCESS_SIZE = SIZE + 1; + const size_t EXCESS_SIZE = SIZE + 1UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; compare_text.fill(INITIAL_VALUE); @@ -1279,7 +1222,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1304,9 +1249,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1323,9 +1266,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1336,7 +1277,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1362,10 +1305,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; @@ -1392,37 +1335,43 @@ namespace const value_t INITIAL_VALUE = STR('A'); - size_t offset = 2; - text.insert(text.begin() + offset, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, INITIAL_VALUE); - compare_text.erase(compare_text.end() - 1); + size_t offset = 2UL; + text.insert(text.cbegin() + offset, INITIAL_VALUE); + compare_text.insert(compare_text.cbegin() + offset, INITIAL_VALUE); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 0; - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1435,20 +1384,18 @@ namespace TextSTD compare_text; Text text; - const size_t INITIAL_SIZE = 5; - const size_t INSERT_SIZE = 3; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const size_t INSERT_SIZE = 3UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1461,63 +1408,71 @@ namespace TextSTD compare_text; Text text; - const size_t INSERT_SIZE = 4; - const value_t INSERT_VALUE = STR('A'); + const size_t INSERT_SIZE = 4UL; + const value_t INSERT_VALUE = STR('A'); - size_t offset = 0; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + size_t offset = 0UL; + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 2; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 4; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1527,22 +1482,20 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; - text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - text.insert(text.begin() + offset, insert_text.begin(), insert_text.end()); - compare_text.insert(compare_text.begin() + offset, insert_text.begin(), insert_text.end()); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + compare_text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + CHECK_FALSE(text.is_truncated()); +# bool is_equal = Equal(compare_text, text); CHECK(is_equal); } @@ -1551,22 +1504,24 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_excess) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text; Text text; - size_t offset = 0; + size_t offset = 0UL; compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1576,12 +1531,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1592,12 +1549,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1608,32 +1567,30 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_self) { - size_t length = TextL::MAX_SIZE / 2; + size_t length = TextL::MAX_SIZE / 2UL; - for (size_t offset = 10; offset < length; ++offset) + for (size_t offset = 10UL; offset < length; ++offset) { TextSTD compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextL text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - text.insert(text.begin() + offset, text.begin() + 5, text.begin() + 10); - compare_text.insert(compare_text.begin() + offset, compare_text.begin() + 5, compare_text.begin() + 10); + text.insert(text.cbegin() + offset, text.cbegin() + 5, text.cbegin() + 10); + compare_text.insert(compare_text.cbegin() + offset, compare_text.cbegin() + 5, compare_text.cbegin() + 10); bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1641,9 +1598,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1662,20 +1617,18 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_excess) { - for (size_t offset = 0; offset <= initial_text.size(); ++offset) + for (size_t offset = 0UL; offset <= initial_text.size(); ++offset) { - TextSTD compare_text(initial_text.begin(), initial_text.end()); - Text text(initial_text.begin(), initial_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(initial_text.cbegin(), initial_text.cend()); + Text text(initial_text.cbegin(), initial_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1684,7 +1637,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1692,13 +1647,13 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_from_truncated) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD 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()); - insert.append(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(longer_text.cbegin(), longer_text.cend()); + insert.erase(insert.cbegin(), insert.cend()); + insert.append(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1707,7 +1662,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1715,9 +1672,9 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(0, insert, 0, insert.size()); compare_text.insert(0, insert_text, 0, insert_text.size()); @@ -1725,12 +1682,10 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(2, insert, 2, insert.size() - 2); compare_text.insert(2, insert_text, 2, insert_text.size() - 2); @@ -1740,12 +1695,10 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(short_text.size(), insert, 0, insert.size()); compare_text.insert(short_text.size(), insert_text, 0, insert_text.size()); @@ -1753,9 +1706,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1771,9 +1722,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1787,7 +1736,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1804,9 +1755,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1820,14 +1769,16 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_truncated_string) { -#include "etl/private/diagnostic_array_bounds_push.h" + //#include "etl/private/diagnostic_array_bounds_push.h" Text text(short_text.c_str()); TextS append(short_text.c_str()); #if ETL_HAS_STRING_TRUNCATION_CHECKS @@ -1836,9 +1787,11 @@ namespace text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif -#include "etl/private/diagnostic_pop.h" + //#include "etl/private/diagnostic_pop.h" } //************************************************************************* @@ -1854,7 +1807,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1868,7 +1821,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1886,7 +1841,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Partial string. @@ -1901,7 +1856,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1916,7 +1871,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1931,7 +1888,9 @@ namespace text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1949,7 +1908,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1963,7 +1922,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1981,7 +1942,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1995,7 +1956,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2013,7 +1976,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2028,7 +1991,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2046,7 +2011,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2060,7 +2025,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2074,7 +2039,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2088,7 +2055,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2102,7 +2071,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2116,7 +2085,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2130,7 +2101,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2148,7 +2121,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2162,7 +2135,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2176,7 +2149,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2190,7 +2165,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2204,7 +2181,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2218,7 +2195,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2232,7 +2211,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2250,7 +2231,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2264,7 +2245,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2278,7 +2261,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2292,7 +2275,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2310,7 +2295,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2324,7 +2309,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2338,7 +2325,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2352,7 +2339,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2370,7 +2359,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2384,7 +2373,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2398,7 +2387,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2412,7 +2403,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2426,7 +2419,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2440,7 +2433,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2454,7 +2447,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2468,7 +2463,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2486,7 +2483,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2500,7 +2497,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2514,7 +2511,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2528,7 +2527,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2542,7 +2543,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2556,7 +2557,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2570,7 +2571,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2584,7 +2587,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2595,112 +2600,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace")); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace")); + text.replace(2, 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace")); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace")); + text.replace(2, 7, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2711,56 +2724,60 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2771,112 +2788,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace"), 5); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace"), 5); + text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace"), 5); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace"), 5); + text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2887,14 +2912,14 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2903,14 +2928,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2919,14 +2946,14 @@ 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, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2935,14 +2962,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2962,7 +2991,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2976,7 +3005,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2990,7 +3019,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3004,7 +3035,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3018,7 +3051,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -3032,7 +3065,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3046,7 +3079,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3060,7 +3095,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3078,7 +3115,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3092,7 +3129,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3106,7 +3145,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3120,7 +3159,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3141,7 +3182,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3155,7 +3196,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3169,7 +3212,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3183,7 +3226,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3200,7 +3245,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3217,7 +3262,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3234,7 +3279,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3246,7 +3291,7 @@ namespace CHECK_EQUAL(text.size(), size_t(0)); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3259,7 +3304,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3272,7 +3317,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3285,7 +3330,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3298,7 +3343,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3343,7 +3388,7 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less < initial) == (less_text < initial_text)); + CHECK((less < initial) == (less_text < initial_text)); CHECK((initial < less) == (initial_text < less_text)); const Text greater(greater_text.c_str()); @@ -3358,17 +3403,17 @@ namespace CHECK((initial < initial) == (initial_text < initial_text)); // String-Pointer Pointer-String - CHECK((less < pinitial_text) == (less_text < pinitial_text)); - CHECK((pinitial_text < less) == (pinitial_text < less_text)); + CHECK((less < pinitial_text) == (less_text < pinitial_text)); + CHECK((pinitial_text < less) == (pinitial_text < less_text)); - CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); - CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); + CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); + CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); - CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); - CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); + CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); + CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); - CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); - CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); + CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); + CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); } //************************************************************************* @@ -3378,8 +3423,8 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less <= initial) == (less_text <= initial_text)); - CHECK((initial <= less) == (initial_text <= less_text)); + CHECK((less <= initial) == (less_text <= initial_text)); + CHECK((initial <= less) == (initial_text <= less_text)); const Text greater(greater_text.c_str()); CHECK((greater <= initial) == (greater_text <= initial_text)); @@ -3393,17 +3438,17 @@ namespace CHECK((initial <= initial) == (initial_text <= initial_text)); // String-Pointer Pointer-String - CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); - CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); + CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); + CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); - CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); - CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); + CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); + CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); - CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); - CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); + CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); + CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); - CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); - CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); + CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); + CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); } //************************************************************************* @@ -3428,17 +3473,17 @@ namespace CHECK((initial > initial) == (initial_text > initial_text)); // String-Pointer Pointer-String - CHECK((less > pinitial_text) == (less_text > pinitial_text)); - CHECK((pinitial_text > less) == (pinitial_text > less_text)); + CHECK((less > pinitial_text) == (less_text > pinitial_text)); + CHECK((pinitial_text > less) == (pinitial_text > less_text)); - CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); - CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); + CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); + CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); - CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); - CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); + CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); + CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); - CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); - CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); + CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); + CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); } //************************************************************************* @@ -3448,8 +3493,8 @@ namespace const Text initial(initial_text.begin(), initial_text.end()); // String-String - CHECK((less >= initial) == (less_text >= initial_text)); - CHECK((initial >= less) == (initial_text >= less_text)); + CHECK((less >= initial) == (less_text >= initial_text)); + CHECK((initial >= less) == (initial_text >= less_text)); const Text greater(greater_text.begin(), greater_text.end()); CHECK((greater >= initial) == (greater_text >= initial_text)); @@ -3463,17 +3508,17 @@ namespace CHECK((initial >= initial) == (initial_text >= initial_text)); // String-Pointer Pointer-String - CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); - CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); + CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); + CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); - CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); - CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); + CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); + CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); - CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); - CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); + CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); + CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); - CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); - CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); + CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); + CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); } //************************************************************************* @@ -3493,7 +3538,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3513,7 +3558,7 @@ namespace CHECK_EQUAL(0U, length1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3534,7 +3579,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3560,7 +3605,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3580,8 +3625,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(compare_needle, position1); position2 = haystack.find(needle, position2); @@ -3640,8 +3685,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1); position2 = haystack.find(needle, position2); @@ -3654,7 +3699,7 @@ namespace position2 = haystack.find(needle, position2 + 1); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin); CHECK_EQUAL(TextL::npos, position2); } @@ -3669,8 +3714,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1, 3); position2 = haystack.find(needle, position2, 3); @@ -3683,7 +3728,7 @@ namespace position2 = haystack.find(needle, position2 + 1, 3); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin, 0, 3); CHECK_EQUAL(TextL::npos, position2); } @@ -3872,7 +3917,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); @@ -3898,7 +3943,7 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer_n) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); @@ -3923,12 +3968,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_c_position) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = TextSTD::npos; + etl::iu16string::size_type position1 = TextL::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(STR('e'), position1); @@ -5062,25 +5107,25 @@ namespace TEST_FIXTURE(SetupFixture, test_truncate_over_many_operations) { Text text(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5089,8 +5134,8 @@ namespace Text text1(short_text.c_str()); TextS text2(short_text.c_str()); - CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_FALSE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5105,7 +5150,7 @@ namespace Text text2(short_text.c_str()); CHECK(text1.is_truncated()); - CHECK(!text2.is_truncated()); + CHECK_FALSE(text2.is_truncated()); // Clear text but not the truncate flag. text1.erase(text1.begin(), text1.end()); @@ -5120,10 +5165,10 @@ namespace TEST_FIXTURE(SetupFixture, test_clear_truncated) { Text text(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5144,7 +5189,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5290,7 +5337,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5305,7 +5352,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5320,27 +5367,11 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - Text text1 = STR("Hello World"); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } diff --git a/test/test_string_u16_external_buffer.cpp b/test/test_string_u16_external_buffer.cpp index ab7223e7..fffa53c7 100644 --- a/test/test_string_u16_external_buffer.cpp +++ b/test/test_string_u16_external_buffer.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u16string.h" #include "etl/fnv_1.h" @@ -130,9 +131,7 @@ namespace CHECK_EQUAL(SIZE, text.capacity()); CHECK_EQUAL(SIZE, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -146,9 +145,7 @@ namespace CHECK_EQUAL(length, text.capacity()); CHECK_EQUAL(length, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -161,9 +158,7 @@ namespace CHECK_EQUAL(etl::strlen(p_text), text.capacity()); CHECK_EQUAL(etl::strlen(p_text), text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -176,9 +171,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -191,9 +184,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -206,9 +197,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -227,9 +216,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -240,7 +227,9 @@ namespace CHECK_EQUAL(buffer.size() - 1, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -256,9 +245,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -274,7 +261,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -290,9 +279,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -308,7 +295,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -324,9 +313,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -342,7 +329,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -356,9 +345,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -372,7 +359,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -443,7 +432,9 @@ namespace Text text2(textl, buffer2.data(), buffer2.size()); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -457,7 +448,9 @@ namespace Text text2(text, buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -495,7 +488,9 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -511,9 +506,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -531,7 +524,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -549,10 +544,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -569,8 +562,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -615,8 +611,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -636,10 +635,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -659,8 +656,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -674,9 +674,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -690,7 +688,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -707,6 +707,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -723,6 +725,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -736,9 +740,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -779,9 +781,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -800,9 +800,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -817,7 +815,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -832,9 +832,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -855,9 +853,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -933,6 +929,32 @@ namespace CHECK_EQUAL(text.size(), NEW_SIZE); } + //************************************************************************* + TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_up) + { + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; + + TextBuffer buffer{0}; + Text text(initial_text.c_str(), INITIAL_SIZE, buffer.data(), buffer.size()); + + // Overwrite from index 1 to one less than the new size and set to that size. + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } + + return i; + }); + + CHECK_EQUAL(NEW_SIZE - 1, text.size()); + CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); + } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_down) { @@ -944,16 +966,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -976,9 +998,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -989,9 +1009,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1001,9 +1019,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1014,9 +1030,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1027,9 +1041,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1039,9 +1051,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1057,9 +1067,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1075,9 +1083,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1093,9 +1099,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1113,9 +1117,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1129,9 +1131,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1143,9 +1143,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1157,9 +1155,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1171,9 +1167,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1185,13 +1179,11 @@ namespace Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1203,13 +1195,11 @@ namespace const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1230,9 +1220,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1245,9 +1233,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1267,9 +1253,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1291,7 +1275,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1306,9 +1292,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1323,7 +1307,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1338,9 +1324,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1357,7 +1341,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1373,9 +1359,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1391,7 +1375,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1412,9 +1398,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1433,7 +1417,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1460,9 +1446,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1481,9 +1465,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1494,7 +1476,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1561,7 +1545,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1573,7 +1559,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1585,7 +1573,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1610,9 +1600,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1637,7 +1625,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1652,7 +1642,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1667,7 +1659,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1682,7 +1676,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1705,9 +1701,7 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1733,7 +1727,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1748,7 +1744,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1764,7 +1762,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1789,9 +1789,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1814,9 +1812,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1837,9 +1833,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1863,7 +1857,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1891,7 +1887,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1913,9 +1911,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1928,9 +1924,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1941,9 +1935,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1963,9 +1955,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1979,7 +1969,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1997,9 +1989,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2013,7 +2003,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2028,11 +2020,15 @@ namespace Text append(short_text.c_str(), buffers.data(), buffers.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" } @@ -2051,9 +2047,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(shorter_text.c_str()); @@ -2066,7 +2060,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2087,9 +2083,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Partial string. compare_text.assign(short_text.c_str()); @@ -2102,9 +2096,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2118,7 +2110,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2132,11 +2126,15 @@ namespace Text append(short_text.c_str(), buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2155,9 +2153,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2170,7 +2166,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2189,9 +2187,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2204,7 +2200,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2225,9 +2223,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2241,7 +2237,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2260,9 +2258,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); @@ -2274,9 +2270,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2289,7 +2283,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2303,7 +2299,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2316,9 +2314,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2331,7 +2327,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2345,7 +2343,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2363,10 +2363,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); @@ -2377,9 +2374,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2392,7 +2387,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2406,7 +2403,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2419,9 +2418,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2434,7 +2431,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2448,7 +2447,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2467,9 +2468,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2482,7 +2481,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2495,9 +2496,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2510,7 +2509,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2528,9 +2529,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2543,7 +2542,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2556,9 +2557,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2571,7 +2570,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2590,9 +2591,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2604,9 +2603,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2619,7 +2616,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2633,7 +2632,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2646,9 +2647,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2660,9 +2659,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2675,7 +2672,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2689,7 +2688,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2707,9 +2708,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2721,9 +2720,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2736,7 +2733,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2750,7 +2749,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2763,9 +2764,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2777,9 +2776,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2792,7 +2789,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2806,7 +2805,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2825,9 +2826,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2839,9 +2838,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2854,7 +2851,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2868,7 +2867,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2881,9 +2882,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2895,9 +2894,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2910,7 +2907,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2924,7 +2923,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2943,9 +2944,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2958,7 +2957,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2971,9 +2972,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2986,7 +2985,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3005,9 +3006,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3019,9 +3018,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3034,7 +3031,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3048,7 +3047,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3061,9 +3062,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3075,9 +3074,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3090,7 +3087,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3104,7 +3103,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3123,9 +3124,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3140,7 +3139,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3155,9 +3156,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3172,7 +3171,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3193,9 +3194,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3207,9 +3206,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3222,7 +3219,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3236,7 +3235,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3249,9 +3250,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3263,9 +3262,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3278,7 +3275,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3292,7 +3291,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3311,9 +3312,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3326,7 +3325,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3339,9 +3340,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3354,7 +3353,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3376,9 +3377,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3391,7 +3390,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3404,9 +3405,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3419,7 +3418,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3436,9 +3437,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3455,9 +3454,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3468,9 +3465,7 @@ namespace text.clear(); CHECK_EQUAL(text.size(), size_t(0)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3483,9 +3478,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3498,9 +3491,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3513,9 +3504,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3528,9 +3517,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3755,13 +3742,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3776,9 +3761,7 @@ namespace size_t length1 = text.copy(buffer1, 5, SIZE); CHECK_EQUAL(0U, length1); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3799,13 +3782,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3827,13 +3808,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -5390,25 +5369,25 @@ namespace { TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5421,7 +5400,7 @@ namespace Text text2(short_text.c_str(), buffers.data(), buffers.size()); CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5455,10 +5434,10 @@ namespace { TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5481,7 +5460,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5640,9 +5621,7 @@ namespace std::fill(text.data(), text.data() + text.max_size(), STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size(), text.size()); } @@ -5656,9 +5635,7 @@ namespace std::fill(text.data(), text.data() + text.max_size() - 1, STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5673,28 +5650,11 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - TextBuffer buffer1{0}; - Text text1(STR("Hello World"), buffer1.data(), buffer1.size()); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 4f4c6cb0..0da7930e 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u32string.h" @@ -97,7 +98,6 @@ namespace { SetupFixture() { - initial_text = STR("Hello World"); initial_text = STR("Hello World"); insert_text = STR("Insert"); less_text = STR("Hello Vorld"); @@ -119,9 +119,7 @@ namespace CHECK_EQUAL(text.capacity(), SIZE); CHECK_EQUAL(text.max_size(), SIZE); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -129,19 +127,17 @@ namespace { Text text; - CHECK(text.begin() == text.end()); - CHECK(text.cbegin() == text.cend()); - CHECK(text.rbegin() == text.rend()); + CHECK(text.begin() == text.end()); + CHECK(text.cbegin() == text.cend()); + CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text(INITIAL_SIZE, INITIAL_VALUE); @@ -153,9 +149,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -165,7 +159,9 @@ namespace CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -180,9 +176,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -197,7 +191,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -212,9 +208,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -229,7 +223,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -244,9 +240,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -261,7 +255,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -274,9 +270,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -289,7 +283,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -322,9 +318,7 @@ namespace Text text(initial_text.c_str()); Text text2(text); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -334,9 +328,7 @@ namespace IText& itext = text; Text text2(itext); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -347,7 +339,9 @@ namespace Text text2(textl); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -357,7 +351,7 @@ namespace Text text(longer_text.c_str()); Text text2(text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -372,9 +366,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -389,7 +381,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -402,9 +394,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -419,7 +409,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -434,10 +426,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -451,8 +441,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -470,10 +463,8 @@ namespace bool is_equal = Equal(text1, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text1.is_truncated()); - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -491,8 +482,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -509,10 +503,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -529,8 +521,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -543,9 +538,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -558,7 +551,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -572,9 +567,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), itext); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); -#endif } //************************************************************************* @@ -601,9 +594,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -612,40 +603,39 @@ namespace Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; Text text(initial_text.c_str(), INITIAL_SIZE); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -656,46 +646,44 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -708,24 +696,22 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -739,35 +725,35 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.uninitialized_resize(NEW_SIZE); - CHECK_EQUAL(text.size(), SIZE); + CHECK_EQUAL(SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -780,7 +766,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* @@ -793,16 +779,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); @@ -817,17 +803,17 @@ namespace Text text(initial_text.c_str(), INITIAL_SIZE); // Overwrite from index 1 to one less than the new size and set to that size. - text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -851,10 +837,7 @@ namespace bool is_equal = Equal(expected, text); CHECK(is_equal); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -864,9 +847,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -876,9 +857,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -887,9 +866,7 @@ namespace Text text; CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -899,9 +876,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -911,9 +886,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -922,9 +895,7 @@ namespace Text text; CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -938,9 +909,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -954,9 +923,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -970,10 +937,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -988,10 +952,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1002,9 +963,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1014,9 +973,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1026,9 +983,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1038,9 +993,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1051,13 +1004,11 @@ namespace Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1068,13 +1019,11 @@ namespace const Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1091,9 +1040,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1105,9 +1052,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1125,9 +1070,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1145,7 +1088,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1159,9 +1104,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1175,7 +1118,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1189,9 +1134,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1207,7 +1150,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1222,9 +1167,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1239,14 +1182,16 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; @@ -1259,16 +1204,14 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value_excess) { const size_t INITIAL_SIZE = SIZE; - const size_t EXCESS_SIZE = SIZE + 1; + const size_t EXCESS_SIZE = SIZE + 1UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; compare_text.fill(INITIAL_VALUE); @@ -1279,7 +1222,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1304,9 +1249,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1323,9 +1266,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1336,7 +1277,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1362,10 +1305,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; @@ -1392,37 +1335,43 @@ namespace const value_t INITIAL_VALUE = STR('A'); - size_t offset = 2; - text.insert(text.begin() + offset, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, INITIAL_VALUE); - compare_text.erase(compare_text.end() - 1); + size_t offset = 2UL; + text.insert(text.cbegin() + offset, INITIAL_VALUE); + compare_text.insert(compare_text.cbegin() + offset, INITIAL_VALUE); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 0; - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1435,20 +1384,18 @@ namespace TextSTD compare_text; Text text; - const size_t INITIAL_SIZE = 5; - const size_t INSERT_SIZE = 3; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const size_t INSERT_SIZE = 3UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1461,63 +1408,71 @@ namespace TextSTD compare_text; Text text; - const size_t INSERT_SIZE = 4; - const value_t INSERT_VALUE = STR('A'); + const size_t INSERT_SIZE = 4UL; + const value_t INSERT_VALUE = STR('A'); - size_t offset = 0; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + size_t offset = 0UL; + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 2; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 4; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1527,22 +1482,20 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; - text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - text.insert(text.begin() + offset, insert_text.begin(), insert_text.end()); - compare_text.insert(compare_text.begin() + offset, insert_text.begin(), insert_text.end()); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + compare_text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + CHECK_FALSE(text.is_truncated()); +# bool is_equal = Equal(compare_text, text); CHECK(is_equal); } @@ -1551,22 +1504,24 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_excess) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text; Text text; - size_t offset = 0; + size_t offset = 0UL; compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1576,12 +1531,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1592,12 +1549,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1608,32 +1567,30 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_self) { - size_t length = TextL::MAX_SIZE / 2; + size_t length = TextL::MAX_SIZE / 2UL; - for (size_t offset = 10; offset < length; ++offset) + for (size_t offset = 10UL; offset < length; ++offset) { TextSTD compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextL text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - text.insert(text.begin() + offset, text.begin() + 5, text.begin() + 10); - compare_text.insert(compare_text.begin() + offset, compare_text.begin() + 5, compare_text.begin() + 10); + text.insert(text.cbegin() + offset, text.cbegin() + 5, text.cbegin() + 10); + compare_text.insert(compare_text.cbegin() + offset, compare_text.cbegin() + 5, compare_text.cbegin() + 10); bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1641,9 +1598,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1662,20 +1617,18 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_excess) { - for (size_t offset = 0; offset <= initial_text.size(); ++offset) + for (size_t offset = 0UL; offset <= initial_text.size(); ++offset) { - TextSTD compare_text(initial_text.begin(), initial_text.end()); - Text text(initial_text.begin(), initial_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(initial_text.cbegin(), initial_text.cend()); + Text text(initial_text.cbegin(), initial_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1684,7 +1637,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1692,13 +1647,13 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_from_truncated) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD 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()); - insert.append(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(longer_text.cbegin(), longer_text.cend()); + insert.erase(insert.cbegin(), insert.cend()); + insert.append(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1707,7 +1662,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1715,9 +1672,9 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(0, insert, 0, insert.size()); compare_text.insert(0, insert_text, 0, insert_text.size()); @@ -1725,12 +1682,10 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(2, insert, 2, insert.size() - 2); compare_text.insert(2, insert_text, 2, insert_text.size() - 2); @@ -1740,12 +1695,10 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(short_text.size(), insert, 0, insert.size()); compare_text.insert(short_text.size(), insert_text, 0, insert_text.size()); @@ -1753,9 +1706,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1771,9 +1722,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1787,7 +1736,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1804,9 +1755,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1820,14 +1769,16 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_truncated_string) { -#include "etl/private/diagnostic_array_bounds_push.h" + //#include "etl/private/diagnostic_array_bounds_push.h" Text text(short_text.c_str()); TextS append(short_text.c_str()); #if ETL_HAS_STRING_TRUNCATION_CHECKS @@ -1836,9 +1787,11 @@ namespace text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif -#include "etl/private/diagnostic_pop.h" + //#include "etl/private/diagnostic_pop.h" } //************************************************************************* @@ -1854,7 +1807,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1868,7 +1821,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1880,13 +1835,13 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0, std::u32string::npos); + compare_text.append(insert_text, 0, TextSTD::npos); text.append(append, 0, Text::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Partial string. @@ -1901,7 +1856,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1916,7 +1871,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1931,7 +1888,9 @@ namespace text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1949,7 +1908,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1963,7 +1922,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1981,7 +1942,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1995,7 +1956,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2013,7 +1976,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2028,7 +1991,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2046,7 +2011,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2060,7 +2025,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2074,7 +2039,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2088,7 +2055,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2102,7 +2071,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2116,7 +2085,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2130,7 +2101,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2148,7 +2121,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2162,7 +2135,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2176,7 +2149,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2190,7 +2165,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2204,7 +2181,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2218,7 +2195,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2232,7 +2211,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2250,7 +2231,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2264,7 +2245,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2278,7 +2261,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2292,7 +2275,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2310,7 +2295,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2324,7 +2309,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2338,7 +2325,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2352,7 +2339,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2370,7 +2359,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2384,7 +2373,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2398,7 +2387,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2412,7 +2403,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2426,7 +2419,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2440,7 +2433,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2454,7 +2447,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2468,7 +2463,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2486,7 +2483,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2500,7 +2497,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2514,7 +2511,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2528,7 +2527,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2542,7 +2543,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2556,7 +2557,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2570,7 +2571,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2584,7 +2587,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2595,112 +2600,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace")); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace")); + text.replace(2, 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace")); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace")); + text.replace(2, 7, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2711,56 +2724,60 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2771,112 +2788,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace"), 5); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace"), 5); + text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace"), 5); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace"), 5); + text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2887,14 +2912,14 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2903,14 +2928,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2919,14 +2946,14 @@ 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, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2935,14 +2962,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2962,7 +2991,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2976,7 +3005,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2990,7 +3019,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3004,7 +3035,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3018,7 +3051,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -3032,7 +3065,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3046,7 +3079,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3060,7 +3095,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3078,7 +3115,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3092,7 +3129,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3106,7 +3145,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3120,7 +3159,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3141,7 +3182,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3155,7 +3196,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3169,7 +3212,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3183,7 +3226,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3200,7 +3245,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3217,7 +3262,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3234,7 +3279,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3246,7 +3291,7 @@ namespace CHECK_EQUAL(text.size(), size_t(0)); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3259,7 +3304,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3272,7 +3317,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3285,7 +3330,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3298,7 +3343,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3343,7 +3388,7 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less < initial) == (less_text < initial_text)); + CHECK((less < initial) == (less_text < initial_text)); CHECK((initial < less) == (initial_text < less_text)); const Text greater(greater_text.c_str()); @@ -3358,17 +3403,17 @@ namespace CHECK((initial < initial) == (initial_text < initial_text)); // String-Pointer Pointer-String - CHECK((less < pinitial_text) == (less_text < pinitial_text)); - CHECK((pinitial_text < less) == (pinitial_text < less_text)); + CHECK((less < pinitial_text) == (less_text < pinitial_text)); + CHECK((pinitial_text < less) == (pinitial_text < less_text)); - CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); - CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); + CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); + CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); - CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); - CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); + CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); + CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); - CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); - CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); + CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); + CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); } //************************************************************************* @@ -3378,8 +3423,8 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less <= initial) == (less_text <= initial_text)); - CHECK((initial <= less) == (initial_text <= less_text)); + CHECK((less <= initial) == (less_text <= initial_text)); + CHECK((initial <= less) == (initial_text <= less_text)); const Text greater(greater_text.c_str()); CHECK((greater <= initial) == (greater_text <= initial_text)); @@ -3393,17 +3438,17 @@ namespace CHECK((initial <= initial) == (initial_text <= initial_text)); // String-Pointer Pointer-String - CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); - CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); + CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); + CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); - CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); - CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); + CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); + CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); - CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); - CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); + CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); + CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); - CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); - CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); + CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); + CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); } //************************************************************************* @@ -3428,17 +3473,17 @@ namespace CHECK((initial > initial) == (initial_text > initial_text)); // String-Pointer Pointer-String - CHECK((less > pinitial_text) == (less_text > pinitial_text)); - CHECK((pinitial_text > less) == (pinitial_text > less_text)); + CHECK((less > pinitial_text) == (less_text > pinitial_text)); + CHECK((pinitial_text > less) == (pinitial_text > less_text)); - CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); - CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); + CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); + CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); - CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); - CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); + CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); + CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); - CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); - CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); + CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); + CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); } //************************************************************************* @@ -3448,8 +3493,8 @@ namespace const Text initial(initial_text.begin(), initial_text.end()); // String-String - CHECK((less >= initial) == (less_text >= initial_text)); - CHECK((initial >= less) == (initial_text >= less_text)); + CHECK((less >= initial) == (less_text >= initial_text)); + CHECK((initial >= less) == (initial_text >= less_text)); const Text greater(greater_text.begin(), greater_text.end()); CHECK((greater >= initial) == (greater_text >= initial_text)); @@ -3463,17 +3508,17 @@ namespace CHECK((initial >= initial) == (initial_text >= initial_text)); // String-Pointer Pointer-String - CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); - CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); + CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); + CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); - CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); - CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); + CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); + CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); - CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); - CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); + CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); + CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); - CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); - CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); + CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); + CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); } //************************************************************************* @@ -3493,12 +3538,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3513,7 +3558,7 @@ namespace CHECK_EQUAL(0U, length1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3534,12 +3579,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3560,12 +3605,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3580,8 +3625,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(compare_needle, position1); position2 = haystack.find(needle, position2); @@ -3640,8 +3685,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1); position2 = haystack.find(needle, position2); @@ -3654,7 +3699,7 @@ namespace position2 = haystack.find(needle, position2 + 1); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin); CHECK_EQUAL(TextL::npos, position2); } @@ -3669,8 +3714,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1, 3); position2 = haystack.find(needle, position2, 3); @@ -3683,7 +3728,7 @@ namespace position2 = haystack.find(needle, position2 + 1, 3); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin, 0, 3); CHECK_EQUAL(TextL::npos, position2); } @@ -3825,7 +3870,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u32string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3853,7 +3898,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u32string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3872,14 +3917,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::u32string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1); @@ -3898,14 +3943,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer_n) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::u32string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1, 3); @@ -3923,12 +3968,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_c_position) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u32string::npos; + etl::iu32string::size_type position1 = TextL::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(STR('e'), position1); @@ -5062,25 +5107,25 @@ namespace TEST_FIXTURE(SetupFixture, test_truncate_over_many_operations) { Text text(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5089,8 +5134,8 @@ namespace Text text1(short_text.c_str()); TextS text2(short_text.c_str()); - CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_FALSE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5105,7 +5150,7 @@ namespace Text text2(short_text.c_str()); CHECK(text1.is_truncated()); - CHECK(!text2.is_truncated()); + CHECK_FALSE(text2.is_truncated()); // Clear text but not the truncate flag. text1.erase(text1.begin(), text1.end()); @@ -5120,10 +5165,10 @@ namespace TEST_FIXTURE(SetupFixture, test_clear_truncated) { Text text(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5144,7 +5189,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5290,7 +5337,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5305,7 +5352,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5320,27 +5367,11 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - Text text1 = STR("Hello World"); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } diff --git a/test/test_string_u32_external_buffer.cpp b/test/test_string_u32_external_buffer.cpp index 1187091f..3c02629c 100644 --- a/test/test_string_u32_external_buffer.cpp +++ b/test/test_string_u32_external_buffer.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u32string.h" #include "etl/fnv_1.h" @@ -130,9 +131,7 @@ namespace CHECK_EQUAL(SIZE, text.capacity()); CHECK_EQUAL(SIZE, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -146,9 +145,7 @@ namespace CHECK_EQUAL(length, text.capacity()); CHECK_EQUAL(length, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -161,9 +158,7 @@ namespace CHECK_EQUAL(etl::strlen(p_text), text.capacity()); CHECK_EQUAL(etl::strlen(p_text), text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -176,9 +171,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -191,9 +184,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -206,9 +197,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -227,9 +216,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -240,7 +227,9 @@ namespace CHECK_EQUAL(buffer.size() - 1, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -256,9 +245,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -274,7 +261,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -290,9 +279,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -308,7 +295,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -324,9 +313,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -342,7 +329,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -356,9 +345,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -372,7 +359,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -443,7 +432,9 @@ namespace Text text2(textl, buffer2.data(), buffer2.size()); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -457,7 +448,9 @@ namespace Text text2(text, buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -495,7 +488,9 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -511,9 +506,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -531,7 +524,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -549,10 +544,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -569,8 +562,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -615,8 +611,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -636,10 +635,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -659,8 +656,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -674,9 +674,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -690,7 +688,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -707,6 +707,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -723,6 +725,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -736,9 +740,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -779,9 +781,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -800,9 +800,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -817,7 +815,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -832,9 +832,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -855,9 +853,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -933,6 +929,32 @@ namespace CHECK_EQUAL(text.size(), NEW_SIZE); } + //************************************************************************* + TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_up) + { + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; + + TextBuffer buffer{0}; + Text text(initial_text.c_str(), INITIAL_SIZE, buffer.data(), buffer.size()); + + // Overwrite from index 1 to one less than the new size and set to that size. + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } + + return i; + }); + + CHECK_EQUAL(NEW_SIZE - 1, text.size()); + CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); + } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_down) { @@ -944,16 +966,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -976,9 +998,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -989,9 +1009,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1001,9 +1019,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1014,9 +1030,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1027,9 +1041,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1039,9 +1051,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1057,9 +1067,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1075,9 +1083,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1093,9 +1099,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1113,9 +1117,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1129,9 +1131,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1143,9 +1143,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1157,9 +1155,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1171,9 +1167,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1185,13 +1179,11 @@ namespace Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1203,13 +1195,11 @@ namespace const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1230,9 +1220,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1245,9 +1233,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1267,9 +1253,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1291,7 +1275,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1306,9 +1292,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1323,7 +1307,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1338,9 +1324,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1357,7 +1341,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1373,9 +1359,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1391,7 +1375,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1412,9 +1398,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1433,7 +1417,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1460,9 +1446,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1481,9 +1465,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1494,7 +1476,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1561,7 +1545,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1573,7 +1559,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1585,7 +1573,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1610,9 +1600,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1637,7 +1625,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1652,7 +1642,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1667,7 +1659,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1682,7 +1676,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1705,9 +1701,7 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1733,7 +1727,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1748,7 +1744,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1764,7 +1762,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1789,9 +1789,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1814,9 +1812,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1837,9 +1833,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1863,7 +1857,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1891,7 +1887,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1913,9 +1911,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1928,9 +1924,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1941,9 +1935,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1963,9 +1955,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1979,7 +1969,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1997,9 +1989,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2013,7 +2003,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2028,11 +2020,15 @@ namespace Text append(short_text.c_str(), buffers.data(), buffers.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" } @@ -2051,9 +2047,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(shorter_text.c_str()); @@ -2066,7 +2060,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2087,9 +2083,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Partial string. compare_text.assign(short_text.c_str()); @@ -2102,9 +2096,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2118,7 +2110,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2132,11 +2126,15 @@ namespace Text append(short_text.c_str(), buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2155,9 +2153,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2170,7 +2166,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2189,9 +2187,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2204,7 +2200,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2225,9 +2223,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2241,7 +2237,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2260,9 +2258,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); @@ -2274,9 +2270,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2289,7 +2283,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2303,7 +2299,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2316,9 +2314,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2331,7 +2327,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2345,7 +2343,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2363,10 +2363,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); @@ -2377,9 +2374,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2392,7 +2387,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2406,7 +2403,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2419,9 +2418,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2434,7 +2431,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2448,7 +2447,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2467,9 +2468,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2482,7 +2481,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2495,9 +2496,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2510,7 +2509,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2528,9 +2529,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2543,7 +2542,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2556,9 +2557,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2571,7 +2570,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2590,9 +2591,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2604,9 +2603,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2619,7 +2616,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2633,7 +2632,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2646,9 +2647,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2660,9 +2659,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2675,7 +2672,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2689,7 +2688,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2707,9 +2708,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2721,9 +2720,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2736,7 +2733,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2750,7 +2749,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2763,9 +2764,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2777,9 +2776,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2792,7 +2789,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2806,7 +2805,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2825,9 +2826,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2839,9 +2838,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2854,7 +2851,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2868,7 +2867,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2881,9 +2882,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2895,9 +2894,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2910,7 +2907,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2924,7 +2923,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2943,9 +2944,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2958,7 +2957,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2971,9 +2972,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2986,7 +2985,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3005,9 +3006,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3019,9 +3018,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3034,7 +3031,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3048,7 +3047,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3061,9 +3062,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3075,9 +3074,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3090,7 +3087,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3104,7 +3103,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3123,9 +3124,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3140,7 +3139,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3155,9 +3156,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3172,7 +3171,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3193,9 +3194,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3207,9 +3206,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3222,7 +3219,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3236,7 +3235,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3249,9 +3250,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3263,9 +3262,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3278,7 +3275,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3292,7 +3291,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3311,9 +3312,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3326,7 +3325,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3339,9 +3340,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3354,7 +3353,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3376,9 +3377,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3391,7 +3390,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3404,9 +3405,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3419,7 +3418,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3436,9 +3437,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3455,9 +3454,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3468,9 +3465,7 @@ namespace text.clear(); CHECK_EQUAL(text.size(), size_t(0)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3483,9 +3478,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3498,9 +3491,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3513,9 +3504,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3528,9 +3517,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3755,13 +3742,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3776,9 +3761,7 @@ namespace size_t length1 = text.copy(buffer1, 5, SIZE); CHECK_EQUAL(0U, length1); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3799,13 +3782,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3827,13 +3808,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -5390,25 +5369,25 @@ namespace { TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5421,7 +5400,7 @@ namespace Text text2(short_text.c_str(), buffers.data(), buffers.size()); CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5455,10 +5434,10 @@ namespace { TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5481,7 +5460,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5640,9 +5621,7 @@ namespace std::fill(text.data(), text.data() + text.max_size(), STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size(), text.size()); } @@ -5656,9 +5635,7 @@ namespace std::fill(text.data(), text.data() + text.max_size() - 1, STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5673,28 +5650,11 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - TextBuffer buffer1{0}; - Text text1(STR("Hello World"), buffer1.data(), buffer1.size()); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } diff --git a/test/test_string_u8.cpp b/test/test_string_u8.cpp index e105ed19..224d24c1 100644 --- a/test/test_string_u8.cpp +++ b/test/test_string_u8.cpp @@ -34,6 +34,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u8string.h" @@ -100,7 +101,6 @@ namespace { SetupFixture() { - initial_text = STR("Hello World"); initial_text = STR("Hello World"); insert_text = STR("Insert"); less_text = STR("Hello Vorld"); @@ -122,9 +122,7 @@ namespace CHECK_EQUAL(text.capacity(), SIZE); CHECK_EQUAL(text.max_size(), SIZE); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -132,19 +130,17 @@ namespace { Text text; - CHECK(text.begin() == text.end()); - CHECK(text.cbegin() == text.cend()); - CHECK(text.rbegin() == text.rend()); + CHECK(text.begin() == text.end()); + CHECK(text.cbegin() == text.cend()); + CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text(INITIAL_SIZE, INITIAL_VALUE); @@ -156,9 +152,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -168,7 +162,9 @@ namespace CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -183,9 +179,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -200,7 +194,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -215,9 +211,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -232,7 +226,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -247,9 +243,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -264,7 +258,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -277,9 +273,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -292,7 +286,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -325,9 +321,7 @@ namespace Text text(initial_text.c_str()); Text text2(text); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -337,9 +331,7 @@ namespace IText& itext = text; Text text2(itext); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -350,7 +342,9 @@ namespace Text text2(textl); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -360,7 +354,7 @@ namespace Text text(longer_text.c_str()); Text text2(text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -375,9 +369,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -392,7 +384,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -405,24 +397,24 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list_excess) { TextSTD compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '), - STR('W'), STR('o'), STR('r'), STR('l'), STR('d') }; + 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(' '), - STR('T'), STR('h'), STR('e'), STR('r'), STR('e') }; + STR('W'), STR('o'), STR('r'), STR('l'), STR('d'), STR(' '), + STR('T'), STR('h'), STR('e'), STR('r'), STR('e') }; bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -437,10 +429,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -454,8 +444,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -473,10 +466,8 @@ namespace bool is_equal = Equal(text1, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text1.is_truncated()); - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -494,8 +485,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -512,10 +506,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -532,8 +524,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -546,9 +541,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -561,7 +554,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -575,9 +570,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), itext); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); -#endif } //************************************************************************* @@ -604,9 +597,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -615,40 +606,39 @@ namespace Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; Text text(initial_text.c_str(), INITIAL_SIZE); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -659,46 +649,44 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -711,24 +699,22 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -742,35 +728,35 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.uninitialized_resize(NEW_SIZE); - CHECK_EQUAL(text.size(), SIZE); + CHECK_EQUAL(SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -783,7 +769,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* @@ -793,19 +779,19 @@ namespace const size_t NEW_SIZE = 8UL; Text text(initial_text.c_str(), INITIAL_SIZE); - + // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); @@ -820,17 +806,17 @@ namespace Text text(initial_text.c_str(), INITIAL_SIZE); // Overwrite from index 1 to one less than the new size and set to that size. - text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -854,10 +840,7 @@ namespace bool is_equal = Equal(expected, text); CHECK(is_equal); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -867,9 +850,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -879,9 +860,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -890,9 +869,7 @@ namespace Text text; CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -902,9 +879,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -914,9 +889,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -925,9 +898,7 @@ namespace Text text; CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -941,9 +912,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -957,9 +926,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -973,10 +940,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -991,10 +955,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1005,9 +966,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1017,9 +976,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1029,9 +986,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1041,9 +996,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1054,13 +1007,11 @@ namespace Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1071,13 +1022,11 @@ namespace const Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1094,9 +1043,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1108,9 +1055,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1128,9 +1073,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1148,7 +1091,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1162,9 +1107,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1178,7 +1121,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1192,9 +1137,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1210,7 +1153,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1225,9 +1170,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1242,14 +1185,16 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; @@ -1262,16 +1207,14 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value_excess) { const size_t INITIAL_SIZE = SIZE; - const size_t EXCESS_SIZE = SIZE + 1; + const size_t EXCESS_SIZE = SIZE + 1UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; compare_text.fill(INITIAL_VALUE); @@ -1282,7 +1225,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1307,9 +1252,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1326,9 +1269,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1339,7 +1280,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1365,10 +1308,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; @@ -1395,37 +1338,43 @@ namespace const value_t INITIAL_VALUE = STR('A'); - size_t offset = 2; - text.insert(text.begin() + offset, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, INITIAL_VALUE); - compare_text.erase(compare_text.end() - 1); + size_t offset = 2UL; + text.insert(text.cbegin() + offset, INITIAL_VALUE); + compare_text.insert(compare_text.cbegin() + offset, INITIAL_VALUE); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 0; - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1438,20 +1387,18 @@ namespace TextSTD compare_text; Text text; - const size_t INITIAL_SIZE = 5; - const size_t INSERT_SIZE = 3; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const size_t INSERT_SIZE = 3UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1464,63 +1411,71 @@ namespace TextSTD compare_text; Text text; - const size_t INSERT_SIZE = 4; - const value_t INSERT_VALUE = STR('A'); + const size_t INSERT_SIZE = 4UL; + const value_t INSERT_VALUE = STR('A'); - size_t offset = 0; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + size_t offset = 0UL; + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 2; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 4; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1530,22 +1485,20 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; - text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - text.insert(text.begin() + offset, insert_text.begin(), insert_text.end()); - compare_text.insert(compare_text.begin() + offset, insert_text.begin(), insert_text.end()); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + compare_text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + CHECK_FALSE(text.is_truncated()); +# bool is_equal = Equal(compare_text, text); CHECK(is_equal); } @@ -1554,22 +1507,24 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_excess) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text; Text text; - size_t offset = 0; + size_t offset = 0UL; compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1579,12 +1534,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1595,12 +1552,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1611,32 +1570,30 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_self) { - size_t length = TextL::MAX_SIZE / 2; + size_t length = TextL::MAX_SIZE / 2UL; - for (size_t offset = 10; offset < length; ++offset) + for (size_t offset = 10UL; offset < length; ++offset) { TextSTD compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextL text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - text.insert(text.begin() + offset, text.begin() + 5, text.begin() + 10); - compare_text.insert(compare_text.begin() + offset, compare_text.begin() + 5, compare_text.begin() + 10); + text.insert(text.cbegin() + offset, text.cbegin() + 5, text.cbegin() + 10); + compare_text.insert(compare_text.cbegin() + offset, compare_text.cbegin() + 5, compare_text.cbegin() + 10); bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1644,9 +1601,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1665,20 +1620,18 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_excess) { - for (size_t offset = 0; offset <= initial_text.size(); ++offset) + for (size_t offset = 0UL; offset <= initial_text.size(); ++offset) { - TextSTD compare_text(initial_text.begin(), initial_text.end()); - Text text(initial_text.begin(), initial_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(initial_text.cbegin(), initial_text.cend()); + Text text(initial_text.cbegin(), initial_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1687,7 +1640,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1695,13 +1650,13 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_from_truncated) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD 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()); - insert.append(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(longer_text.cbegin(), longer_text.cend()); + insert.erase(insert.cbegin(), insert.cend()); + insert.append(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1710,7 +1665,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1718,9 +1675,9 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(0, insert, 0, insert.size()); compare_text.insert(0, insert_text, 0, insert_text.size()); @@ -1728,12 +1685,10 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(2, insert, 2, insert.size() - 2); compare_text.insert(2, insert_text, 2, insert_text.size() - 2); @@ -1743,12 +1698,10 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(short_text.size(), insert, 0, insert.size()); compare_text.insert(short_text.size(), insert_text, 0, insert_text.size()); @@ -1756,9 +1709,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1774,9 +1725,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1790,7 +1739,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1807,9 +1758,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1823,14 +1772,16 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_truncated_string) { -#include "etl/private/diagnostic_array_bounds_push.h" + //#include "etl/private/diagnostic_array_bounds_push.h" Text text(short_text.c_str()); TextS append(short_text.c_str()); #if ETL_HAS_STRING_TRUNCATION_CHECKS @@ -1839,9 +1790,11 @@ namespace text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif -#include "etl/private/diagnostic_pop.h" + //#include "etl/private/diagnostic_pop.h" } //************************************************************************* @@ -1857,7 +1810,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1871,7 +1824,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1883,13 +1838,13 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0, std::u8string::npos); + compare_text.append(insert_text, 0, TextSTD::npos); text.append(append, 0, Text::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Partial string. @@ -1904,7 +1859,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1919,7 +1874,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1934,7 +1891,9 @@ namespace text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1952,7 +1911,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1966,7 +1925,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1984,7 +1945,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1998,7 +1959,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2016,7 +1979,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2031,7 +1994,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2049,7 +2014,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2063,7 +2028,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2077,7 +2042,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2091,7 +2058,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2105,7 +2074,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2119,7 +2088,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2133,7 +2104,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2151,7 +2124,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2165,7 +2138,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2179,7 +2152,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2193,7 +2168,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2207,7 +2184,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2221,7 +2198,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2235,7 +2214,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2253,7 +2234,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2267,7 +2248,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2281,7 +2264,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2295,7 +2278,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2313,7 +2298,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2327,7 +2312,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2341,7 +2328,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2355,7 +2342,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2373,7 +2362,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2387,7 +2376,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2401,7 +2390,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2415,7 +2406,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2429,7 +2422,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2443,7 +2436,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2457,7 +2450,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2471,7 +2466,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2489,7 +2486,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2503,7 +2500,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2517,7 +2514,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2531,7 +2530,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2545,7 +2546,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2559,7 +2560,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2573,7 +2574,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2587,7 +2590,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2605,7 +2610,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2619,7 +2624,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2633,7 +2638,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2647,7 +2654,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2661,7 +2670,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2675,7 +2684,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2689,7 +2698,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2703,7 +2714,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2721,7 +2734,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2735,7 +2748,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2749,7 +2764,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2763,7 +2778,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2781,7 +2798,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2795,7 +2812,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2809,7 +2826,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2823,7 +2842,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2837,7 +2858,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2851,7 +2872,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2865,7 +2886,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2879,7 +2902,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2897,7 +2922,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2913,7 +2938,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2929,7 +2956,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2945,7 +2972,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2965,7 +2994,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2979,7 +3008,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2993,7 +3022,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3007,7 +3038,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3021,7 +3054,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -3035,7 +3068,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3049,7 +3082,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3063,7 +3098,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3081,7 +3118,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3095,7 +3132,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3109,7 +3148,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3123,7 +3162,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3144,7 +3185,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3158,7 +3199,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3172,7 +3215,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3186,7 +3229,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3203,7 +3248,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3220,7 +3265,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3237,7 +3282,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3249,7 +3294,7 @@ namespace CHECK_EQUAL(text.size(), size_t(0)); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3262,7 +3307,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3275,7 +3320,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3288,7 +3333,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3301,7 +3346,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3346,7 +3391,7 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less < initial) == (less_text < initial_text)); + CHECK((less < initial) == (less_text < initial_text)); CHECK((initial < less) == (initial_text < less_text)); const Text greater(greater_text.c_str()); @@ -3361,17 +3406,17 @@ namespace CHECK((initial < initial) == (initial_text < initial_text)); // String-Pointer Pointer-String - CHECK((less < pinitial_text) == (less_text < pinitial_text)); - CHECK((pinitial_text < less) == (pinitial_text < less_text)); + CHECK((less < pinitial_text) == (less_text < pinitial_text)); + CHECK((pinitial_text < less) == (pinitial_text < less_text)); - CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); - CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); + CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); + CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); - CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); - CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); + CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); + CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); - CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); - CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); + CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); + CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); } //************************************************************************* @@ -3381,8 +3426,8 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less <= initial) == (less_text <= initial_text)); - CHECK((initial <= less) == (initial_text <= less_text)); + CHECK((less <= initial) == (less_text <= initial_text)); + CHECK((initial <= less) == (initial_text <= less_text)); const Text greater(greater_text.c_str()); CHECK((greater <= initial) == (greater_text <= initial_text)); @@ -3396,17 +3441,17 @@ namespace CHECK((initial <= initial) == (initial_text <= initial_text)); // String-Pointer Pointer-String - CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); - CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); + CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); + CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); - CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); - CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); + CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); + CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); - CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); - CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); + CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); + CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); - CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); - CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); + CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); + CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); } //************************************************************************* @@ -3431,17 +3476,17 @@ namespace CHECK((initial > initial) == (initial_text > initial_text)); // String-Pointer Pointer-String - CHECK((less > pinitial_text) == (less_text > pinitial_text)); - CHECK((pinitial_text > less) == (pinitial_text > less_text)); + CHECK((less > pinitial_text) == (less_text > pinitial_text)); + CHECK((pinitial_text > less) == (pinitial_text > less_text)); - CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); - CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); + CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); + CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); - CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); - CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); + CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); + CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); - CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); - CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); + CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); + CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); } //************************************************************************* @@ -3451,8 +3496,8 @@ namespace const Text initial(initial_text.begin(), initial_text.end()); // String-String - CHECK((less >= initial) == (less_text >= initial_text)); - CHECK((initial >= less) == (initial_text >= less_text)); + CHECK((less >= initial) == (less_text >= initial_text)); + CHECK((initial >= less) == (initial_text >= less_text)); const Text greater(greater_text.begin(), greater_text.end()); CHECK((greater >= initial) == (greater_text >= initial_text)); @@ -3466,17 +3511,17 @@ namespace CHECK((initial >= initial) == (initial_text >= initial_text)); // String-Pointer Pointer-String - CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); - CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); + CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); + CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); - CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); - CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); + CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); + CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); - CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); - CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); + CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); + CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); - CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); - CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); + CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); + CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); } //************************************************************************* @@ -3496,7 +3541,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3516,7 +3561,7 @@ namespace CHECK_EQUAL(0U, length1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3537,7 +3582,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3563,7 +3608,7 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, @@ -3583,8 +3628,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(compare_needle, position1); position2 = haystack.find(needle, position2); @@ -3643,8 +3688,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1); position2 = haystack.find(needle, position2); @@ -3657,7 +3702,7 @@ namespace position2 = haystack.find(needle, position2 + 1); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin); CHECK_EQUAL(TextL::npos, position2); } @@ -3672,8 +3717,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1, 3); position2 = haystack.find(needle, position2, 3); @@ -3686,7 +3731,7 @@ namespace position2 = haystack.find(needle, position2 + 1, 3); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin, 0, 3); CHECK_EQUAL(TextL::npos, position2); } @@ -3828,7 +3873,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u8string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3856,7 +3901,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u8string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3875,14 +3920,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::u8string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1); @@ -3901,14 +3946,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer_n) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::u8string::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1, 3); @@ -3926,12 +3971,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_c_position) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::u8string::npos; + etl::iu8string::size_type position1 = TextL::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(STR('e'), position1); @@ -5065,25 +5110,25 @@ namespace TEST_FIXTURE(SetupFixture, test_truncate_over_many_operations) { Text text(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5092,8 +5137,8 @@ namespace Text text1(short_text.c_str()); TextS text2(short_text.c_str()); - CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_FALSE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5108,7 +5153,7 @@ namespace Text text2(short_text.c_str()); CHECK(text1.is_truncated()); - CHECK(!text2.is_truncated()); + CHECK_FALSE(text2.is_truncated()); // Clear text but not the truncate flag. text1.erase(text1.begin(), text1.end()); @@ -5123,10 +5168,10 @@ namespace TEST_FIXTURE(SetupFixture, test_clear_truncated) { Text text(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5147,7 +5192,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5293,7 +5340,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5308,7 +5355,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5323,29 +5370,12 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - Text text1 = STR("Hello World"); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } - -#endif +#endif \ No newline at end of file diff --git a/test/test_string_u8_external_buffer.cpp b/test/test_string_u8_external_buffer.cpp index 1494e708..296ee669 100644 --- a/test/test_string_u8_external_buffer.cpp +++ b/test/test_string_u8_external_buffer.cpp @@ -34,6 +34,7 @@ SOFTWARE. #include #include #include +#include #include "etl/u8string.h" #include "etl/fnv_1.h" @@ -133,9 +134,7 @@ namespace CHECK_EQUAL(SIZE, text.capacity()); CHECK_EQUAL(SIZE, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -149,9 +148,7 @@ namespace CHECK_EQUAL(length, text.capacity()); CHECK_EQUAL(length, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -164,9 +161,7 @@ namespace CHECK_EQUAL(etl::strlen(p_text), text.capacity()); CHECK_EQUAL(etl::strlen(p_text), text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -179,9 +174,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -194,9 +187,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -209,9 +200,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -230,9 +219,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -243,7 +230,9 @@ namespace CHECK_EQUAL(buffer.size() - 1, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -259,9 +248,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -277,7 +264,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -293,9 +282,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -311,7 +298,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -327,9 +316,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -345,7 +332,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -359,9 +348,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -375,7 +362,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -446,7 +435,9 @@ namespace Text text2(textl, buffer2.data(), buffer2.size()); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -460,7 +451,9 @@ namespace Text text2(text, buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -498,7 +491,9 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -514,9 +509,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -534,7 +527,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -552,10 +547,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -572,8 +565,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -618,8 +614,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -639,10 +638,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -662,8 +659,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -677,9 +677,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -693,7 +691,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -710,6 +710,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -726,6 +728,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -739,9 +743,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -782,9 +784,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -803,9 +803,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -820,7 +818,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -835,9 +835,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -858,9 +856,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -947,16 +943,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); @@ -973,16 +969,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -1005,9 +1001,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1018,9 +1012,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1030,9 +1022,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1043,9 +1033,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1056,9 +1044,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1068,9 +1054,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1086,9 +1070,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1104,9 +1086,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1122,9 +1102,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1142,9 +1120,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1158,9 +1134,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1172,9 +1146,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1186,9 +1158,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1200,9 +1170,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1214,13 +1182,11 @@ namespace Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1232,13 +1198,11 @@ namespace const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1259,9 +1223,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1274,9 +1236,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1296,9 +1256,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1320,7 +1278,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1335,9 +1295,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1352,7 +1310,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1367,9 +1327,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1386,7 +1344,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1402,9 +1362,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1420,7 +1378,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1441,9 +1401,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1462,7 +1420,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1489,9 +1449,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1510,9 +1468,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1523,7 +1479,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1590,7 +1548,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1602,7 +1562,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1614,7 +1576,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1639,9 +1603,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1666,7 +1628,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1681,7 +1645,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1696,7 +1662,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1711,7 +1679,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1734,9 +1704,7 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1762,7 +1730,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1777,7 +1747,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1793,7 +1765,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1818,9 +1792,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1843,9 +1815,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1866,9 +1836,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1892,7 +1860,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1920,7 +1890,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1942,9 +1914,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1957,9 +1927,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1970,9 +1938,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1992,9 +1958,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2008,7 +1972,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2026,9 +1992,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2042,7 +2006,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2057,11 +2023,15 @@ namespace Text append(short_text.c_str(), buffers.data(), buffers.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" } @@ -2080,9 +2050,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(shorter_text.c_str()); @@ -2095,7 +2063,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2116,9 +2086,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Partial string. compare_text.assign(short_text.c_str()); @@ -2131,9 +2099,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2147,7 +2113,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2161,11 +2129,15 @@ namespace Text append(short_text.c_str(), buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2184,9 +2156,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2199,7 +2169,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2218,9 +2190,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2233,7 +2203,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2254,9 +2226,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2270,7 +2240,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2289,9 +2261,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); @@ -2303,9 +2273,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2318,7 +2286,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2332,7 +2302,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2345,9 +2317,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2360,7 +2330,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2374,7 +2346,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2392,10 +2366,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); @@ -2406,9 +2377,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2421,7 +2390,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2435,7 +2406,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2448,9 +2421,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2463,7 +2434,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2477,7 +2450,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2496,9 +2471,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2511,7 +2484,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2524,9 +2499,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2539,7 +2512,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2557,9 +2532,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2572,7 +2545,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2585,9 +2560,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2600,7 +2573,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2619,9 +2594,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2633,9 +2606,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2648,7 +2619,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2662,7 +2635,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2675,9 +2650,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2689,9 +2662,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2704,7 +2675,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2718,7 +2691,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2736,9 +2711,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2750,9 +2723,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2765,7 +2736,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2779,7 +2752,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2792,9 +2767,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2806,9 +2779,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2821,7 +2792,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2835,7 +2808,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2854,9 +2829,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2868,9 +2841,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2883,7 +2854,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2897,7 +2870,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2910,9 +2885,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2924,9 +2897,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2939,7 +2910,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2953,7 +2926,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2972,9 +2947,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2987,7 +2960,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3000,9 +2975,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3015,7 +2988,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3034,9 +3009,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3048,9 +3021,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3063,7 +3034,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3077,7 +3050,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3090,9 +3065,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3104,9 +3077,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3119,7 +3090,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3133,7 +3106,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3152,9 +3127,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3169,7 +3142,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3184,9 +3159,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3201,7 +3174,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3222,9 +3197,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3236,9 +3209,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3251,7 +3222,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3265,7 +3238,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3278,9 +3253,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3292,9 +3265,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3307,7 +3278,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3321,7 +3294,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3340,9 +3315,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3355,7 +3328,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3368,9 +3343,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3383,7 +3356,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3405,9 +3380,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3420,7 +3393,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3433,9 +3408,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3448,7 +3421,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3465,9 +3440,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3484,9 +3457,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3497,9 +3468,7 @@ namespace text.clear(); CHECK_EQUAL(text.size(), size_t(0)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3512,9 +3481,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3527,9 +3494,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3542,9 +3507,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3557,9 +3520,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3784,13 +3745,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3805,9 +3764,7 @@ namespace size_t length1 = text.copy(buffer1, 5, SIZE); CHECK_EQUAL(0U, length1); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3828,13 +3785,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3856,13 +3811,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3962,6 +3915,37 @@ namespace CHECK_EQUAL(IText::npos, position2); } + //************************************************************************* + TEST_FIXTURE(SetupFixture, test_find_char_pointer_n) + { + const value_t* the_haystack = STR("A haystack with a needle and another needle"); + + const value_t* needle = STR("needle"); + + TextSTD compare_haystack(the_haystack); + + TextBufferL buffer{0}; + Text haystack(the_haystack, buffer.data(), buffer.size()); + + size_t position1 = 0; + size_t position2 = 0; + + position1 = compare_haystack.find(needle, position1, 3); + position2 = haystack.find(needle, position2, 3); + CHECK_EQUAL(position1, position2); + + position1 = compare_haystack.find(needle, position1 + 1, 3); + position2 = haystack.find(needle, position2 + 1, 3); + CHECK_EQUAL(position1, position2); + + position2 = haystack.find(needle, position2 + 1, 3); + CHECK_EQUAL(IText::npos, position2); + + const value_t *pin = STR("pin"); + position2 = haystack.find(pin, 0, 3); + CHECK_EQUAL(IText::npos, position2); + } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_contains_string) { @@ -4107,37 +4091,6 @@ namespace CHECK_FALSE(haystack.ends_with(haystack[haystack.size() - 2])); } - //************************************************************************* - TEST_FIXTURE(SetupFixture, test_find_char_pointer_n) - { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); - - const value_t* needle = STR("needle"); - - TextSTD compare_haystack(the_haystack); - - TextBufferL buffer{0}; - Text haystack(the_haystack, buffer.data(), buffer.size()); - - size_t position1 = 0; - size_t position2 = 0; - - position1 = compare_haystack.find(needle, position1, 3); - position2 = haystack.find(needle, position2, 3); - CHECK_EQUAL(position1, position2); - - position1 = compare_haystack.find(needle, position1 + 1, 3); - position2 = haystack.find(needle, position2 + 1, 3); - CHECK_EQUAL(position1, position2); - - position2 = haystack.find(needle, position2 + 1, 3); - CHECK_EQUAL(IText::npos, position2); - - const value_t *pin = STR("pin"); - position2 = haystack.find(pin, 0, 3); - CHECK_EQUAL(IText::npos, position2); - } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_string) { @@ -5419,25 +5372,25 @@ namespace { TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5450,7 +5403,7 @@ namespace Text text2(short_text.c_str(), buffers.data(), buffers.size()); CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5484,10 +5437,10 @@ namespace { TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5510,7 +5463,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5669,9 +5624,7 @@ namespace std::fill(text.data(), text.data() + text.max_size(), STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size(), text.size()); } @@ -5685,9 +5638,7 @@ namespace std::fill(text.data(), text.data() + text.max_size() - 1, STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5702,29 +5653,12 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } - - //************************************************************************* -#if ETL_USING_STL - TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) - { - TextBuffer buffer1{0}; - Text text1(STR("Hello World"), buffer1.data(), buffer1.size()); - - std::basic_stringstream sstream; - - sstream << text1; - - TextSTD sstream_string = sstream.str(); - - View sstream_view(sstream_string.data(), sstream_string.size()); - - CHECK(text1 == sstream_view); - } -#endif }; } diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index d28ba6d6..1a2acec5 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/wstring.h" @@ -98,7 +99,6 @@ namespace { SetupFixture() { - initial_text = STR("Hello World"); initial_text = STR("Hello World"); insert_text = STR("Insert"); less_text = STR("Hello Vorld"); @@ -120,9 +120,7 @@ namespace CHECK_EQUAL(text.capacity(), SIZE); CHECK_EQUAL(text.max_size(), SIZE); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -130,19 +128,17 @@ namespace { Text text; - CHECK(text.begin() == text.end()); - CHECK(text.cbegin() == text.cend()); - CHECK(text.rbegin() == text.rend()); + CHECK(text.begin() == text.end()); + CHECK(text.cbegin() == text.cend()); + CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text(INITIAL_SIZE, INITIAL_VALUE); @@ -154,9 +150,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -166,7 +160,9 @@ namespace CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -181,9 +177,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -198,7 +192,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -213,9 +209,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -230,7 +224,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -245,9 +241,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -262,7 +256,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -275,9 +271,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -290,7 +284,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -323,9 +319,7 @@ namespace Text text(initial_text.c_str()); Text text2(text); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -335,9 +329,7 @@ namespace IText& itext = text; Text text2(itext); CHECK(text2 == text); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -348,7 +340,9 @@ namespace Text text2(textl); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -358,7 +352,7 @@ namespace Text text(longer_text.c_str()); Text text2(text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -373,9 +367,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -390,7 +382,7 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); #endif } @@ -403,9 +395,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -420,7 +410,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -435,10 +427,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -452,8 +442,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -471,10 +464,8 @@ namespace bool is_equal = Equal(text1, text2); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text1.is_truncated()); - CHECK(!text2.is_truncated()); -#endif + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); } //************************************************************************* @@ -492,8 +483,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -510,10 +504,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -530,8 +522,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -544,9 +539,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -559,7 +552,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -573,9 +568,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), itext); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); -#endif } //************************************************************************* @@ -602,9 +595,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -613,40 +604,39 @@ namespace Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[0], text.begin()); + CHECK_EQUAL(&text[0], text.begin()); CHECK_EQUAL(&constText[0], constText.begin()); } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { Text text(initial_text.c_str()); const Text constText(initial_text.c_str()); - CHECK_EQUAL(&text[initial_text.size()], text.end()); + CHECK_EQUAL(&text[initial_text.size()], text.end()); CHECK_EQUAL(&constText[initial_text.size()], constText.end()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; Text text(initial_text.c_str(), INITIAL_SIZE); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_up_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -657,46 +647,44 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; Text text(INITIAL_SIZE, STR('A')); text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_down_value) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); Text text(INITIAL_SIZE, INITIAL_VALUE); @@ -709,24 +697,22 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 8; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -740,35 +726,35 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_up_excess) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = SIZE + 1; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = SIZE + 1UL; Text text(INITIAL_SIZE, STR('A')); text.uninitialized_resize(NEW_SIZE); - CHECK_EQUAL(text.size(), SIZE); + CHECK_EQUAL(SIZE, text.size()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_uninitialized_resize_down) { - const size_t INITIAL_SIZE = 5; - const size_t NEW_SIZE = 2; + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 2UL; const value_t INITIAL_VALUE = STR('A'); const value_t FILL_VALUE = STR('B'); Text text(INITIAL_SIZE, INITIAL_VALUE); Text::pointer pbegin = &text.front(); - Text::pointer pend = &text.back() + 1; - Text::pointer pmax = pbegin + text.max_size(); + Text::pointer pend = &text.back() + 1; + Text::pointer pmax = pbegin + text.max_size(); // Fill free space with a pattern. std::fill(pend, pmax, FILL_VALUE); @@ -781,7 +767,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); - CHECK_EQUAL(text.size(), NEW_SIZE); + CHECK_EQUAL(NEW_SIZE, text.size()); } //************************************************************************* @@ -794,16 +780,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); @@ -818,17 +804,17 @@ namespace Text text(initial_text.c_str(), INITIAL_SIZE); // Overwrite from index 1 to one less than the new size and set to that size. - text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -852,10 +838,7 @@ namespace bool is_equal = Equal(expected, text); CHECK(is_equal); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -865,9 +848,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -877,9 +858,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -888,9 +867,7 @@ namespace Text text; CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -900,9 +877,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -912,9 +887,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -923,9 +896,7 @@ namespace Text text; CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -939,9 +910,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -955,9 +924,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -971,10 +938,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -989,10 +953,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1003,9 +964,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1015,9 +974,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1027,9 +984,7 @@ namespace Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1039,9 +994,7 @@ namespace const Text text(initial_text.c_str()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1052,13 +1005,11 @@ namespace Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1069,13 +1020,11 @@ namespace const Text text(compare_text.begin(), compare_text.end()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data_end(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1092,9 +1041,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1106,9 +1053,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1126,9 +1071,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1146,7 +1089,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1160,9 +1105,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1176,7 +1119,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1190,9 +1135,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1208,7 +1151,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1223,9 +1168,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1240,14 +1183,16 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; @@ -1260,16 +1205,14 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_assign_size_value_excess) { const size_t INITIAL_SIZE = SIZE; - const size_t EXCESS_SIZE = SIZE + 1; + const size_t EXCESS_SIZE = SIZE + 1UL; const value_t INITIAL_VALUE = STR('A'); std::array compare_text; compare_text.fill(INITIAL_VALUE); @@ -1280,7 +1223,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1305,9 +1250,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1324,9 +1267,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1337,7 +1278,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1363,10 +1306,10 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; @@ -1393,37 +1336,43 @@ namespace const value_t INITIAL_VALUE = STR('A'); - size_t offset = 2; - text.insert(text.begin() + offset, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, INITIAL_VALUE); - compare_text.erase(compare_text.end() - 1); + size_t offset = 2UL; + text.insert(text.cbegin() + offset, INITIAL_VALUE); + compare_text.insert(compare_text.cbegin() + offset, INITIAL_VALUE); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 0; - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - text.insert(text.begin() + offset, STR('A')); - compare_text.insert(compare_text.begin() + offset, STR('A')); - compare_text.erase(compare_text.end() - 1); + text.insert(text.cbegin() + offset, STR('A')); + compare_text.insert(compare_text.cbegin() + offset, STR('A')); + compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1436,20 +1385,18 @@ namespace TextSTD compare_text; Text text; - const size_t INITIAL_SIZE = 5; - const size_t INSERT_SIZE = 3; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const size_t INSERT_SIZE = 3UL; + const value_t INITIAL_VALUE = STR('A'); - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1462,63 +1409,71 @@ namespace TextSTD compare_text; Text text; - const size_t INSERT_SIZE = 4; - const value_t INSERT_VALUE = STR('A'); + const size_t INSERT_SIZE = 4UL; + const value_t INSERT_VALUE = STR('A'); - size_t offset = 0; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + size_t offset = 0UL; + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 2; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = 4; - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); CHECK(is_equal); offset = text.size(); - compare_text.assign(initial_text.begin(), initial_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INSERT_VALUE); - compare_text.erase(compare_text.end() - INSERT_SIZE, compare_text.end()); - text.assign(initial_text.begin(), initial_text.end()); - text.insert(text.begin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.assign(initial_text.cbegin(), initial_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); + compare_text.erase(compare_text.cend() - INSERT_SIZE, compare_text.cend()); + text.assign(initial_text.cbegin(), initial_text.cend()); + text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1528,22 +1483,20 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range) { - const size_t INITIAL_SIZE = 5; + const size_t INITIAL_SIZE = 5UL; - for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset) + for (size_t offset = 0UL; offset <= INITIAL_SIZE; ++offset) { TextSTD compare_text; Text text; - text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - compare_text.assign(initial_text.begin(), initial_text.begin() + INITIAL_SIZE); - text.insert(text.begin() + offset, insert_text.begin(), insert_text.end()); - compare_text.insert(compare_text.begin() + offset, insert_text.begin(), insert_text.end()); - -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + compare_text.assign(initial_text.cbegin(), initial_text.cbegin() + INITIAL_SIZE); + text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); + CHECK_FALSE(text.is_truncated()); +# bool is_equal = Equal(compare_text, text); CHECK(is_equal); } @@ -1552,22 +1505,24 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_excess) { - const size_t INITIAL_SIZE = 5; - const value_t INITIAL_VALUE = STR('A'); + const size_t INITIAL_SIZE = 5UL; + const value_t INITIAL_VALUE = STR('A'); TextSTD compare_text; Text text; - size_t offset = 0; + size_t offset = 0UL; compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1577,12 +1532,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1593,12 +1550,14 @@ namespace compare_text.assign(INITIAL_SIZE, INITIAL_VALUE); text.assign(INITIAL_SIZE, INITIAL_VALUE); - compare_text.insert(compare_text.begin() + offset, initial_text.begin(), initial_text.end()); + compare_text.insert(compare_text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); compare_text.resize(initial_text.size()); - text.insert(text.begin() + offset, initial_text.begin(), initial_text.end()); + text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1609,32 +1568,30 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_range_self) { - size_t length = TextL::MAX_SIZE / 2; + size_t length = TextL::MAX_SIZE / 2UL; - for (size_t offset = 10; offset < length; ++offset) + for (size_t offset = 10UL; offset < length; ++offset) { TextSTD compare_text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TextL text = STR("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - text.insert(text.begin() + offset, text.begin() + 5, text.begin() + 10); - compare_text.insert(compare_text.begin() + offset, compare_text.begin() + 5, compare_text.begin() + 10); + text.insert(text.cbegin() + offset, text.cbegin() + 5, text.cbegin() + 10); + compare_text.insert(compare_text.cbegin() + offset, compare_text.cbegin() + 5, compare_text.cbegin() + 10); bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1642,9 +1599,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1663,20 +1618,18 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_excess) { - for (size_t offset = 0; offset <= initial_text.size(); ++offset) + for (size_t offset = 0UL; offset <= initial_text.size(); ++offset) { - TextSTD compare_text(initial_text.begin(), initial_text.end()); - Text text(initial_text.begin(), initial_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(initial_text.cbegin(), initial_text.cend()); + Text text(initial_text.cbegin(), initial_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1685,7 +1638,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1693,13 +1648,13 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_from_truncated) { - for (size_t offset = 0; offset <= short_text.size(); ++offset) + for (size_t offset = 0UL; offset <= short_text.size(); ++offset) { - TextSTD 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()); - insert.append(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(longer_text.cbegin(), longer_text.cend()); + insert.erase(insert.cbegin(), insert.cend()); + insert.append(insert_text.cbegin(), insert_text.cend()); text.insert(offset, insert); compare_text.insert(offset, insert_text); @@ -1708,7 +1663,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1716,9 +1673,9 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_size_t_position_string_subpos_sunlen) { - TextSTD compare_text(short_text.begin(), short_text.end()); - Text text(short_text.begin(), short_text.end()); - Text insert(insert_text.begin(), insert_text.end()); + TextSTD compare_text(short_text.cbegin(), short_text.cend()); + Text text(short_text.cbegin(), short_text.cend()); + Text insert(insert_text.cbegin(), insert_text.cend()); text.insert(0, insert, 0, insert.size()); compare_text.insert(0, insert_text, 0, insert_text.size()); @@ -1726,12 +1683,10 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(2, insert, 2, insert.size() - 2); compare_text.insert(2, insert_text, 2, insert_text.size() - 2); @@ -1741,12 +1696,10 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); - compare_text.assign(short_text.begin(), short_text.end()); - text.assign(short_text.begin(), short_text.end()); + compare_text.assign(short_text.cbegin(), short_text.cend()); + text.assign(short_text.cbegin(), short_text.cend()); text.insert(short_text.size(), insert, 0, insert.size()); compare_text.insert(short_text.size(), insert_text, 0, insert_text.size()); @@ -1754,9 +1707,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1772,9 +1723,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1788,7 +1737,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1805,9 +1756,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1821,14 +1770,16 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } //************************************************************************* TEST_FIXTURE(SetupFixture, test_append_truncated_string) { -#include "etl/private/diagnostic_array_bounds_push.h" + //#include "etl/private/diagnostic_array_bounds_push.h" Text text(short_text.c_str()); TextS append(short_text.c_str()); #if ETL_HAS_STRING_TRUNCATION_CHECKS @@ -1837,9 +1788,11 @@ namespace text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif -#include "etl/private/diagnostic_pop.h" + //#include "etl/private/diagnostic_pop.h" } //************************************************************************* @@ -1855,7 +1808,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1869,7 +1822,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1881,13 +1836,13 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0, std::wstring::npos); + compare_text.append(insert_text, 0, TextSTD::npos); text.append(append, 0, Text::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Partial string. @@ -1902,7 +1857,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1917,7 +1872,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1932,7 +1889,9 @@ namespace text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1950,7 +1909,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1964,7 +1923,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1982,7 +1943,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -1996,7 +1957,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2014,7 +1977,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2029,7 +1992,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2047,7 +2012,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2061,7 +2026,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2075,7 +2040,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2089,7 +2056,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2103,7 +2072,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2117,7 +2086,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2131,7 +2102,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2149,7 +2122,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text. @@ -2163,7 +2136,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2177,7 +2150,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2191,7 +2166,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2205,7 +2182,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2219,7 +2196,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2233,7 +2212,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2251,7 +2232,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2265,7 +2246,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2279,7 +2262,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2293,7 +2276,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2311,7 +2296,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2325,7 +2310,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2339,7 +2326,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2353,7 +2340,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2371,7 +2360,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2385,7 +2374,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2399,7 +2388,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2413,7 +2404,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2427,7 +2420,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2441,7 +2434,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2455,7 +2448,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2469,7 +2464,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2487,7 +2484,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2501,7 +2498,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2515,7 +2512,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2529,7 +2528,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2543,7 +2544,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -2557,7 +2558,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -2571,7 +2572,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2585,7 +2588,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2596,112 +2601,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace")); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace")); + text.replace(2, 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace")); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace")); + text.replace(2, 7, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace")); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text")); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text")); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text")); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text")); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2712,56 +2725,60 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 4, TextL(STR("Replace")).c_str()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, STR("Replace")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace")); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str()); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace with some text")); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace with some text")).c_str()); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace with some text")); + 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2772,112 +2789,120 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace"), 5); + compare_text.replace(2, 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace"), 5); + text.replace(2, 4, TextL(STR("Replace")).c_str(), 5); bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 7, STR("Replace"), 5); + compare_text.replace(2, 7, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 7, STR("Replace"), 5); + text.replace(2, 7, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace"), 5); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace"), 5); + text.replace(2, Text::npos, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, 4, STR("Replace with some text"), 15); + compare_text.replace(2, 4, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, 4, STR("Replace with some text"), 15); + text.replace(2, 4, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. compare_text.assign(initial_text.c_str()); text.assign(initial_text.c_str()); - compare_text.replace(2, TextSTD::npos, STR("Replace with some text"), 15); + compare_text.replace(2, TextSTD::npos, TextSTD(STR("Replace with some text")).c_str(), 15); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(2, Text::npos, STR("Replace with some text"), 15); + text.replace(2, Text::npos, TextL(STR("Replace with some text")).c_str(), 15); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2888,14 +2913,14 @@ namespace TextSTD compare_text(short_text.c_str()); Text text(short_text.c_str()); - compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 4, STR("Replace"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2904,14 +2929,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2920,14 +2947,14 @@ 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, STR("Replace"), 5); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 9, TextSTD(STR("Replace")).c_str(), 5); compare_text.resize(std::min(compare_text.size(), SIZE)); - text.replace(text.begin() + 2, text.begin() + 9, STR("Replace"), 5); + text.replace(text.begin() + 2, text.begin() + 9, TextL(STR("Replace")).c_str(), 5); is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_array_bounds_push.h" @@ -2936,14 +2963,16 @@ 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, STR("Replace with some text"), 15); + compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(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, STR("Replace with some text"), 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); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -2963,7 +2992,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow short text, npos. @@ -2977,7 +3006,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -2991,7 +3020,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3005,7 +3036,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3019,7 +3052,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow, npos. @@ -3033,7 +3066,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3047,7 +3080,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3061,7 +3096,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3079,7 +3116,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3093,7 +3130,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3107,7 +3146,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3121,7 +3160,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3142,7 +3183,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text. @@ -3156,7 +3197,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3170,7 +3213,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif // Overflow. @@ -3184,7 +3227,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3201,7 +3246,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3218,7 +3263,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3235,7 +3280,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3247,7 +3292,7 @@ namespace CHECK_EQUAL(text.size(), size_t(0)); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3260,7 +3305,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3273,7 +3318,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3286,7 +3331,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3299,7 +3344,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3344,7 +3389,7 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less < initial) == (less_text < initial_text)); + CHECK((less < initial) == (less_text < initial_text)); CHECK((initial < less) == (initial_text < less_text)); const Text greater(greater_text.c_str()); @@ -3359,17 +3404,17 @@ namespace CHECK((initial < initial) == (initial_text < initial_text)); // String-Pointer Pointer-String - CHECK((less < pinitial_text) == (less_text < pinitial_text)); - CHECK((pinitial_text < less) == (pinitial_text < less_text)); + CHECK((less < pinitial_text) == (less_text < pinitial_text)); + CHECK((pinitial_text < less) == (pinitial_text < less_text)); - CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); - CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); + CHECK((greater < pinitial_text) == (greater_text < pinitial_text)); + CHECK((pinitial_text < greater) == (pinitial_text < greater_text)); - CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); - CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); + CHECK((shorter < pinitial_text) == (shorter_text < pinitial_text)); + CHECK((pinitial_text < shorter) == (pinitial_text < shorter_text)); - CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); - CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); + CHECK((initial < pinitial_text) == (initial_text < pinitial_text)); + CHECK((pinitial_text < initial) == (pinitial_text < initial_text)); } //************************************************************************* @@ -3379,8 +3424,8 @@ namespace const Text initial(initial_text.c_str()); // String-String - CHECK((less <= initial) == (less_text <= initial_text)); - CHECK((initial <= less) == (initial_text <= less_text)); + CHECK((less <= initial) == (less_text <= initial_text)); + CHECK((initial <= less) == (initial_text <= less_text)); const Text greater(greater_text.c_str()); CHECK((greater <= initial) == (greater_text <= initial_text)); @@ -3394,17 +3439,17 @@ namespace CHECK((initial <= initial) == (initial_text <= initial_text)); // String-Pointer Pointer-String - CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); - CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); + CHECK((less <= pinitial_text) == (less_text <= pinitial_text)); + CHECK((pinitial_text <= less) == (pinitial_text <= less_text)); - CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); - CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); + CHECK((greater <= pinitial_text) == (greater_text <= pinitial_text)); + CHECK((pinitial_text <= greater) == (pinitial_text <= greater_text)); - CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); - CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); + CHECK((shorter <= pinitial_text) == (shorter_text <= pinitial_text)); + CHECK((pinitial_text <= shorter) == (pinitial_text <= shorter_text)); - CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); - CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); + CHECK((initial <= pinitial_text) == (initial_text <= pinitial_text)); + CHECK((pinitial_text <= initial) == (pinitial_text <= initial_text)); } //************************************************************************* @@ -3429,17 +3474,17 @@ namespace CHECK((initial > initial) == (initial_text > initial_text)); // String-Pointer Pointer-String - CHECK((less > pinitial_text) == (less_text > pinitial_text)); - CHECK((pinitial_text > less) == (pinitial_text > less_text)); + CHECK((less > pinitial_text) == (less_text > pinitial_text)); + CHECK((pinitial_text > less) == (pinitial_text > less_text)); - CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); - CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); + CHECK((greater > pinitial_text) == (greater_text > pinitial_text)); + CHECK((pinitial_text > greater) == (pinitial_text > greater_text)); - CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); - CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); + CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text)); + CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text)); - CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); - CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); + CHECK((initial > pinitial_text) == (initial_text > pinitial_text)); + CHECK((pinitial_text > initial) == (pinitial_text > initial_text)); } //************************************************************************* @@ -3449,8 +3494,8 @@ namespace const Text initial(initial_text.begin(), initial_text.end()); // String-String - CHECK((less >= initial) == (less_text >= initial_text)); - CHECK((initial >= less) == (initial_text >= less_text)); + CHECK((less >= initial) == (less_text >= initial_text)); + CHECK((initial >= less) == (initial_text >= less_text)); const Text greater(greater_text.begin(), greater_text.end()); CHECK((greater >= initial) == (greater_text >= initial_text)); @@ -3464,17 +3509,17 @@ namespace CHECK((initial >= initial) == (initial_text >= initial_text)); // String-Pointer Pointer-String - CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); - CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); + CHECK((less >= pinitial_text) == (less_text >= pinitial_text)); + CHECK((pinitial_text >= less) == (pinitial_text >= less_text)); - CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); - CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); + CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text)); + CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text)); - CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); - CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); + CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text)); + CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text)); - CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); - CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); + CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text)); + CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text)); } //************************************************************************* @@ -3494,12 +3539,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3514,7 +3559,7 @@ namespace CHECK_EQUAL(0U, length1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif } @@ -3535,12 +3580,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3561,12 +3606,12 @@ namespace CHECK_EQUAL(length1, length2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3581,8 +3626,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(compare_needle, position1); position2 = haystack.find(needle, position2); @@ -3641,8 +3686,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1); position2 = haystack.find(needle, position2); @@ -3655,7 +3700,7 @@ namespace position2 = haystack.find(needle, position2 + 1); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin); CHECK_EQUAL(TextL::npos, position2); } @@ -3670,8 +3715,8 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = 0; - size_t position2 = 0; + size_t position1 = 0UL; + size_t position2 = 0UL; position1 = compare_haystack.find(needle, position1, 3); position2 = haystack.find(needle, position2, 3); @@ -3684,7 +3729,7 @@ namespace position2 = haystack.find(needle, position2 + 1, 3); CHECK_EQUAL(TextL::npos, position2); - const value_t* pin = STR("pin"); + const value_t *pin = STR("pin"); position2 = haystack.find(pin, 0, 3); CHECK_EQUAL(TextL::npos, position2); } @@ -3826,7 +3871,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::wstring::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3854,7 +3899,7 @@ namespace TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::wstring::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(compare_needle, position1); @@ -3873,14 +3918,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::wstring::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1); @@ -3899,14 +3944,14 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_pointer_n) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); const value_t* needle = STR("needle"); - size_t position1 = std::wstring::npos; + size_t position1 = TextSTD::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(needle, position1, 3); @@ -3924,12 +3969,12 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_rfind_c_position) { - const value_t* the_haystack = STR("A haystack with a needle and another needle"); + const value_t*the_haystack = STR("A haystack with a needle and another needle"); TextSTD compare_haystack(the_haystack); TextL haystack(the_haystack); - size_t position1 = std::wstring::npos; + etl::iwstring::size_type position1 = TextL::npos; size_t position2 = Text::npos; position1 = compare_haystack.rfind(STR('e'), position1); @@ -5063,25 +5108,25 @@ namespace TEST_FIXTURE(SetupFixture, test_truncate_over_many_operations) { Text text(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5090,8 +5135,8 @@ namespace Text text1(short_text.c_str()); TextS text2(short_text.c_str()); - CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_FALSE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5106,7 +5151,7 @@ namespace Text text2(short_text.c_str()); CHECK(text1.is_truncated()); - CHECK(!text2.is_truncated()); + CHECK_FALSE(text2.is_truncated()); // Clear text but not the truncate flag. text1.erase(text1.begin(), text1.end()); @@ -5121,10 +5166,10 @@ namespace TEST_FIXTURE(SetupFixture, test_clear_truncated) { Text text(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5145,7 +5190,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5291,7 +5338,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5306,7 +5353,7 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5321,7 +5368,9 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); } @@ -5330,7 +5379,7 @@ namespace #if ETL_USING_STL TEST_FIXTURE(SetupFixture, test_write_string_to_std_basic_ostream) { - Text text1 = STR("Hello World"); + Text text1(STR("Hello World")); std::wstringstream sstream; diff --git a/test/test_string_wchar_t_external_buffer.cpp b/test/test_string_wchar_t_external_buffer.cpp index 16cc52a8..36d18c8f 100644 --- a/test/test_string_wchar_t_external_buffer.cpp +++ b/test/test_string_wchar_t_external_buffer.cpp @@ -31,6 +31,7 @@ SOFTWARE. #include #include #include +#include #include "etl/wstring.h" #include "etl/fnv_1.h" @@ -133,9 +134,7 @@ namespace CHECK_EQUAL(SIZE, text.capacity()); CHECK_EQUAL(SIZE, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -149,9 +148,7 @@ namespace CHECK_EQUAL(length, text.capacity()); CHECK_EQUAL(length, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -164,9 +161,7 @@ namespace CHECK_EQUAL(etl::strlen(p_text), text.capacity()); CHECK_EQUAL(etl::strlen(p_text), text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -179,9 +174,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() == text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -194,9 +187,7 @@ namespace CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.capacity()); CHECK_EQUAL(ETL_OR_STD17::size(array_text) - 1, text.max_size()); CHECK(text.begin() != text.end()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -209,9 +200,7 @@ namespace CHECK(text.cbegin() == text.cend()); CHECK(text.rbegin() == text.rend()); CHECK(text.crbegin() == text.crend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -230,9 +219,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -243,7 +230,9 @@ namespace CHECK_EQUAL(buffer.size() - 1, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -259,9 +248,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -277,7 +264,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -293,9 +282,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -311,7 +298,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -327,9 +316,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -345,7 +332,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -359,9 +348,7 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -375,7 +362,9 @@ namespace CHECK(text.size() == SIZE); CHECK(!text.empty()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -446,7 +435,9 @@ namespace Text text2(textl, buffer2.data(), buffer2.size()); CHECK(text2 == text); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -460,7 +451,9 @@ namespace Text text2(text, buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -498,7 +491,9 @@ namespace bool is_equal = Equal(compare_text2, text2); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text2.is_truncated()); #endif } @@ -514,9 +509,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -534,7 +527,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } #endif @@ -552,10 +547,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -572,8 +565,11 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -618,8 +614,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text1.is_truncated()); + CHECK_TRUE(text2.is_truncated()); +#else + CHECK_FALSE(text1.is_truncated()); + CHECK_FALSE(text2.is_truncated()); #endif } @@ -639,10 +638,8 @@ namespace bool is_equal = Equal(text, other_text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); - CHECK(!other_text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); } //************************************************************************* @@ -662,8 +659,11 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); - CHECK(other_text.is_truncated()); + CHECK_TRUE(text.is_truncated()); + CHECK_TRUE(other_text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); + CHECK_FALSE(other_text.is_truncated()); #endif } @@ -677,9 +677,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -693,7 +691,9 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -710,6 +710,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(!itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -726,6 +728,8 @@ namespace CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(itext.is_truncated()); +#else + CHECK_FALSE(itext.is_truncated()); #endif } @@ -739,9 +743,7 @@ namespace bool is_equal = Equal(TextSTD(STR("Hello World")), text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -782,9 +784,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -803,9 +803,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } @@ -820,7 +818,9 @@ namespace text.resize(NEW_SIZE, STR('A')); CHECK_EQUAL(SIZE, text.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -835,9 +835,7 @@ namespace text.resize(NEW_SIZE); CHECK_EQUAL(text.size(), NEW_SIZE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -858,9 +856,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -936,6 +932,32 @@ namespace CHECK_EQUAL(text.size(), NEW_SIZE); } + //************************************************************************* + TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_up) + { + const size_t INITIAL_SIZE = 5UL; + const size_t NEW_SIZE = 8UL; + + TextBuffer buffer{0}; + Text text(initial_text.c_str(), INITIAL_SIZE, buffer.data(), buffer.size()); + + // Overwrite from index 1 to one less than the new size and set to that size. + text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) noexcept + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } + + return i; + }); + + CHECK_EQUAL(NEW_SIZE - 1, text.size()); + CHECK_TRUE(Equal(TextSTD(STR("H234567")), text)); + } + //************************************************************************* TEST_FIXTURE(SetupFixture, test_resize_and_overwrite_down) { @@ -947,16 +969,16 @@ namespace // Overwrite from index 1 to one less than the new size and set to that size. text.resize_and_overwrite(NEW_SIZE, [](Text::pointer p, size_t n) - { - size_t i = 1; - while (i < (n - 1)) - { - p[i] = '1' + Text::value_type(i); - ++i; - } + { + size_t i = 1; + while (i < (n - 1)) + { + p[i] = '1' + Text::value_type(i); + ++i; + } - return i; - }); + return i; + }); CHECK_EQUAL(NEW_SIZE - 1, text.size()); CHECK_TRUE(Equal(TextSTD(STR("H2")), text)); @@ -979,9 +1001,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -992,9 +1012,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1004,9 +1022,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(text.empty()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1017,9 +1033,7 @@ namespace text.resize(text.max_size(), STR('A')); CHECK(text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1030,9 +1044,7 @@ namespace text.resize(text.max_size() / 2, STR('A')); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1042,9 +1054,7 @@ namespace Text text(buffer.data(), buffer.size()); CHECK(!text.full()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1060,9 +1070,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1078,9 +1086,7 @@ namespace CHECK_EQUAL(text[i], compare_text[i]); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1096,9 +1102,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1116,9 +1120,7 @@ namespace CHECK_EQUAL(text.at(i), compare_text.at(i)); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds); } @@ -1132,9 +1134,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1146,9 +1146,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.front() == compare_text.front()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1160,9 +1158,7 @@ namespace Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1174,9 +1170,7 @@ namespace const Text text(initial_text.c_str(), buffer.data(), buffer.size()); CHECK(text.back() == compare_text.back()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1188,13 +1182,11 @@ namespace Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1206,13 +1198,11 @@ namespace const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size()); bool is_equal = std::equal(text.data(), - text.data() + text.size(), - compare_text.begin()); + text.data() + text.size(), + compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1233,9 +1223,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1248,9 +1236,7 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1270,9 +1256,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1294,7 +1278,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1309,9 +1295,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1326,7 +1310,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1341,9 +1327,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1360,7 +1344,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1376,9 +1362,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1394,7 +1378,9 @@ namespace bool is_equal = Equal(initial_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1415,9 +1401,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1436,7 +1420,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1463,9 +1449,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1484,9 +1468,7 @@ namespace for (size_t i = 0UL; i < SIZE; ++i) { text.push_back(STR('A') + value_t(i)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } text.push_back(STR('A') + value_t(SIZE)); @@ -1497,7 +1479,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -1564,7 +1548,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1576,7 +1562,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1588,7 +1576,9 @@ namespace compare_text.erase(compare_text.cend() - 1); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1613,9 +1603,7 @@ namespace text.insert(text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); compare_text.insert(compare_text.begin() + offset, INSERT_SIZE, INITIAL_VALUE); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1640,7 +1628,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1655,7 +1645,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1670,7 +1662,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1685,7 +1679,9 @@ namespace text.insert(text.cbegin() + offset, INSERT_SIZE, INSERT_VALUE); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1708,9 +1704,7 @@ namespace text.insert(text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); compare_text.insert(compare_text.cbegin() + offset, insert_text.cbegin(), insert_text.cend()); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -1736,7 +1730,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif bool is_equal = Equal(compare_text, text); @@ -1751,7 +1747,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif is_equal = Equal(compare_text, text); @@ -1767,7 +1765,9 @@ namespace text.insert(text.cbegin() + offset, initial_text.cbegin(), initial_text.cend()); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(compare_text.size(), text.size()); @@ -1792,9 +1792,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1817,9 +1815,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1840,9 +1836,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } } @@ -1866,7 +1860,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1894,7 +1890,9 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } } @@ -1916,9 +1914,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1931,9 +1927,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); compare_text.assign(short_text.cbegin(), short_text.cend()); text.assign(short_text.cbegin(), short_text.cend()); @@ -1944,9 +1938,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -1966,9 +1958,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -1982,7 +1972,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2000,9 +1992,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2016,7 +2006,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2031,11 +2023,15 @@ namespace Text append(short_text.c_str(), buffers.data(), buffers.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" } @@ -2054,9 +2050,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(shorter_text.c_str()); @@ -2069,7 +2063,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2090,9 +2086,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Partial string. compare_text.assign(short_text.c_str()); @@ -2105,9 +2099,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2121,7 +2113,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2135,11 +2129,15 @@ namespace Text append(short_text.c_str(), buffer2.data(), buffer2.size()); #if ETL_HAS_STRING_TRUNCATION_CHECKS CHECK(append.is_truncated()); +#else + CHECK_FALSE(append.is_truncated()); #endif text.append(append, 1, 2); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2158,9 +2156,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2173,7 +2169,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2192,9 +2190,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2207,7 +2203,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2228,9 +2226,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(short_text.c_str()); @@ -2244,7 +2240,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2263,9 +2261,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); @@ -2277,9 +2273,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2292,7 +2286,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2306,7 +2302,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2319,9 +2317,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2334,7 +2330,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2348,7 +2346,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2366,10 +2366,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif - + CHECK_FALSE(text.is_truncated()); // Non-overflow short text. compare_text.assign(short_text.c_str()); text.assign(short_text.c_str()); @@ -2380,9 +2377,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2395,7 +2390,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2409,7 +2406,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2422,9 +2421,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2437,7 +2434,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2451,7 +2450,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2470,9 +2471,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2485,7 +2484,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2498,9 +2499,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2513,7 +2512,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2531,9 +2532,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2546,7 +2545,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2559,9 +2560,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2574,7 +2573,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2593,9 +2594,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2607,9 +2606,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2622,7 +2619,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2636,7 +2635,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2649,9 +2650,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2663,9 +2662,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2678,7 +2675,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2692,7 +2691,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2710,9 +2711,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2724,9 +2723,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2739,7 +2736,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2753,7 +2752,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2766,9 +2767,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2780,9 +2779,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2795,7 +2792,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2809,7 +2808,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2828,9 +2829,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -2842,9 +2841,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2857,7 +2854,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -2871,7 +2870,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2884,9 +2885,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -2898,9 +2897,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2913,7 +2910,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -2927,7 +2926,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -2946,9 +2947,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -2961,7 +2960,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -2974,9 +2975,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -2989,7 +2988,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3008,9 +3009,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3022,9 +3021,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3037,7 +3034,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3051,7 +3050,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3064,9 +3065,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3078,9 +3077,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3093,7 +3090,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3107,7 +3106,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3126,9 +3127,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3143,7 +3142,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3158,9 +3159,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); #include "etl/private/diagnostic_array_bounds_push.h" #include "etl/private/diagnostic_stringop_overread_push.h" @@ -3175,7 +3174,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif #include "etl/private/diagnostic_pop.h" #include "etl/private/diagnostic_pop.h" @@ -3196,9 +3197,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow short text, npos. compare_text.assign(short_text.c_str()); @@ -3210,9 +3209,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3225,7 +3222,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow short text, npos. @@ -3239,7 +3238,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3252,9 +3253,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Non-overflow, npos. compare_text.assign(initial_text.c_str()); @@ -3266,9 +3265,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3281,7 +3278,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Overflow, npos. @@ -3295,7 +3294,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3314,9 +3315,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3329,7 +3328,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3342,9 +3343,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3357,7 +3356,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3379,9 +3380,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow short text. compare_text.assign(short_text.c_str()); @@ -3394,7 +3393,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif // Non-overflow. @@ -3407,9 +3408,7 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); // Overflow. compare_text.assign(initial_text.c_str()); @@ -3422,7 +3421,9 @@ namespace is_equal = Equal(compare_text, text); CHECK(is_equal); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif } @@ -3439,9 +3440,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3458,9 +3457,7 @@ namespace bool is_equal = Equal(compare_text, text); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3471,9 +3468,7 @@ namespace text.clear(); CHECK_EQUAL(text.size(), size_t(0)); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3486,9 +3481,7 @@ namespace bool is_equal = std::equal(text.begin(), text.end(), compare_text.begin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3501,9 +3494,7 @@ namespace bool is_equal = std::equal(text.cbegin(), text.cend(), compare_text.cbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3516,9 +3507,7 @@ namespace bool is_equal = std::equal(text.rbegin(), text.rend(), compare_text.rbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3531,9 +3520,7 @@ namespace bool is_equal = std::equal(text.crbegin(), text.crend(), compare_text.crbegin()); CHECK(is_equal); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3758,13 +3745,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3779,9 +3764,7 @@ namespace size_t length1 = text.copy(buffer1, 5, SIZE); CHECK_EQUAL(0U, length1); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -3802,13 +3785,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -3830,13 +3811,11 @@ namespace buffer2[length2] = STR('\0'); CHECK_EQUAL(length1, length2); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); bool is_equal = std::equal(buffer1, - buffer1 + length1, - buffer2); + buffer1 + length1, + buffer2); CHECK(is_equal); } @@ -5393,25 +5372,25 @@ namespace { TextBuffer buffer{0}; Text text(short_text.c_str(), buffer.data(), buffer.size()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.insert(3, initial_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); while (text.size() != 0) { text.pop_back(); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); } text.clear(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); text.assign(longer_text.c_str()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.assign(short_text.c_str()); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } //************************************************************************* @@ -5424,7 +5403,7 @@ namespace Text text2(short_text.c_str(), buffers.data(), buffers.size()); CHECK(!text1.is_truncated()); - CHECK(text2.is_truncated()); + CHECK_TRUE(text2.is_truncated()); // text2 has the truncate flag set. text1 += text2; @@ -5458,10 +5437,10 @@ namespace { TextBuffer buffer{0}; Text text(longer_text.c_str(), buffer.data(), buffer.size()); - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); text.clear_truncated(); - CHECK(!text.is_truncated()); + CHECK_FALSE(text.is_truncated()); } #endif @@ -5484,7 +5463,9 @@ namespace Text::pointer pe = text.end(); // Destroy the text object. + std::atomic_signal_fence(std::memory_order_seq_cst); text.~Text(); + std::atomic_signal_fence(std::memory_order_seq_cst); // Check there no non-zero values in the string. CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe); @@ -5643,9 +5624,7 @@ namespace std::fill(text.data(), text.data() + text.max_size(), STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size(), text.size()); } @@ -5659,9 +5638,7 @@ namespace std::fill(text.data(), text.data() + text.max_size() - 1, STR('A')); text.trim_to_terminator(); -#if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(!text.is_truncated()); -#endif + CHECK_FALSE(text.is_truncated()); CHECK_EQUAL(text.max_size() - 1, text.size()); } @@ -5676,7 +5653,9 @@ namespace text.trim_to_terminator(); #if ETL_HAS_STRING_TRUNCATION_CHECKS - CHECK(text.is_truncated()); + CHECK_TRUE(text.is_truncated()); +#else + CHECK_FALSE(text.is_truncated()); #endif CHECK_EQUAL(text.max_size(), text.size()); }