Fixes to GCC -O2 errors

This commit is contained in:
John Wellbelove 2025-09-02 13:51:45 +01:00
parent 18f50d01c4
commit 3837e36d71
22 changed files with 1571 additions and 703 deletions

1
.gitignore vendored
View File

@ -408,3 +408,4 @@ examples/UniquePtrWithPool/cmake_install.cmake
examples/UniquePtrWithPool/Makefile
examples/UniquePtrWithPool/CMakeCache.txt
examples/UniquePtrWithPool/UniquePtrWithPool
test/vs2022/Debug Clang C++20 - Optimised -O2

View File

@ -678,6 +678,7 @@ namespace etl
{
if (&other != this)
{
clear();
append_impl(begin(), other.begin(), other.end(), other.is_truncated(), other.is_secure());
}
}
@ -693,6 +694,8 @@ namespace etl
{
if (&other != this)
{
clear();
if (sublength == npos)
{
sublength = other.size() - subposition;
@ -727,6 +730,17 @@ namespace etl
append_impl(begin(), str, false, false);
}
//*********************************************************************
/// Assigns values to the string.
/// Truncates if the string does not have enough free space.
///\param other The other string.
//*********************************************************************
template <size_t Size>
void assign(const value_type (&literal)[Size])
{
append_impl(begin(), literal, Size, false, false);
}
//*********************************************************************
/// Assigns values to the string.
/// Truncates if the string does not have enough free space.
@ -1676,13 +1690,7 @@ namespace etl
// Limit the length.
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, str);
return *this;
return replace_impl(begin() + position, begin() + position + length_, str.begin(), str.size(), str.is_truncated());
}
//*********************************************************************
@ -1699,13 +1707,7 @@ namespace etl
// Limit the length.
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, view);
return *this;
return replace_impl(begin() + position, begin() + position + length_, view.begin(), view.size(), false);
}
//*********************************************************************
@ -1716,28 +1718,7 @@ namespace etl
//*********************************************************************
ibasic_string& replace(const_iterator first, const_iterator last, const ibasic_string& str)
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
// Erase the bit we want to replace.
erase(first_, last_);
// Insert the new stuff.
insert(first_, str.begin(), str.end());
#if ETL_HAS_STRING_TRUNCATION_CHECKS
if (str.is_truncated())
{
set_truncated(true);
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
ETL_ASSERT_FAIL(ETL_ERROR(string_truncation));
#endif
}
#endif
return *this;
return replace_impl(first, last, str.begin(), str.size(), str.is_truncated());
}
//*********************************************************************
@ -1749,17 +1730,7 @@ namespace etl
template <typename TOtherTraits>
ibasic_string& replace(const_iterator first, const_iterator last, const etl::basic_string_view<T, TOtherTraits>& view)
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
// Erase the bit we want to replace.
erase(first_, last_);
// Insert the new stuff.
insert(first_, view.begin(), view.end());
return *this;
return replace_impl(first, last, view.begin(), view.size(), false);
}
//*********************************************************************
@ -1773,25 +1744,8 @@ namespace etl
// Limit the lengths.
length_ = etl::min(length_, size() - position);
sublength = etl::min(sublength, str.size() - subposition);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, str, subposition, sublength);
#if ETL_HAS_STRING_TRUNCATION_CHECKS
if (str.is_truncated())
{
set_truncated(true);
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
ETL_ASSERT_FAIL(ETL_ERROR(string_truncation));
#endif
}
#endif
return *this;
return replace_impl(begin() + position, begin() + position + length_, str.begin() + subposition, sublength, str.is_truncated());
}
//*********************************************************************
@ -1807,13 +1761,7 @@ namespace etl
length_ = etl::min(length_, size() - position);
sublength = etl::min(sublength, view.size() - subposition);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, view, subposition, sublength);
return *this;
return replace_impl(begin() + position, begin() + position + length_, view.begin() + subposition, sublength, false);
}
//*********************************************************************
@ -1826,31 +1774,40 @@ namespace etl
// Limit the length.
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, s, etl::strlen(s));
return *this;
return replace_impl(begin() + position, begin() + position + length_, s, etl::strlen(s), false);
}
//*********************************************************************
/// Replace characters from 'first' 'last' with pointed to string.
/// Replace characters in the range [first, last) with the first 'n'
/// characters from the C string 's'.
///\param first Iterator to first character to replace.
///\param last Iterator one past last character to replace.
///\param s Pointer to source character buffer (may be non-null
/// terminated and may contain embedded nulls).
///\param n Number of characters from 's' to insert.
//*********************************************************************
ibasic_string& replace(const_iterator first, const_iterator last, const_pointer s)
ibasic_string& replace(const_iterator first, const_iterator last, const_pointer s, size_type n)
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
return replace_impl(first, last, s, n, false);
}
// Erase the bit we want to replace.
erase(first_, last_);
//*********************************************************************
/// Replace characters from 'first' to 'last' with pointed to string.
//*********************************************************************
template <typename TIterator>
typename etl::enable_if<etl::is_same<TIterator, const_pointer>::value, ibasic_string>::type&
replace(const_iterator first, const_iterator last, TIterator s)
{
return replace_impl(first, last, s, etl::strlen(s), false);
}
// Insert the new stuff.
insert(first_, s, s + etl::strlen(s));
return *this;
//*********************************************************************
/// Replace characters from 'first' 'last' with pointed to literal string.
//*********************************************************************
template <size_t Size>
ibasic_string& replace(const_iterator first, const_iterator last, const value_type (&literal)[Size])
{
return replace_impl(first, last, literal, Size, false);
}
//*********************************************************************
@ -1863,31 +1820,7 @@ namespace etl
// Limit the length.
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
// Insert the new stuff.
insert(position, s, n);
return *this;
}
//*********************************************************************
/// Replace characters from 'first' to 'last' with 'n' characters from pointed to string.
//*********************************************************************
ibasic_string& replace(const_iterator first, const_iterator last, const_pointer s, size_type n)
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
// Erase the bit we want to replace.
erase(first_, last_);
// Insert the new stuff.
insert(first_, s, s + n);
return *this;
return replace_impl(begin() + position, begin() + position + length_, s, n, false);
}
//*********************************************************************
@ -1916,7 +1849,7 @@ namespace etl
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
iterator last_ = to_iterator(last);
// Erase the bit we want to replace.
erase(first_, last_);
@ -1935,7 +1868,7 @@ namespace etl
{
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
iterator last_ = to_iterator(last);
// Erase the bit we want to replace.
erase(first_, last_);
@ -2564,6 +2497,111 @@ namespace etl
private:
//*********************************************************************
/// Replace characters from 'first' to one before 'last' with the C string
/// at 's' of specified 'length'.
/// This is an optimised single-pass implementation.
//*********************************************************************
ibasic_string& replace_impl(const_iterator first, const_iterator last, const_pointer s, size_type length, bool other_truncated)
{
// Trivial no-op cases
if ((first == last) && (s == ETL_NULLPTR || length == 0U))
{
return *this;
}
// Invalid range?
if (first > last)
{
return *this;
}
// Quick hack, as iterators are pointers.
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
// If source pointer is inside our current buffer we take the safe
// (legacy) path to preserve correct semantics for overlapping self use.
const bool source_overlaps = (s != ETL_NULLPTR) &&
(s >= p_buffer) &&
(s < p_buffer + current_size);
if (source_overlaps)
{
// Legacy behaviour (may be slightly less efficient, but correct).
// Erase range then insert up to 'length' characters from 's'.
erase(first_, last_);
if (s != ETL_NULLPTR && length != 0U)
{
// 'insert' can truncate & set flags.
insert(p_buffer + (first_ - p_buffer), s, s + length);
}
return *this;
}
// Calculate the remove parameters.
const size_type remove_index = size_type(first_ - p_buffer);
const size_type remove_length = size_type(last_ - first_);
const size_type free_space = CAPACITY - remove_index; // Free space is the space from the remove index to the end of the buffer.
size_type insert_length = (s == ETL_NULLPTR) ? 0U : length;
// Limit the insert length to the available free space.
if (insert_length > free_space)
{
insert_length = free_space;
}
// Calculate the tail parameters.
size_type tail_index = remove_index + remove_length;
size_type tail_length = current_size - tail_index;
size_type tail_space = free_space - insert_length;
#if ETL_HAS_STRING_TRUNCATION_CHECKS
set_truncated((insert_length != length) || (tail_space < tail_length) || is_truncated() || other_truncated);
#endif
// The some or all of tail may be erased if the space remaining for it is smaller than the tail length.
if (tail_space < tail_length)
{
tail_length = tail_space;
}
// Three cases: same size, grow, shrink.
if (insert_length == remove_length)
{
// Size unchanged: simple overwrite.
etl::mem_copy(s, insert_length, &p_buffer[remove_index]);
}
else if (insert_length > remove_length)
{
// Grow: shift tail right then copy.
// Shift tail (backwards to handle overlap safely).
etl::mem_move(&p_buffer[tail_index], tail_length, &p_buffer[remove_index + insert_length]);
// Copy new data.
etl::mem_copy(s, insert_length, &p_buffer[remove_index]);
}
else // insert_length < remove_length
{
// Shrink: overwrite then shift tail left.
// Copy new data.
etl::mem_copy(s, insert_length, &p_buffer[remove_index]);
// Move tail left.
etl::mem_copy(&p_buffer[tail_index], tail_length, &p_buffer[remove_index + insert_length]);
}
current_size = remove_index + insert_length + tail_length;
p_buffer[current_size] = value_type(0);
cleanup();
return *this;
}
//*************************************************************************
/// Compare helper function
//*************************************************************************
@ -2664,6 +2702,14 @@ namespace etl
return const_cast<iterator>(itr);
}
//*************************************************************************
/// Checks if a pointer is within the buffer.
//*************************************************************************
bool is_within_buffer(const_pointer ptr) const
{
return (ptr >= p_buffer) && (ptr <= (p_buffer + CAPACITY));
}
private:
//*********************************************************************

