mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Fix is_truncated in basic_string (#1223)
Co-authored-by: Iványi Béla <bela.ivanyi@idata.hu>
This commit is contained in:
parent
efd5c57419
commit
79b41c85af
@ -770,7 +770,7 @@ namespace etl
|
||||
set_truncated(n > CAPACITY);
|
||||
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
ETL_ASSERT(is_truncated == false, ETL_ERROR(string_truncation));
|
||||
ETL_ASSERT(is_truncated() == false, ETL_ERROR(string_truncation));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -918,7 +918,7 @@ namespace etl
|
||||
set_truncated(n > free_space);
|
||||
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
ETL_ASSERT(is_truncated == false, ETL_ERROR(string_truncation));
|
||||
ETL_ASSERT(is_truncated() == false, ETL_ERROR(string_truncation));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -2774,7 +2774,7 @@ namespace etl
|
||||
set_truncated((count > free_space) || this->is_truncated() || truncated);
|
||||
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
ETL_ASSERT(is_truncated == false, ETL_ERROR(string_truncation));
|
||||
ETL_ASSERT(is_truncated() == false, ETL_ERROR(string_truncation));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -2820,7 +2820,7 @@ namespace etl
|
||||
#if ETL_HAS_STRING_TRUNCATION_CHECKS
|
||||
set_truncated(truncated);
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
ETL_ASSERT(is_truncated == false, ETL_ERROR(string_truncation));
|
||||
ETL_ASSERT(is_truncated() == false, ETL_ERROR(string_truncation));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -141,7 +141,6 @@ namespace
|
||||
TEST_FIXTURE(SetupFixture, test_make_string_with_capacity_truncated)
|
||||
{
|
||||
constexpr size_t CAPACITY = 10UL;
|
||||
size_t length = strlen("Hello World");
|
||||
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
CHECK_THROW(auto ctext = etl::make_string_with_capacity<CAPACITY>("Hello World"), etl::string_truncation);
|
||||
@ -149,6 +148,8 @@ namespace
|
||||
CHECK_THROW(auto u16text = etl::make_string_with_capacity<CAPACITY>(u"Hello World"), etl::string_truncation);;
|
||||
CHECK_THROW(auto u32text = etl::make_string_with_capacity<CAPACITY>(U"Hello World"), etl::string_truncation);;
|
||||
#else
|
||||
size_t length = strlen("Hello World");
|
||||
|
||||
auto ctext = etl::make_string_with_capacity<CAPACITY>("Hello World");
|
||||
auto wtext = etl::make_string_with_capacity<CAPACITY>(L"Hello World");
|
||||
auto u16text = etl::make_string_with_capacity<CAPACITY>(u"Hello World");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user