View File

@ -312,8 +312,15 @@ namespace etl
string_ext(const etl::string_ext& other, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -323,8 +330,15 @@ namespace etl
string_ext(const etl::istring& other, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -338,19 +352,26 @@ namespace etl
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->initialise();
this->assign(other, position, length);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other, position, length);
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the string_ext.
//*************************************************************************
string_ext(const char* text, char* buffer, size_type buffer_size)
template <typename TPointer, typename = typename etl::enable_if<etl::is_same<const value_type*, TPointer>::value, int>::type>
string_ext(TPointer text, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
// Is the initial text at the same address as the buffer?
if (text == buffer)
if (this->is_within_buffer(text))
{
this->current_size = etl::strlen(buffer);
}
@ -361,6 +382,25 @@ namespace etl
}
}
//*************************************************************************
/// Constructor, from null terminated literal text.
///\param text The initial text of the string_ext.
//*************************************************************************
template <size_t Size>
string_ext(const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(literal))
{
this->current_size = etl::strlen(literal);
}
else
{
this->initialise();
this->assign(literal);
}
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the string_ext.
@ -369,8 +409,15 @@ namespace etl
string_ext(const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(text, text + count);
if (this->is_within_buffer(text))
{
this->current_size = count;
}
else
{
this->initialise();
this->assign(text, text + count);
}
}
//*************************************************************************
@ -392,7 +439,15 @@ namespace etl
explicit string_ext(const etl::string_view& view, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
this->assign(view.begin(), view.end());
if (this->is_within_buffer(view.data()))
{
this->current_size = view.size();
}
else
{
this->initialise();
this->assign(view.begin(), view.end());
}
}
//*************************************************************************
@ -405,7 +460,15 @@ namespace etl
string_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: istring(buffer, buffer_size - 1U)
{
this->assign(first, last);
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
}
else
{
this->initialise();
this->assign(first, last);
}
}
#if ETL_HAS_INITIALIZER_LIST
@ -415,6 +478,7 @@ namespace etl
string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
: istring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(init.begin(), init.end());
}
#endif

View File

@ -366,7 +366,7 @@ namespace etl
{
n = etl::min(count, size() - position);
etl::mem_move(mbegin + position, n, destination);
etl::mem_copy(mbegin + position, n, destination);
}
return n;

View File

@ -263,8 +263,8 @@ namespace etl
};
//***************************************************************************
/// A u16string_ex implementation that uses a fixed external buffer.
///\ingroup u16string
/// A string implementation that uses a fixed size external buffer.
///\ingroup string
//***************************************************************************
class u16string_ext : public iu16string
{
@ -274,6 +274,7 @@ namespace etl
typedef iu16string interface_type;
typedef iu16string::value_type value_type;
typedef iu16string::size_type size_type;
//*************************************************************************
/// Constructor.
@ -291,8 +292,15 @@ namespace etl
u16string_ext(const etl::u16string_ext& other, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -302,8 +310,15 @@ namespace etl
u16string_ext(const etl::iu16string& other, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -317,19 +332,26 @@ namespace etl
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->initialise();
this->assign(other, position, length);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other, position, length);
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the u16string_ext.
//*************************************************************************
u16string_ext(const value_type* text, value_type* buffer, size_type buffer_size)
template <typename TPointer, typename = typename etl::enable_if<etl::is_same<const value_type*, TPointer>::value, int>::type>
u16string_ext(TPointer text, char* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
// Is the initial text at the same address as the buffer?
if (text == buffer)
if (this->is_within_buffer(text))
{
this->current_size = etl::strlen(buffer);
}
@ -340,6 +362,25 @@ namespace etl
}
}
//*************************************************************************
/// Constructor, from null terminated literal text.
///\param text The initial text of the u16string_ext.
//*************************************************************************
template <size_t Size>
u16string_ext(const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(literal))
{
this->current_size = etl::strlen(literal);
}
else
{
this->initialise();
this->assign(literal);
}
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the u16string_ext.
@ -348,8 +389,15 @@ namespace etl
u16string_ext(const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(text, text + count);
if (this->is_within_buffer(text))
{
this->current_size = count;
}
else
{
this->initialise();
this->assign(text, text + count);
}
}
//*************************************************************************
@ -364,6 +412,24 @@ namespace etl
this->resize(count, c);
}
//*************************************************************************
/// From u16string_view.
///\param view The u16string_view.
//*************************************************************************
explicit u16string_ext(const etl::u16string_view& view, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(view.data()))
{
this->current_size = view.size();
}
else
{
this->initialise();
this->assign(view.begin(), view.end());
}
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
@ -374,8 +440,15 @@ namespace etl
u16string_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(first, last);
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
}
else
{
this->initialise();
this->assign(first, last);
}
}
#if ETL_HAS_INITIALIZER_LIST
@ -385,21 +458,11 @@ namespace etl
u16string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(init.begin(), init.end());
}
#endif
//*************************************************************************
/// From string_view.
///\param view The string_view.
//*************************************************************************
explicit u16string_ext(const etl::u16string_view& view, value_type* buffer, size_type buffer_size)
: iu16string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************

View File

@ -263,8 +263,8 @@ namespace etl
};
//***************************************************************************
/// A u32string implementation that uses a fixed size external buffer.
///\ingroup u32string
/// A string implementation that uses a fixed size external buffer.
///\ingroup string
//***************************************************************************
class u32string_ext : public iu32string
{
@ -274,6 +274,7 @@ namespace etl
typedef iu32string interface_type;
typedef iu32string::value_type value_type;
typedef iu32string::size_type size_type;
//*************************************************************************
/// Constructor.
@ -291,8 +292,15 @@ namespace etl
u32string_ext(const etl::u32string_ext& other, value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -302,8 +310,15 @@ namespace etl
u32string_ext(const etl::iu32string& other, value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -317,21 +332,28 @@ namespace etl
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->initialise();
this->assign(other, position, length);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other, position, length);
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the u32string_ext.
//*************************************************************************
ETL_EXPLICIT_STRING_FROM_CHAR u32string_ext(const value_type* text, value_type* buffer, size_type buffer_size)
template <typename TPointer, typename = typename etl::enable_if<etl::is_same<const value_type*, TPointer>::value, int>::type>
u32string_ext(TPointer text, char* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
// Is the initial text at the same address as the buffer?
if (text == buffer)
if (this->is_within_buffer(text))
{
this->current_size = etl::strlen(buffer);;
this->current_size = etl::strlen(buffer);
}
else
{
@ -340,6 +362,25 @@ namespace etl
}
}
//*************************************************************************
/// Constructor, from null terminated literal text.
///\param text The initial text of the u32string_ext.
//*************************************************************************
template <size_t Size>
u32string_ext(const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(literal))
{
this->current_size = etl::strlen(literal);
}
else
{
this->initialise();
this->assign(literal);
}
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the u32string_ext.
@ -348,8 +389,15 @@ namespace etl
u32string_ext(const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(text, text + count);
if (this->is_within_buffer(text))
{
this->current_size = count;
}
else
{
this->initialise();
this->assign(text, text + count);
}
}
//*************************************************************************
@ -364,6 +412,24 @@ namespace etl
this->resize(count, c);
}
//*************************************************************************
/// From u32string_view.
///\param view The u32string_view.
//*************************************************************************
explicit u32string_ext(const etl::u32string_view& view, value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(view.data()))
{
this->current_size = view.size();
}
else
{
this->initialise();
this->assign(view.begin(), view.end());
}
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
@ -374,8 +440,15 @@ namespace etl
u32string_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: iu32string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(first, last);
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
}
else
{
this->initialise();
this->assign(first, last);
}
}
#if ETL_HAS_INITIALIZER_LIST
@ -390,17 +463,6 @@ namespace etl
}
#endif
//*************************************************************************
/// From string_view.
///\param view The string_view.
//*************************************************************************
explicit u32string_ext(const etl::u32string_view& view, value_type* buffer, size_type buffer_size)
: iu32string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************

View File

@ -283,8 +283,8 @@ namespace etl
ETL_CONSTANT size_t u8string<MAX_SIZE_>::MAX_SIZE;
//***************************************************************************
/// A u8string implementation that uses a fixed size external buffer.
///\ingroup u8string
/// A string implementation that uses a fixed size external buffer.
///\ingroup string
//***************************************************************************
class u8string_ext : public iu8string
{
@ -312,8 +312,15 @@ namespace etl
u8string_ext(const etl::u8string_ext& other, value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -323,8 +330,15 @@ namespace etl
u8string_ext(const etl::iu8string& other, value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -338,19 +352,26 @@ namespace etl
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->initialise();
this->assign(other, position, length);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other, position, length);
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the u8string_ext.
//*************************************************************************
u8string_ext(const char8_t* text, char8_t* buffer, size_type buffer_size)
template <typename TPointer, typename = typename etl::enable_if<etl::is_same<const value_type*, TPointer>::value, int>::type>
u8string_ext(TPointer text, char* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
// Is the initial text at the same address as the buffer?
if (text == buffer)
if (this->is_within_buffer(text))
{
this->current_size = etl::strlen(buffer);
}
@ -361,6 +382,25 @@ namespace etl
}
}
//*************************************************************************
/// Constructor, from null terminated literal text.
///\param text The initial text of the u8string_ext.
//*************************************************************************
template <size_t Size>
u8string_ext(const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(literal))
{
this->current_size = etl::strlen(literal);
}
else
{
this->initialise();
this->assign(literal);
}
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the u8string_ext.
@ -369,8 +409,15 @@ namespace etl
u8string_ext(const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(text, text + count);
if (this->is_within_buffer(text))
{
this->current_size = count;
}
else
{
this->initialise();
this->assign(text, text + count);
}
}
//*************************************************************************
@ -385,6 +432,24 @@ namespace etl
this->resize(count, c);
}
//*************************************************************************
/// From u8string_view.
///\param view The u8string_view.
//*************************************************************************
explicit u8string_ext(const etl::u8string_view& view, value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(view.data()))
{
this->current_size = view.size();
}
else
{
this->initialise();
this->assign(view.begin(), view.end());
}
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
@ -395,8 +460,15 @@ namespace etl
u8string_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: iu8string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(first, last);
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
}
else
{
this->initialise();
this->assign(first, last);
}
}
#if ETL_HAS_INITIALIZER_LIST
@ -411,17 +483,6 @@ namespace etl
}
#endif
//*************************************************************************
/// From string_view.
///\param view The string_view.
//*************************************************************************
explicit u8string_ext(const etl::u8string_view& view, value_type* buffer, size_type buffer_size)
: iu8string(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************

View File

@ -263,8 +263,8 @@ namespace etl
};
//***************************************************************************
/// A wstring implementation that uses a fixed size external buffer.
///\ingroup wstring
/// A string implementation that uses a fixed size external buffer.
///\ingroup string
//***************************************************************************
class wstring_ext : public iwstring
{
@ -274,6 +274,7 @@ namespace etl
typedef iwstring interface_type;
typedef iwstring::value_type value_type;
typedef iwstring::size_type size_type;
//*************************************************************************
/// Constructor.
@ -291,8 +292,15 @@ namespace etl
wstring_ext(const etl::wstring_ext& other, value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -302,8 +310,15 @@ namespace etl
wstring_ext(const etl::iwstring& other, value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(other);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other);
}
}
//*************************************************************************
@ -317,19 +332,26 @@ namespace etl
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->initialise();
this->assign(other, position, length);
if (this->is_within_buffer(other.data()))
{
this->current_size = other.size();
}
else
{
this->initialise();
this->assign(other, position, length);
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the wstring_ext.
//*************************************************************************
wstring_ext(const value_type* text, value_type* buffer, size_type buffer_size)
template <typename TPointer, typename = typename etl::enable_if<etl::is_same<const value_type*, TPointer>::value, int>::type>
wstring_ext(TPointer text, char* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
// Is the initial text at the same address as the buffer?
if (text == buffer)
if (this->is_within_buffer(text))
{
this->current_size = etl::strlen(buffer);
}
@ -340,6 +362,25 @@ namespace etl
}
}
//*************************************************************************
/// Constructor, from null terminated literal text.
///\param text The initial text of the wstring_ext.
//*************************************************************************
template <size_t Size>
wstring_ext(const value_type (&literal)[Size], value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(literal))
{
this->current_size = etl::strlen(literal);
}
else
{
this->initialise();
this->assign(literal);
}
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the wstring_ext.
@ -348,8 +389,15 @@ namespace etl
wstring_ext(const value_type* text, size_type count, value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(text, text + count);
if (this->is_within_buffer(text))
{
this->current_size = count;
}
else
{
this->initialise();
this->assign(text, text + count);
}
}
//*************************************************************************
@ -364,6 +412,24 @@ namespace etl
this->resize(count, c);
}
//*************************************************************************
/// From wstring_view.
///\param view The wstring_view.
//*************************************************************************
explicit wstring_ext(const etl::wstring_view& view, value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
if (this->is_within_buffer(view.data()))
{
this->current_size = view.size();
}
else
{
this->initialise();
this->assign(view.begin(), view.end());
}
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
@ -374,8 +440,15 @@ namespace etl
wstring_ext(TIterator first, TIterator last, value_type* buffer, size_type buffer_size, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: iwstring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(first, last);
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
}
else
{
this->initialise();
this->assign(first, last);
}
}
#if ETL_HAS_INITIALIZER_LIST
@ -390,17 +463,6 @@ namespace etl
}
#endif
//*************************************************************************
/// From string_view.
///\param view The string_view.
//*************************************************************************
explicit wstring_ext(const etl::wstring_view& view, value_type* buffer, size_type buffer_size)
: iwstring(buffer, buffer_size - 1U)
{
this->initialise();
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************

View File

@ -12,347 +12,16 @@ project(etl_unit_tests LANGUAGES CXX)
add_executable(etl_tests
main.cpp
murmurhash3.cpp
test_algorithm.cpp
test_alignment.cpp
test_array.cpp
test_array_view.cpp
test_array_wrapper.cpp
test_atomic.cpp
test_base64_RFC2152_decoder.cpp
test_base64_RFC2152_encoder.cpp
test_base64_RFC3501_decoder.cpp
test_base64_RFC3501_encoder.cpp
test_base64_RFC4648_decoder_with_no_padding.cpp
test_base64_RFC4648_decoder_with_padding.cpp
test_base64_RFC4648_encoder_with_no_padding.cpp
test_base64_RFC4648_encoder_with_padding.cpp
test_base64_RFC4648_URL_decoder_with_no_padding.cpp
test_base64_RFC4648_URL_decoder_with_padding.cpp
test_base64_RFC4648_URL_encoder_with_no_padding.cpp
test_base64_RFC4648_URL_encoder_with_padding.cpp
test_binary.cpp
test_bip_buffer_spsc_atomic.cpp
test_bit.cpp
test_bitset_legacy.cpp
test_bitset_new_comparisons.cpp
test_bitset_new_default_element_type.cpp
test_bitset_new_explicit_single_element_type.cpp
test_bitset_new_ext_default_element_type.cpp
test_bitset_new_ext_explicit_single_element_type.cpp
test_bit_stream.cpp
test_bit_stream_reader_big_endian.cpp
test_bit_stream_reader_little_endian.cpp
test_bit_stream_writer_big_endian.cpp
test_bit_stream_writer_little_endian.cpp
test_bloom_filter.cpp
test_bresenham_line.cpp
test_bsd_checksum.cpp
test_buffer_descriptors.cpp
test_byte.cpp
test_byte_stream.cpp
test_callback_service.cpp
test_callback_timer.cpp
test_callback_timer_atomic.cpp
test_callback_timer_deferred_locked.cpp
test_callback_timer_interrupt.cpp
test_callback_timer_locked.cpp
test_const_map.cpp
test_const_map_constexpr.cpp
test_const_multimap.cpp
test_const_multimap_constexpr.cpp
test_char_traits.cpp
test_checksum.cpp
test_chrono_clocks.cpp
test_chrono_day.cpp
test_chrono_duration.cpp
test_chrono_hh_mm_ss.cpp
test_chrono_literals.cpp
test_chrono_month.cpp
test_chrono_month_day.cpp
test_chrono_month_day_last.cpp
test_chrono_month_weekday.cpp
test_chrono_month_weekday_last.cpp
test_chrono_operators.cpp
test_chrono_time_point.cpp
test_chrono_weekday.cpp
test_chrono_weekday_indexed.cpp
test_chrono_weekday_last.cpp
test_chrono_year.cpp
test_chrono_year_month.cpp
test_chrono_year_month_day.cpp
test_chrono_year_month_day_last.cpp
test_chrono_year_month_weekday.cpp
test_chrono_year_month_weekday_last.cpp
test_circular_buffer.cpp
test_circular_buffer_external_buffer.cpp
test_circular_iterator.cpp
test_closure.cpp
test_closure_constexpr.cpp
test_compare.cpp
test_constant.cpp
test_container.cpp
test_correlation.cpp
test_covariance.cpp
test_crc1.cpp
test_crc16.cpp
test_crc16_a.cpp
test_crc16_arc.cpp
test_crc16_aug_ccitt.cpp
test_crc16_buypass.cpp
test_crc16_ccitt.cpp
test_crc16_cdma2000.cpp
test_crc16_dds110.cpp
test_crc16_dectr.cpp
test_crc16_dectx.cpp
test_crc16_dnp.cpp
test_crc16_en13757.cpp
test_crc16_genibus.cpp
test_crc16_kermit.cpp
test_crc16_m17.cpp
test_crc16_maxim.cpp
test_crc16_mcrf4xx.cpp
test_crc16_modbus.cpp
test_crc16_opensafety_a.cpp
test_crc16_opensafety_b.cpp
test_crc16_profibus.cpp
test_crc16_riello.cpp
test_crc16_t10dif.cpp
test_crc16_teledisk.cpp
test_crc16_tms37157.cpp
test_crc16_usb.cpp
test_crc16_x25.cpp
test_crc16_xmodem.cpp
test_crc32.cpp
test_crc32_bzip2.cpp
test_crc32_c.cpp
test_crc32_d.cpp
test_crc32_jamcrc.cpp
test_crc32_mpeg2.cpp
test_crc32_posix.cpp
test_crc32_q.cpp
test_crc32_xfer.cpp
test_crc64_ecma.cpp
test_crc64_iso.cpp
test_crc8_ccitt.cpp
test_crc8_cdma2000.cpp
test_crc8_darc.cpp
test_crc8_dvbs2.cpp
test_crc8_ebu.cpp
test_crc8_icode.cpp
test_crc8_itu.cpp
test_crc8_j1850.cpp
test_crc8_j1850_zero.cpp
test_crc8_maxim.cpp
test_crc8_nrsc5.cpp
test_crc8_opensafety.cpp
test_crc8_rohc.cpp
test_crc8_wcdma.cpp
test_crc8_nrsc5.cpp
test_cyclic_value.cpp
test_debounce.cpp
test_delegate.cpp
test_delegate_cpp03.cpp
test_delegate_observable.cpp
test_delegate_service.cpp
test_delegate_service_compile_time.cpp
test_delegate_service_cpp03.cpp
test_deque.cpp
test_endian.cpp
test_enum_type.cpp
test_error_handler.cpp
test_etl_traits.cpp
test_exception.cpp
test_expected.cpp
test_fixed_iterator.cpp
test_fixed_sized_memory_block_allocator.cpp
test_flags.cpp
test_flat_map.cpp
test_flat_multimap.cpp
test_flat_multiset.cpp
test_flat_set.cpp
test_fnv_1.cpp
test_format_spec.cpp
test_forward_list.cpp
test_forward_list_shared_pool.cpp
test_fsm.cpp
test_function.cpp
test_functional.cpp
test_function_traits.cpp
test_gamma.cpp
test_hash.cpp
test_hfsm.cpp
test_hfsm_recurse_to_inner_state_on_start.cpp
test_histogram.cpp
test_index_of_type.cpp
test_indirect_vector.cpp
test_indirect_vector_external_buffer.cpp
test_instance_count.cpp
test_integral_limits.cpp
test_intrusive_forward_list.cpp
test_intrusive_links.cpp
test_intrusive_list.cpp
test_intrusive_queue.cpp
test_intrusive_stack.cpp
test_invert.cpp
test_io_port.cpp
test_iterator.cpp
test_jenkins.cpp
test_largest.cpp
test_limiter.cpp
test_limits.cpp
test_list.cpp
test_list_shared_pool.cpp
test_macros.cpp
test_make_string.cpp
test_map.cpp
test_math.cpp
test_math_functions.cpp
test_mean.cpp
test_memory.cpp
test_mem_cast.cpp
test_mem_cast_ptr.cpp
test_message.cpp
test_message_broker.cpp
test_message_bus.cpp
test_message_packet.cpp
test_message_router.cpp
test_message_router_registry.cpp
test_message_timer.cpp
test_message_timer_atomic.cpp
test_message_timer_interrupt.cpp
test_message_timer_locked.cpp
test_multimap.cpp
test_multiset.cpp
test_multi_array.cpp
test_multi_range.cpp
test_multi_span.cpp
test_multi_vector.cpp
test_murmur3.cpp
test_not_null_pointer.cpp
test_not_null_pointer_constexpr.cpp
test_not_null_unique_pointer.cpp
test_nth_type.cpp
test_numeric.cpp
test_observer.cpp
test_optional.cpp
test_overload.cpp
test_packet.cpp
test_parameter_pack.cpp
test_parameter_type.cpp
test_parity_checksum.cpp
test_pearson.cpp
test_poly_span_dynamic_extent.cpp
test_poly_span_fixed_extent.cpp
test_pool.cpp
test_pool_external_buffer.cpp
test_priority_queue.cpp
test_pseudo_moving_average.cpp
test_quantize.cpp
test_queue.cpp
test_queue_lockable.cpp
test_queue_lockable_small.cpp
test_queue_memory_model_small.cpp
test_queue_mpmc_mutex.cpp
test_queue_mpmc_mutex_small.cpp
test_queue_spsc_atomic.cpp
test_queue_spsc_atomic_small.cpp
test_queue_spsc_isr.cpp
test_queue_spsc_isr_small.cpp
test_queue_spsc_locked.cpp
test_queue_spsc_locked_small.cpp
test_random.cpp
test_ratio.cpp
test_reference_flat_map.cpp
test_reference_flat_multimap.cpp
test_reference_flat_multiset.cpp
test_reference_flat_set.cpp
test_rescale.cpp
test_result.cpp
test_rms.cpp
test_rounded_integral_division.cpp
test_scaled_rounding.cpp
test_set.cpp
test_shared_message.cpp
test_singleton.cpp
test_singleton_base.cpp
test_smallest.cpp
test_span_dynamic_extent.cpp
test_span_fixed_extent.cpp
test_stack.cpp
test_standard_deviation.cpp
test_state_chart.cpp
test_state_chart_compile_time.cpp
test_state_chart_compile_time_with_data_parameter.cpp
test_state_chart_with_data_parameter.cpp
test_state_chart_with_rvalue_data_parameter.cpp
test_string_char.cpp
test_string_char_external_buffer.cpp
test_string_stream.cpp
test_string_stream_u16.cpp
test_string_stream_u32.cpp
test_string_stream_u8.cpp
test_string_stream_wchar_t.cpp
test_string_u16.cpp
test_string_u16_external_buffer.cpp
test_string_u32.cpp
test_string_u32_external_buffer.cpp
test_string_u8.cpp
test_string_u8_external_buffer.cpp
test_string_utilities.cpp
test_string_utilities_std.cpp
test_string_utilities_std_u16.cpp
test_string_utilities_std_u32.cpp
test_string_utilities_std_u8.cpp
test_string_utilities_std_wchar_t.cpp
test_string_utilities_u16.cpp
test_string_utilities_u32.cpp
test_string_utilities_u8.cpp
test_string_utilities_wchar_t.cpp
test_string_view.cpp
test_string_wchar_t.cpp
test_string_wchar_t_external_buffer.cpp
test_successor.cpp
test_task_scheduler.cpp
test_threshold.cpp
test_to_arithmetic.cpp
test_to_arithmetic_u16.cpp
test_to_arithmetic_u32.cpp
test_to_arithmetic_u8.cpp
test_to_arithmetic_wchar_t.cpp
test_to_string.cpp
test_to_u16string.cpp
test_to_u32string.cpp
test_to_u8string.cpp
test_to_wstring.cpp
test_tuple.cpp
test_type_def.cpp
test_type_list.cpp
test_type_lookup.cpp
test_type_select.cpp
test_type_traits.cpp
test_unaligned_type.cpp
test_unaligned_type_ext.cpp
test_uncopyable.cpp
test_unordered_map.cpp
test_unordered_multimap.cpp
test_unordered_multiset.cpp
test_unordered_set.cpp
test_user_type.cpp
test_utility.cpp
test_variance.cpp
test_variant_legacy.cpp
test_variant_pool.cpp
test_variant_pool_external_buffer.cpp
test_variant_variadic.cpp
test_vector.cpp
test_vector_external_buffer.cpp
test_vector_non_trivial.cpp
test_vector_pointer.cpp
test_vector_pointer_external_buffer.cpp
test_visitor.cpp
test_xor_checksum.cpp
test_xor_rotate_checksum.cpp
)
target_compile_definitions(etl_tests PRIVATE -DETL_DEBUG)

View File

@ -3617,7 +3617,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3647,7 +3647,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3678,9 +3678,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3707,9 +3707,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3862,7 +3862,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3889,7 +3889,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3917,12 +3917,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3943,12 +3943,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3968,7 +3968,7 @@ 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);

View File

@ -2526,6 +2526,7 @@ namespace
compare_text.replace(compare_text.begin() + 2, compare_text.begin() + 4, TextSTD(STR("Replace")));
compare_text.resize(std::min(compare_text.size(), SIZE));
text.replace(text.begin() + 2, text.begin() + 4, View(STR("Replace")));
bool is_equal = Equal(compare_text, text);
@ -3820,7 +3821,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
@ -3854,7 +3855,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -3885,9 +3886,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -3916,9 +3917,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -4034,7 +4035,7 @@ namespace
TEST_FIXTURE(SetupFixture, test_starts_with_char)
{
TextBufferL buffer1{0};
Text haystack(STR("A haystack with a needle and nothing else"), buffer1.data(), buffer1.size());
Text haystack(STR("A haystack with a needle and nothing else"), buffer1.data(), buffer1.size());
CHECK_TRUE(haystack.starts_with(haystack[0]));
CHECK_FALSE(haystack.starts_with(haystack[1]));
@ -4092,7 +4093,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
@ -4124,7 +4125,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -4151,14 +4152,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = TextL::npos;
@ -4180,14 +4181,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
@ -4208,7 +4209,7 @@ 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);

View File

@ -3631,7 +3631,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3661,7 +3661,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3692,9 +3692,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3721,9 +3721,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3876,7 +3876,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3903,7 +3903,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3931,12 +3931,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3957,12 +3957,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3982,7 +3982,7 @@ 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);

View File

@ -3834,7 +3834,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
@ -3868,7 +3868,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -3899,9 +3899,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -3930,9 +3930,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -4106,7 +4106,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
@ -4138,7 +4138,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -4165,14 +4165,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = TextL::npos;
@ -4194,14 +4194,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
@ -4222,7 +4222,7 @@ 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);

View File

@ -3631,7 +3631,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3661,7 +3661,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3692,9 +3692,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3721,9 +3721,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3876,7 +3876,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3903,7 +3903,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3931,12 +3931,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3957,12 +3957,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3982,7 +3982,7 @@ 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);

View File

@ -3834,7 +3834,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
@ -3868,7 +3868,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -3899,9 +3899,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -3930,9 +3930,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -4106,7 +4106,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
@ -4138,7 +4138,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -4165,14 +4165,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = TextL::npos;
@ -4194,14 +4194,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
@ -4222,7 +4222,7 @@ 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);

View File

@ -3634,7 +3634,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3664,7 +3664,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3695,9 +3695,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3724,9 +3724,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3879,7 +3879,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3906,7 +3906,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3934,12 +3934,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3960,12 +3960,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3985,7 +3985,7 @@ 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);

View File

@ -67,7 +67,7 @@ namespace
// return os;
//}
SUITE(test_string_char16_t_external_buffer)
SUITE(test_string_char8_t_external_buffer)
{
static constexpr size_t SIZE = 11;
static constexpr size_t SIZE_L = 52;
@ -3837,7 +3837,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
@ -3871,7 +3871,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -3902,9 +3902,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -3933,9 +3933,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -4102,14 +4102,17 @@ namespace
TextBufferL buffer1{0};
Text haystack(STR("A haystack with a needle and nothing else"), buffer1.data(), buffer1.size());
CHECK_TRUE(haystack.ends_with(haystack[haystack.size() - 1]));
CHECK_FALSE(haystack.ends_with(haystack[haystack.size() - 2]));
const value_t last = haystack.back();
const value_t not_last = haystack.front();
CHECK_TRUE(haystack.ends_with(last));
CHECK_FALSE(haystack.ends_with(not_last));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
@ -4141,7 +4144,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -4168,14 +4171,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = TextL::npos;
@ -4197,14 +4200,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
@ -4225,7 +4228,7 @@ 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);

View File

@ -3632,7 +3632,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3662,7 +3662,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3693,9 +3693,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3722,9 +3722,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
TextL haystack(the_haystack);
@ -3877,7 +3877,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3904,7 +3904,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
Text needle(STR("needle"));
@ -3932,12 +3932,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3958,12 +3958,12 @@ 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");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = Text::npos;
@ -3983,7 +3983,7 @@ 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);

View File

@ -3837,7 +3837,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_string)
{
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_needle(STR("needle"));
@ -3871,7 +3871,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -3902,9 +3902,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_find_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");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -3933,9 +3933,9 @@ namespace
//*************************************************************************
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 the_haystack[] = STR("A haystack with a needle and another needle");
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
TextSTD compare_haystack(the_haystack);
@ -4109,7 +4109,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_string)
{
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_needle(STR("needle"));
@ -4141,7 +4141,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_rfind_view)
{
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_needle(STR("needle"));
View needle_view(STR("needle"));
@ -4168,14 +4168,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
size_t position2 = TextL::npos;
@ -4197,14 +4197,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);
TextBufferL buffer{0};
Text haystack(the_haystack, buffer.data(), buffer.size());
const value_t* needle = STR("needle");
const value_t needle[] = STR("needle");
size_t position1 = TextSTD::npos;
@ -4225,7 +4225,7 @@ 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);

View File

@ -7,6 +7,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "etl", "etl.vcxproj", "{C21D
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Clang C++20 - Optimised -O2|Win32 = Debug Clang C++20 - Optimised -O2|Win32
Debug Clang C++20 - Optimised -O2|x64 = Debug Clang C++20 - Optimised -O2|x64
Debug Clang C++20|Win32 = Debug Clang C++20|Win32
Debug Clang C++20|x64 = Debug Clang C++20|x64
Debug MSVC C++ 20 - No Tests|Win32 = Debug MSVC C++ 20 - No Tests|Win32
Debug MSVC C++ 20 - No Tests|x64 = Debug MSVC C++ 20 - No Tests|x64
Debug MSVC C++14 - No STL|Win32 = Debug MSVC C++14 - No STL|Win32
@ -39,6 +43,14 @@ Global
Release MSVC C++20 - Optimised O2|x64 = Release MSVC C++20 - Optimised O2|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20 - Optimised -O2|Win32.ActiveCfg = Debug Clang C++20 - Optimised -O2|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20 - Optimised -O2|Win32.Build.0 = Debug Clang C++20 - Optimised -O2|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20 - Optimised -O2|x64.ActiveCfg = Debug Clang C++20 - Optimised -O2|x64
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20 - Optimised -O2|x64.Build.0 = Debug Clang C++20 - Optimised -O2|x64
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20|Win32.ActiveCfg = Debug Clang C++20|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20|Win32.Build.0 = Debug Clang C++20|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20|x64.ActiveCfg = Debug Clang C++20|x64
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug Clang C++20|x64.Build.0 = Debug Clang C++20|x64
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++ 20 - No Tests|Win32.ActiveCfg = Debug MSVC C++ 20 - No Tests|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++ 20 - No Tests|Win32.Build.0 = Debug MSVC C++ 20 - No Tests|Win32
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++ 20 - No Tests|x64.ActiveCfg = Debug MSVC C++ 20 - No Tests|x64

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
20.43.0
20.43.1