Added etl::string_view

This commit is contained in:
John Wellbelove 2017-12-31 20:23:06 +00:00
parent a14e9b25bb
commit 9140ddcd1c
6 changed files with 2168 additions and 393 deletions

875
src/string_view.h Normal file
View File

@ -0,0 +1,875 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef __ETL_STRING_VIEW__
#define __ETL_STRING_VIEW__
#include "platform.h"
#include "memory.h"
#include "iterator.h"
#include "error_handler.h"
#include "exception.h"
#include "char_traits.h"
#include "integral_limits.h"
#include "hash.h"
#include <algorithm>
///\defgroup array array
/// A wrapper for arrays
///\ingroup containers
#undef ETL_FILE
#define ETL_FILE "42"
#ifdef ETL_COMPILER_MICROSOFT
#undef min
#undef max
#endif
namespace etl
{
//***************************************************************************
/// The base class for basic_string_view exceptions.
//***************************************************************************
class string_view_exception : public exception
{
public:
string_view_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
: exception(reason_, file_name_, line_number_)
{
}
};
//***************************************************************************
///\ingroup stack
/// The exception thrown when the index is out of bounds.
//***************************************************************************
class string_view_bounds : public string_view_exception
{
public:
string_view_bounds(string_type file_name_, numeric_type line_number_)
: string_view_exception(ETL_ERROR_TEXT("basic_string_view:bounds", ETL_FILE"A"), file_name_, line_number_)
{
}
};
//***************************************************************************
///\ingroup stack
/// The exception thrown when the view is uninitialised.
//***************************************************************************
class string_view_uninitialised : public string_view_exception
{
public:
string_view_uninitialised(string_type file_name_, numeric_type line_number_)
: string_view_exception(ETL_ERROR_TEXT("basic_string_view:uninitialised", ETL_FILE"B"), file_name_, line_number_)
{
}
};
//***************************************************************************
/// String view.
//***************************************************************************
template <typename T, typename TTraits = etl::char_traits<T> >
class basic_string_view
{
public:
typedef T value_type;
typedef TTraits traits_type;
typedef std::size_t size_type;
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
enum
{
npos = etl::integral_limits<size_t>::max
};
//*************************************************************************
/// Default constructor.
//*************************************************************************
basic_string_view()
: mbegin(nullptr),
mend(nullptr)
{
}
//*************************************************************************
/// Construct from T*.
//*************************************************************************
basic_string_view(const T* begin_)
: mbegin(begin_),
mend(begin_ + TTraits::length(begin_))
{
}
//*************************************************************************
/// Construct from pointer range.
//*************************************************************************
basic_string_view(const T* begin_, const T* end_)
: mbegin(begin_),
mend(end_)
{
}
//*************************************************************************
/// Construct from iterator/size.
//*************************************************************************
template <typename TSize, typename TDummy = typename etl::enable_if<etl::is_integral<TSize>::value, void>::type>
basic_string_view(const T* begin_, TSize size_)
: mbegin(begin_),
mend(begin_ + size_)
{
}
//*************************************************************************
/// Copy constructor
//*************************************************************************
basic_string_view(const basic_string_view& other)
: mbegin(other.mbegin),
mend(other.mend)
{
}
//*************************************************************************
/// Returns a const reference to the first element.
//*************************************************************************
const_reference front() const
{
return *mbegin;
}
//*************************************************************************
/// Returns a const reference to the last element.
//*************************************************************************
const_reference back() const
{
return *(mend - 1);
}
//*************************************************************************
/// Returns a const pointer to the first element of the internal storage.
//*************************************************************************
const_pointer data() const
{
return mbegin;
}
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator begin() const
{
return mbegin;
}
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator cbegin() const
{
return mbegin;
}
//*************************************************************************
/// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator end() const
{
return mend;
}
//*************************************************************************
// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator cend() const
{
return mend;
}
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(mend);
}
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
const_reverse_iterator crbegin() const
{
return const_reverse_iterator(mend);
}
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
const_reverse_iterator rend() const
{
return const_reverse_iterator(mbegin);
}
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
const_reverse_iterator crend() const
{
return const_reverse_iterator(mbegin);
}
//*************************************************************************
// Capacity
//*************************************************************************
//*************************************************************************
/// Returns <b>true</b> if the array size is zero.
//*************************************************************************
bool empty() const
{
return (mbegin == mend);
}
//*************************************************************************
/// Returns the size of the array.
//*************************************************************************
size_t size() const
{
return (mend - mbegin);
}
//*************************************************************************
/// Returns the size of the array.
//*************************************************************************
size_t length() const
{
return size();
}
//*************************************************************************
/// Returns the maximum possible size of the array.
//*************************************************************************
size_t max_size() const
{
return size();
}
//*************************************************************************
/// Assign from a view.
//*************************************************************************
etl::basic_string_view<T, TTraits>& operator=(const etl::basic_string_view<T, TTraits>& other)
{
mbegin = other.mbegin;
mend = other.mend;
return *this;
}
//*************************************************************************
/// Assign from iterators
//*************************************************************************
template <typename TIterator,
typename TDummy = typename etl::enable_if<etl::is_random_iterator<TIterator>::value, void>::type>
void assign(TIterator begin_, TIterator end_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + std::distance(begin_, end_);
}
//*************************************************************************
/// Assign from iterator and size.
//*************************************************************************
template <typename TIterator,
typename TSize,
typename TDummy = typename etl::enable_if<etl::is_random_iterator<TIterator>::value, void>::type>
void assign(TIterator begin_, TSize size_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + size_;
}
//*************************************************************************
/// Returns a const reference to the indexed value.
//*************************************************************************
const_reference operator[](size_t i) const
{
return mbegin[i];
}
//*************************************************************************
/// Returns a const reference to the indexed value.
//*************************************************************************
const_reference at(size_t i) const
{
ETL_ASSERT((mbegin != nullptr && mend != nullptr), ETL_ERROR(string_view_uninitialised));
ETL_ASSERT(i < size(), ETL_ERROR(string_view_bounds));
return mbegin[i];
}
//*************************************************************************
/// Swaps with another basic_string_view.
//*************************************************************************
void swap(basic_string_view& other)
{
std::swap(mbegin, other.mbegin);
std::swap(mend, other.mend);
}
//*************************************************************************
/// Copies characters
//*************************************************************************
size_type copy(T* destination, size_type count, size_type position = 0) const
{
size_t n = 0;
if (position < size())
{
n = std::min(count, size() - position);
std::copy(mbegin + position, mbegin + position + n, destination);
}
return n;
}
//*************************************************************************
/// Returns a substring
//*************************************************************************
basic_string_view substr(size_type position = 0, size_type count = npos) const
{
basic_string_view view;
if (position < size())
{
size_t n = std::min(count, size() - position);
view = basic_string_view(mbegin + position, mbegin + position + n);
}
return view;
}
//*************************************************************************
/// Shrinks the view by moving its start forward.
//*************************************************************************
void remove_prefix(size_type n)
{
mbegin += n;
}
//*************************************************************************
/// Shrinks the view by moving its end backward.
//*************************************************************************
void remove_suffix(size_type n)
{
mend -= n;
}
//*************************************************************************
/// Compares two views
//*************************************************************************
int compare(basic_string_view<T, TTraits> view) const
{
return (*this == view) ? 0 : ((*this > view) ? 1 : -1);
}
int compare(size_type position, size_type count, basic_string_view view) const
{
return substr(position, count).compare(view);
}
int compare(size_type position1, size_type count1,
basic_string_view view,
size_type position2, size_type count2) const
{
return substr(position1, count1).compare(view.substr(position2, count2));
}
int compare(const T* text) const
{
return compare(etl::basic_string_view<T, TTraits>(text));
}
int compare(size_type position, size_type count, const T* text) const
{
return substr(position, count).compare(etl::basic_string_view<T, TTraits>(text));
}
int compare(size_type position, size_type count1, const T* text, size_type count2) const
{
return substr(position, count1).compare(etl::basic_string_view<T, TTraits>(text, count2));
}
//*************************************************************************
/// Checks if the string view starts with the given prefix
//*************************************************************************
bool starts_with(etl::basic_string_view<T, TTraits> view) const
{
return (size() >= view.size()) &&
(compare(0, view.size(), view) == 0);
}
bool starts_with(T c) const
{
return !empty() && (front() == c);
}
bool starts_with(const T* text) const
{
size_t lengthtext = TTraits::length(text);
return (size() >= lengthtext) &&
(compare(0, lengthtext, text) == 0);
}
//*************************************************************************
/// Checks if the string view ends with the given suffix
//*************************************************************************
bool ends_with(etl::basic_string_view<T, TTraits> view) const
{
return (size() >= view.size()) &&
(compare(size() - view.size(), npos, view) == 0);
}
bool ends_with(T c) const
{
return !empty() && (back() == c);
}
bool ends_with(const T* text) const
{
size_t lengthtext = TTraits::length(text);
size_t lengthview = size();
return (lengthview >= lengthtext) &&
(compare(lengthview - lengthtext, lengthtext, text) == 0);
}
//*************************************************************************
/// Find characters in the view
//*************************************************************************
size_type find(etl::basic_string_view<T, TTraits> view, size_type position = 0) const
{
if ((size() < view.size()))
{
return npos;
}
const_iterator iposition = std::search(begin() + position, end(), view.begin(), view.end());
if (iposition == end())
{
return npos;
}
else
{
return std::distance(begin(), iposition);
}
}
size_type find(T c, size_type position = 0) const
{
return find(etl::basic_string_view<T, TTraits>(&c, 1), position);
}
size_type find(const T* text, size_type position, size_type count) const
{
return find(etl::basic_string_view<T, TTraits>(text, count), position);
}
size_type find(const T* text, size_type position = 0) const
{
return find(etl::basic_string_view<T, TTraits>(text), position);
}
//*************************************************************************
/// Find the last occurrence of a substring
//*************************************************************************
size_type rfind(etl::basic_string_view<T, TTraits> view, size_type position = npos) const
{
if ((size() < view.size()))
{
return npos;
}
position = std::min(position, size());
const_iterator iposition = std::find_end(begin(),
begin() + position,
view.begin(),
view.end());
if (iposition == end())
{
return npos;
}
else
{
return std::distance(begin(), iposition);
}
}
size_type rfind(T c, size_type position = npos) const
{
return rfind(etl::basic_string_view<T, TTraits>(&c, 1), position);
}
size_type rfind(const T* text, size_type position, size_type count) const
{
return rfind(etl::basic_string_view<T, TTraits>(text, count), position);
}
size_type rfind(const T* text, size_type position = npos) const
{
return rfind(etl::basic_string_view<T, TTraits>(text), position);
}
//*************************************************************************
/// Find first occurrence of characters
//*************************************************************************
size_type find_first_of(etl::basic_string_view<T, TTraits> view, size_type position = 0) const
{
const size_t lengthtext = size();
if (position < lengthtext)
{
for (size_t i = position; i < lengthtext; ++i)
{
const size_t lengthview = view.size();
for (size_t j = 0; j < lengthview; ++j)
{
if (mbegin[i] == view[j])
{
return i;
}
}
}
}
return npos;
}
size_type find_first_of(T c, size_type position = 0) const
{
return find_first_of(etl::basic_string_view<T, TTraits>(&c, 1), position);
}
size_type find_first_of(const T* text, size_type position, size_type count) const
{
return find_first_of(etl::basic_string_view<T, TTraits>(text, count), position);
}
size_type find_first_of(const T* text, size_type position = 0) const
{
return find_first_of(etl::basic_string_view<T, TTraits>(text), position);
}
//*************************************************************************
/// Find last occurrence of characters
//*************************************************************************
size_type find_last_of(etl::basic_string_view<T, TTraits> view, size_type position = npos) const
{
if (empty())
{
return npos;
}
position = std::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
while (it != rend())
{
const size_t viewlength = view.size();
for (size_t j = 0; j < viewlength; ++j)
{
if (mbegin[position] == view[j])
{
return position;
}
}
++it;
--position;
}
return npos;
}
size_type find_last_of(T c, size_type position = npos) const
{
return find_last_of(etl::basic_string_view<T, TTraits>(&c, 1), position);;
}
size_type find_last_of(const T* text, size_type position, size_type count) const
{
return find_last_of(etl::basic_string_view<T, TTraits>(text, count), position);;
}
size_type find_last_of(const T* text, size_type position = npos) const
{
return find_last_of(etl::basic_string_view<T, TTraits>(text), position);;
}
//*************************************************************************
/// Find first absence of characters
//*************************************************************************
size_type find_first_not_of(etl::basic_string_view<T, TTraits> view, size_type position = 0) const
{
const size_t lengthtext = size();
if (position < lengthtext)
{
for (size_t i = position; i < lengthtext; ++i)
{
bool found = false;
const size_t viewlength = view.size();
for (size_t j = 0; j < viewlength; ++j)
{
if (mbegin[i] == view[j])
{
found = true;
}
}
if (!found)
{
return i;
}
}
}
return npos;
}
size_type find_first_not_of(T c, size_type position = 0) const
{
return find_first_not_of(etl::basic_string_view<T, TTraits>(&c, 1), position);
}
size_type find_first_not_of(const T* text, size_type position, size_type count) const
{
return find_first_not_of(etl::basic_string_view<T, TTraits>(text, count), position);
}
size_type find_first_not_of(const T* text, size_type position = 0) const
{
return find_first_not_of(etl::basic_string_view<T, TTraits>(text), position);
}
//*************************************************************************
/// Find last absence of characters
//*************************************************************************
size_type find_last_not_of(etl::basic_string_view<T, TTraits> view, size_type position = npos) const
{
if (empty())
{
return npos;
}
position = std::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
while (it != rend())
{
bool found = false;
const size_t viewlength = view.size();
for (size_t j = 0; j < viewlength; ++j)
{
if (mbegin[position] == view[j])
{
found = true;
}
}
if (!found)
{
return position;
}
++it;
--position;
}
return npos;
}
size_type find_last_not_of(T c, size_type position = npos) const
{
return find_last_not_of(etl::basic_string_view<T, TTraits>(&c, 1), position);;
}
size_type find_last_not_of(const T* text, size_type position, size_type count) const
{
return find_last_not_of(etl::basic_string_view<T, TTraits>(text, count), position);;
}
size_type find_last_not_of(const T* text, size_type position = npos) const
{
return find_last_not_of(etl::basic_string_view<T, TTraits>(text), position);;
}
//*************************************************************************
/// Equality for array views.
//*************************************************************************
friend bool operator == (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return (lhs.size() == rhs.size()) &&
std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Inequality for array views.
//*************************************************************************
friend bool operator != (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less-than for array views.
//*************************************************************************
friend bool operator < (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************
/// Greater-than for array views.
//*************************************************************************
friend bool operator > (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return rhs < lhs;
}
//*************************************************************************
/// Less-than-equal for array views.
//*************************************************************************
friend bool operator <= (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater-than-equal for array views.
//*************************************************************************
friend bool operator >= (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return !(lhs < rhs);
}
private:
const T* mbegin;
const T* mend;
};
typedef etl::basic_string_view<char> string_view;
typedef etl::basic_string_view<wchar_t> wstring_view;
typedef etl::basic_string_view<char16_t> u16string_view;
typedef etl::basic_string_view<char32_t> u32string_view;
//*************************************************************************
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <>
struct hash<etl::string_view>
{
size_t operator()(const etl::string_view& text) const
{
return etl::__private_hash__::generic_hash<size_t>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
template <>
struct hash<etl::wstring_view>
{
size_t operator()(const etl::wstring_view& text) const
{
return etl::__private_hash__::generic_hash<size_t>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
template <>
struct hash<etl::u16string_view>
{
size_t operator()(const etl::u16string_view& text) const
{
return etl::__private_hash__::generic_hash<size_t>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
template <>
struct hash<etl::u32string_view>
{
size_t operator()(const etl::u32string_view& text) const
{
return etl::__private_hash__::generic_hash<size_t>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
#endif
}
//*************************************************************************
/// Swaps the values.
//*************************************************************************
template <typename T, typename TTraits = etl::char_traits<T>>
void swap(etl::basic_string_view<T, TTraits>& lhs, etl::basic_string_view<T, TTraits>& rhs)
{
lhs.swap(rhs);
}
#ifdef ETL_COMPILER_MICROSOFT
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#undef ETL_FILE
#endif

View File

@ -190,6 +190,7 @@
<Unit filename="../../src/smallest_generator.h" />
<Unit filename="../../src/stack.h" />
<Unit filename="../../src/static_assert.h" />
<Unit filename="../../src/string_view.h" />
<Unit filename="../../src/task.h" />
<Unit filename="../../src/timer.h" />
<Unit filename="../../src/type_def.h" />
@ -359,6 +360,7 @@
<Unit filename="../test_string_char.cpp" />
<Unit filename="../test_string_u16.cpp" />
<Unit filename="../test_string_u32.cpp" />
<Unit filename="../test_string_view.cpp" />
<Unit filename="../test_string_wchar_t.cpp" />
<Unit filename="../test_task_scheduler.cpp" />
<Unit filename="../test_type_def.cpp" />

View File

@ -2,239 +2,114 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Windows" />
<File name="..\test_intrusive_forward_list.cpp" open="1" top="0" tabpos="36" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37971" topLine="942" />
</Cursor>
</File>
<File name="..\..\src\callback_timer.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16444" topLine="558" />
</Cursor>
</File>
<File name="..\..\src\frame_check_sequence.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4943" topLine="79" />
</Cursor>
</File>
<File name="..\..\src\user_type.h" open="1" top="0" tabpos="70" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5459" topLine="68" />
</Cursor>
</File>
<File name="..\..\src\private\vector_base.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5342" topLine="94" />
</Cursor>
</File>
<File name="..\..\src\optional.h" open="1" top="0" tabpos="60" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4686" topLine="111" />
</Cursor>
</File>
<File name="..\..\src\message_router.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5518" topLine="138" />
</Cursor>
</File>
<File name="..\..\src\profiles\gcc_generic.h" open="1" top="0" tabpos="81" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1738" topLine="0" />
</Cursor>
</File>
<File name="..\test_intrusive_queue.cpp" open="1" top="0" tabpos="63" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1641" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\fsm.h" open="1" top="0" tabpos="85" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10751" topLine="298" />
</Cursor>
</File>
<File name="..\test_packet.cpp" open="1" top="0" tabpos="53" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1942" topLine="39" />
</Cursor>
</File>
<File name="..\..\src\murmur3.h" open="1" top="0" tabpos="47" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2487" topLine="52" />
</Cursor>
</File>
<File name="..\..\src\intrusive_list.h" open="1" top="0" tabpos="41" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="33670" topLine="1023" />
</Cursor>
</File>
<File name="..\..\src\cstring.h" open="1" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4190" topLine="72" />
</Cursor>
</File>
<File name="..\test_array.cpp" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9271" topLine="318" />
</Cursor>
</File>
<File name="..\..\src\vector.h" open="1" top="0" tabpos="83" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="832" topLine="7" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_multiset.h" open="1" top="0" tabpos="32" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6534" topLine="199" />
</Cursor>
</File>
<File name="..\..\src\function.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13069" topLine="359" />
</Cursor>
</File>
<File name="..\..\src\profiles\ticc.h" open="1" top="0" tabpos="84" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1902" topLine="0" />
</Cursor>
</File>
<File name="..\test_fsm.cpp" open="1" top="0" tabpos="40" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7419" topLine="228" />
</Cursor>
</File>
<File name="..\..\src\private\ivectorpointer.h" open="1" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18646" topLine="415" />
</Cursor>
</File>
<File name="..\..\src\unordered_multiset.h" open="1" top="0" tabpos="67" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="25789" topLine="730" />
</Cursor>
</File>
<File name="..\test_error_handler.cpp" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2281" topLine="4" />
</Cursor>
</File>
<File name="..\test_callback_timer.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5922" topLine="109" />
</Cursor>
</File>
<File name="..\..\src\profiles\cpp11.h" open="1" top="0" tabpos="79" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\cpp14.h" open="0" top="0" tabpos="80" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1888" topLine="0" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\MemoryOutStream.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\multiset.h" open="0" top="0" tabpos="45" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="178" topLine="0" />
<Cursor1 position="7599" topLine="193" />
</Cursor>
</File>
<File name="..\..\src\type_traits.h" open="1" top="0" tabpos="72" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_binary.cpp" open="0" top="0" tabpos="89" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="12" />
<Cursor1 position="47560" topLine="1228" />
</Cursor>
</File>
<File name="..\test_pearson.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_intrusive_links.cpp" open="0" top="0" tabpos="39" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1707" topLine="29" />
<Cursor1 position="39889" topLine="1110" />
</Cursor>
</File>
<File name="..\test_list.cpp" open="1" top="0" tabpos="44" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2306" topLine="12" />
</Cursor>
</File>
<File name="..\..\src\bitset.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19345" topLine="665" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\HelperMacros.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="35" />
</Cursor>
</File>
<File name="..\..\src\profiles\cpp14.h" open="1" top="0" tabpos="80" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1888" topLine="0" />
</Cursor>
</File>
<File name="..\test_string_char.cpp" open="1" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21608" topLine="677" />
</Cursor>
</File>
<File name="..\test_message_bus.cpp" open="1" top="0" tabpos="87" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5264" topLine="143" />
</Cursor>
</File>
<File name="..\test_endian.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1392" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\profiles\armv5.h" open="1" top="0" tabpos="76" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1889" topLine="0" />
</Cursor>
</File>
<File name="..\test_string_wchar_t.cpp" open="1" top="0" tabpos="57" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21101" topLine="685" />
</Cursor>
</File>
<File name="..\..\src\list.h" open="1" top="0" tabpos="43" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11472" topLine="283" />
</Cursor>
</File>
<File name="..\..\src\profiles\gcc_linux_x86.h" open="1" top="0" tabpos="82" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1735" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\message_bus.h" open="1" top="0" tabpos="86" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\message_bus.h" open="0" top="0" tabpos="86" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9567" topLine="248" />
</Cursor>
</File>
<File name="..\..\src\fixed_iterator.h" open="1" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2474" topLine="34" />
</Cursor>
</File>
<File name="..\..\src\unordered_set.h" open="1" top="0" tabpos="68" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24920" topLine="711" />
</Cursor>
</File>
<File name="..\..\src\queue.h" open="1" top="0" tabpos="48" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5750" topLine="102" />
</Cursor>
</File>
<File name="..\..\src\flat_multiset.h" open="1" top="0" tabpos="33" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11498" topLine="256" />
</Cursor>
</File>
<File name="..\..\src\variant.h" open="1" top="0" tabpos="69" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\variant.h" open="0" top="0" tabpos="69" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="33022" topLine="747" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_map.h" open="1" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\type_traits.h" open="0" top="0" tabpos="72" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6877" topLine="207" />
<Cursor1 position="0" topLine="12" />
</Cursor>
</File>
<File name="..\test_type_traits.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\error_handler.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37662" topLine="472" />
<Cursor1 position="2935" topLine="56" />
</Cursor>
</File>
<File name="..\..\src\basic_string.h" open="0" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="66388" topLine="1848" />
</Cursor>
</File>
<File name="..\test_string_u32.cpp" open="0" top="0" tabpos="56" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21412" topLine="691" />
</Cursor>
</File>
<File name="..\test_packet.cpp" open="0" top="0" tabpos="53" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1942" topLine="39" />
</Cursor>
</File>
<File name="..\..\src\frame_check_sequence.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4943" topLine="79" />
</Cursor>
</File>
<File name="..\..\src\multimap.h" open="0" top="0" tabpos="46" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7557" topLine="193" />
</Cursor>
</File>
<File name="..\..\src\vector.h" open="0" top="0" tabpos="83" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="832" topLine="7" />
</Cursor>
</File>
<File name="..\test_string_wchar_t.cpp" open="0" top="0" tabpos="57" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21101" topLine="685" />
</Cursor>
</File>
<File name="..\..\src\profiles\ticc.h" open="0" top="0" tabpos="84" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1902" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\io_port.h" open="0" top="0" tabpos="42" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4011" topLine="132" />
</Cursor>
</File>
<File name="..\..\src\private\vector_base.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5342" topLine="94" />
</Cursor>
</File>
<File name="..\test_string_view.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30686" topLine="818" />
</Cursor>
</File>
<File name="..\..\src\queue.h" open="0" top="0" tabpos="48" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5750" topLine="102" />
</Cursor>
</File>
<File name="..\..\src\pearson.h" open="0" top="0" tabpos="49" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4500" topLine="94" />
</Cursor>
</File>
<File name="..\test_intrusive_stack.cpp" open="0" top="0" tabpos="58" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1641" topLine="0" />
</Cursor>
</File>
<File name="..\test_checksum.cpp" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -242,154 +117,29 @@
<Cursor1 position="218" topLine="0" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\Checks.cpp" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\fsm.h" open="0" top="0" tabpos="85" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="10751" topLine="298" />
</Cursor>
</File>
<File name="..\..\src\multiset.h" open="1" top="0" tabpos="45" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7599" topLine="193" />
</Cursor>
</File>
<File name="..\..\src\profiles\armv6.h" open="1" top="0" tabpos="77" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1890" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\pearson.h" open="1" top="0" tabpos="49" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4500" topLine="94" />
</Cursor>
</File>
<File name="..\main.cpp" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="141" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\basic_string.h" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="66388" topLine="1848" />
</Cursor>
</File>
<File name="..\..\src\profiles\msvc_x86.h" open="1" top="0" tabpos="73" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1761" topLine="0" />
</Cursor>
</File>
<File name="..\test_flat_multimap.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3425" topLine="85" />
</Cursor>
</File>
<File name="..\..\src\pool.h" open="1" top="0" tabpos="31" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="15670" topLine="382" />
</Cursor>
</File>
<File name="..\..\src\multimap.h" open="1" top="0" tabpos="46" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7557" topLine="193" />
</Cursor>
</File>
<File name="..\..\src\memory.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2221" topLine="0" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\Checks.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="119" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\set.h" open="1" top="0" tabpos="64" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18154" topLine="461" />
</Cursor>
</File>
<File name="..\..\src\message_timer.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14673" topLine="484" />
</Cursor>
</File>
<File name="..\..\src\forward_list.h" open="1" top="0" tabpos="37" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10238" topLine="270" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_multimap.h" open="1" top="0" tabpos="29" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5897" topLine="182" />
</Cursor>
</File>
<File name="..\test_task_scheduler.cpp" open="1" top="0" tabpos="65" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_task_scheduler.cpp" open="0" top="0" tabpos="65" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2139" topLine="52" />
</Cursor>
</File>
<File name="..\data.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_message_bus.cpp" open="0" top="0" tabpos="87" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2648" topLine="75" />
<Cursor1 position="4035" topLine="143" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\Posix\SignalTranslator.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\armv6.h" open="0" top="0" tabpos="77" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1062" topLine="0" />
<Cursor1 position="1890" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\flat_map.h" open="1" top="0" tabpos="28" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_algorithm.cpp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10984" topLine="246" />
</Cursor>
</File>
<File name="..\..\src\static_assert.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1460" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\platform.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1621" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\io_port.h" open="1" top="0" tabpos="42" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4011" topLine="132" />
</Cursor>
</File>
<File name="..\..\src\deque.h" open="1" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="67409" topLine="1989" />
</Cursor>
</File>
<File name="..\test_string_u16.cpp" open="1" top="0" tabpos="52" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21098" topLine="685" />
</Cursor>
</File>
<File name="..\..\src\wstring.h" open="1" top="0" tabpos="55" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5149" topLine="104" />
</Cursor>
</File>
<File name="..\..\src\error_handler.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2935" topLine="56" />
</Cursor>
</File>
<File name="..\..\src\stack.h" open="1" top="0" tabpos="50" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5893" topLine="104" />
</Cursor>
</File>
<File name="..\test_intrusive_stack.cpp" open="1" top="0" tabpos="58" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1641" topLine="0" />
</Cursor>
</File>
<File name="..\test_binary.cpp" open="1" top="1" tabpos="89" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="47560" topLine="1228" />
<Cursor1 position="2243" topLine="43" />
</Cursor>
</File>
<File name="..\..\src\intrusive_flat_map.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -397,134 +147,399 @@
<Cursor1 position="4065" topLine="242" />
</Cursor>
</File>
<File name="..\..\src\type_def.h" open="1" top="0" tabpos="61" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\static_assert.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2398" topLine="38" />
<Cursor1 position="1460" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\exception.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_callback_timer.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3744" topLine="51" />
<Cursor1 position="5922" topLine="109" />
</Cursor>
</File>
<File name="..\test_intrusive_links.cpp" open="1" top="0" tabpos="39" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\fixed_iterator.h" open="0" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="39889" topLine="1110" />
<Cursor1 position="2474" topLine="34" />
</Cursor>
</File>
<File name="..\etl_profile.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\stack.h" open="0" top="0" tabpos="50" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="853" topLine="0" />
<Cursor1 position="5893" topLine="104" />
</Cursor>
</File>
<File name="..\..\src\u32string.h" open="1" top="0" tabpos="54" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\memory.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6674" topLine="103" />
<Cursor1 position="2221" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\array.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\unittest-cpp\UnitTest++\Checks.cpp" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1970" topLine="47" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\unordered_map.h" open="1" top="0" tabpos="62" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\intrusive_list.h" open="0" top="0" tabpos="41" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19759" topLine="537" />
<Cursor1 position="33670" topLine="1023" />
</Cursor>
</File>
<File name="..\..\src\profiles\gcc_windows_x86.h" open="1" top="0" tabpos="74" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\msvc_x86.h" open="0" top="0" tabpos="73" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1761" topLine="0" />
</Cursor>
</File>
<File name="..\test_string_u32.cpp" open="1" top="0" tabpos="56" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\function.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21412" topLine="691" />
<Cursor1 position="13069" topLine="359" />
</Cursor>
</File>
<File name="..\test_message_router.cpp" open="1" top="0" tabpos="88" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\armv5.h" open="0" top="0" tabpos="76" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4827" topLine="140" />
<Cursor1 position="1889" topLine="0" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\CheckMacros.h" open="1" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\message_timer.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19645" topLine="116" />
<Cursor1 position="14673" topLine="484" />
</Cursor>
</File>
<File name="..\..\src\profiles\arduino_arm.h" open="1" top="0" tabpos="75" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\unittest-cpp\UnitTest++\Checks.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1881" topLine="0" />
<Cursor1 position="493" topLine="0" />
</Cursor>
</File>
<File name="..\test_message_timer.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_list.cpp" open="0" top="0" tabpos="44" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2306" topLine="12" />
</Cursor>
</File>
<File name="..\..\src\private\ivectorpointer.h" open="0" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18646" topLine="415" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_set.h" open="0" top="0" tabpos="35" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6404" topLine="199" />
</Cursor>
</File>
<File name="..\test_intrusive_queue.cpp" open="0" top="0" tabpos="63" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1641" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\murmur3.h" open="0" top="0" tabpos="47" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2487" topLine="52" />
</Cursor>
</File>
<File name="..\..\src\exception.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3744" topLine="51" />
</Cursor>
</File>
<File name="..\test_error_handler.cpp" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2281" topLine="4" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\HelperMacros.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="35" />
</Cursor>
</File>
<File name="..\test_string_u16.cpp" open="0" top="0" tabpos="52" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21098" topLine="685" />
</Cursor>
</File>
<File name="..\..\src\type_def.h" open="0" top="0" tabpos="61" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2398" topLine="38" />
</Cursor>
</File>
<File name="..\test_message_timer.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3030" topLine="92" />
</Cursor>
</File>
<File name="..\..\src\enum_type.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3810" topLine="60" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\Win32\TimeHelpers.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="775" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\map.h" open="1" top="0" tabpos="59" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\unittest-cpp\UnitTest++\Posix\SignalTranslator.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7462" topLine="200" />
<Cursor1 position="1062" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\enum_type.h" open="1" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\gcc_linux_x86.h" open="0" top="0" tabpos="82" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3810" topLine="60" />
<Cursor1 position="1735" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\u16string.h" open="1" top="0" tabpos="51" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\profiles\arduino_arm.h" open="0" top="0" tabpos="75" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3035" topLine="57" />
<Cursor1 position="1881" topLine="0" />
</Cursor>
</File>
<File name="..\test_variant.cpp" open="1" top="0" tabpos="71" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_endian.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7555" topLine="221" />
<Cursor1 position="1392" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\profiles\cpp03.h" open="1" top="0" tabpos="78" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\reference_flat_multimap.h" open="0" top="0" tabpos="29" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1891" topLine="0" />
<Cursor1 position="5897" topLine="182" />
</Cursor>
</File>
<File name="..\..\src\binary.h" open="1" top="0" tabpos="90" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_fsm.cpp" open="0" top="0" tabpos="40" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14862" topLine="310" />
<Cursor1 position="7419" topLine="228" />
</Cursor>
</File>
<File name="..\..\src\flat_multimap.h" open="1" top="0" tabpos="30" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24090" topLine="583" />
</Cursor>
</File>
<File name="..\test_exception.cpp" open="1" top="0" tabpos="38" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\test_exception.cpp" open="0" top="0" tabpos="38" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2177" topLine="8" />
</Cursor>
</File>
<File name="..\test_algorithm.cpp" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\bitset.h" open="0" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2243" topLine="43" />
<Cursor1 position="19345" topLine="665" />
</Cursor>
</File>
<File name="..\..\src\flat_set.h" open="1" top="0" tabpos="34" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\src\unordered_set.h" open="0" top="0" tabpos="68" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24920" topLine="711" />
</Cursor>
</File>
<File name="..\test_array.cpp" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9271" topLine="318" />
</Cursor>
</File>
<File name="..\..\src\array.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1970" topLine="47" />
</Cursor>
</File>
<File name="..\..\src\user_type.h" open="0" top="0" tabpos="70" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5459" topLine="68" />
</Cursor>
</File>
<File name="..\..\src\set.h" open="0" top="0" tabpos="64" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18154" topLine="461" />
</Cursor>
</File>
<File name="..\test_flat_multimap.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3425" topLine="85" />
</Cursor>
</File>
<File name="..\test_variant.cpp" open="0" top="0" tabpos="71" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7555" topLine="221" />
</Cursor>
</File>
<File name="..\..\src\profiles\gcc_windows_x86.h" open="0" top="0" tabpos="74" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1761" topLine="0" />
</Cursor>
</File>
<File name="..\test_pearson.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1707" topLine="29" />
</Cursor>
</File>
<File name="..\data.h" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2648" topLine="75" />
</Cursor>
</File>
<File name="..\test_string_char.cpp" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21608" topLine="677" />
</Cursor>
</File>
<File name="..\..\src\list.h" open="0" top="0" tabpos="43" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11472" topLine="283" />
</Cursor>
</File>
<File name="..\..\src\optional.h" open="0" top="0" tabpos="60" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4686" topLine="111" />
</Cursor>
</File>
<File name="..\..\src\map.h" open="0" top="0" tabpos="59" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7462" topLine="200" />
</Cursor>
</File>
<File name="..\..\src\profiles\cpp03.h" open="0" top="0" tabpos="78" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1891" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\flat_multimap.h" open="0" top="0" tabpos="30" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24090" topLine="583" />
</Cursor>
</File>
<File name="..\..\src\cstring.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4190" topLine="27" />
</Cursor>
</File>
<File name="..\..\src\u32string.h" open="0" top="0" tabpos="54" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6674" topLine="103" />
</Cursor>
</File>
<File name="..\main.cpp" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="141" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\profiles\gcc_generic.h" open="0" top="0" tabpos="81" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1738" topLine="0" />
</Cursor>
</File>
<File name="..\etl_profile.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="853" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\flat_set.h" open="0" top="0" tabpos="34" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18892" topLine="471" />
</Cursor>
</File>
<File name="..\..\src\unordered_multimap.h" open="1" top="0" tabpos="66" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="..\..\unittest-cpp\UnitTest++\CheckMacros.h" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19645" topLine="116" />
</Cursor>
</File>
<File name="..\..\src\u16string.h" open="0" top="0" tabpos="51" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3035" topLine="57" />
</Cursor>
</File>
<File name="..\test_intrusive_forward_list.cpp" open="0" top="0" tabpos="36" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37971" topLine="942" />
</Cursor>
</File>
<File name="..\..\src\forward_list.h" open="0" top="0" tabpos="37" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10238" topLine="270" />
</Cursor>
</File>
<File name="..\..\src\platform.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1621" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\unordered_multiset.h" open="0" top="0" tabpos="67" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="25789" topLine="730" />
</Cursor>
</File>
<File name="..\..\src\string_view.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20498" topLine="537" />
</Cursor>
</File>
<File name="..\test_type_traits.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37662" topLine="472" />
</Cursor>
</File>
<File name="..\..\src\flat_map.h" open="0" top="0" tabpos="28" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10984" topLine="246" />
</Cursor>
</File>
<File name="..\..\src\profiles\cpp11.h" open="0" top="0" tabpos="79" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1888" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\binary.h" open="0" top="0" tabpos="90" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14862" topLine="310" />
</Cursor>
</File>
<File name="..\..\src\wstring.h" open="0" top="0" tabpos="55" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5149" topLine="104" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_map.h" open="0" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6877" topLine="207" />
</Cursor>
</File>
<File name="..\..\src\message_router.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5518" topLine="138" />
</Cursor>
</File>
<File name="..\test_array_view.cpp" open="0" top="0" tabpos="91" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17474" topLine="550" />
</Cursor>
</File>
<File name="..\..\src\callback_timer.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16444" topLine="558" />
</Cursor>
</File>
<File name="..\..\unittest-cpp\UnitTest++\MemoryOutStream.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="178" topLine="0" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_multiset.h" open="0" top="0" tabpos="32" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6534" topLine="199" />
</Cursor>
</File>
<File name="..\..\src\flat_multiset.h" open="0" top="0" tabpos="33" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11498" topLine="256" />
</Cursor>
</File>
<File name="..\..\src\pool.h" open="0" top="0" tabpos="31" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="15670" topLine="382" />
</Cursor>
</File>
<File name="..\..\src\unordered_map.h" open="0" top="0" tabpos="62" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19759" topLine="537" />
</Cursor>
</File>
<File name="..\test_message_router.cpp" open="0" top="0" tabpos="88" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4827" topLine="140" />
</Cursor>
</File>
<File name="..\..\src\deque.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="67409" topLine="1989" />
</Cursor>
</File>
<File name="..\..\src\unordered_multimap.h" open="0" top="0" tabpos="66" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="33847" topLine="959" />
</Cursor>
</File>
<File name="..\..\src\reference_flat_set.h" open="1" top="0" tabpos="35" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6404" topLine="199" />
</Cursor>
</File>
</CodeBlocks_layout_file>

873
test/test_string_view.cpp Normal file
View File

@ -0,0 +1,873 @@
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#include "UnitTest++.h"
#include "string_view.h"
#include "cstring.h"
#include "wstring.h"
#include "u16string.h"
#include "u32string.h"
#include "hash.h"
#include <algorithm>
#include <iterator>
#include <string>
#include <array>
#include <ostream>
namespace
{
typedef etl::string_view View;
static const size_t SIZE = 10;
etl::string<11> etltext = "Hello World";
std::string text = "Hello World";
std::string text_smaller = "Hello Worlc";
std::string text_shorter = "Hello Worl";
std::string text_different = "Goodbye!!!!";
char ctext[] = { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd' };
char* pctext = ctext;
std::ostream& operator << (std::ostream& os, const View& view)
{
os << uintptr_t(view.begin()) << " " << uintptr_t(view.end());
return os;
}
SUITE(test_string_view)
{
//*************************************************************************
TEST(test_default_constructor)
{
View view;
CHECK_EQUAL(0U, view.size());
CHECK_EQUAL(0U, view.max_size());
CHECK(view.empty());
}
//*************************************************************************
TEST(test_constructor_pointer_range)
{
View view(pctext, pctext + strlen(pctext));
CHECK_EQUAL(text.size(), view.size());
CHECK_EQUAL(text.size(), view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_constructor_pointer_size)
{
View view(pctext, strlen(pctext));
CHECK_EQUAL(text.size(), view.size());
CHECK_EQUAL(text.size(), view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_constructor_pointer)
{
View view(pctext);
CHECK_EQUAL(text.size(), view.size());
CHECK_EQUAL(text.size(), view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_constructor_literal)
{
View view("Hello World");
CHECK_EQUAL(text.size(), view.size());
CHECK_EQUAL(text.size(), view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_assign_from_string_view)
{
View view1(text.c_str());
View view2;
view2 = view1;
CHECK_EQUAL(view1.size(), view2.size());
CHECK_EQUAL(view1.max_size(), view2.max_size());
bool isEqual;
isEqual = std::equal(view1.begin(), view1.end(), view2.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_assign_from_iterator_range)
{
View view;
view.assign(text.c_str(), text.size());
CHECK_EQUAL(text.size(), view.size());
CHECK_EQUAL(text.size(), view.max_size());
bool isEqual;
isEqual = std::equal(text.begin(), text.end(), view.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_begin_end)
{
View view(text.c_str(), text.size());
CHECK_EQUAL(view.begin(), view.cbegin());
CHECK_EQUAL(view.rbegin().base(), view.crbegin().base());
CHECK_EQUAL(view.end(), view.cend());
CHECK_EQUAL(view.rend().base(), view.crend().base());
}
//*************************************************************************
TEST(test_front_back)
{
View view(text.c_str(), text.size());
CHECK_EQUAL(text.front(), view.front());
CHECK_EQUAL(text.back(), view.back());
}
//*************************************************************************
TEST(test_data)
{
View view(text.c_str(), text.size());
CHECK_EQUAL(text.data(), view.data());
}
//*************************************************************************
TEST(test_index_operator)
{
View view(text.c_str(), text.size());
for (size_t i = 0; i < text.size(); ++i)
{
CHECK_EQUAL(text[i], view[i]);
}
}
//*************************************************************************
TEST(test_at)
{
View view(text.c_str(), text.size());
for (size_t i = 0; i < text.size(); ++i)
{
CHECK_EQUAL(text[i], view.at(i));
}
}
//*************************************************************************
TEST(test_at_uninitialised_exception)
{
View view;
CHECK_THROW(view.at(0), etl::string_view_uninitialised);
}
//*************************************************************************
TEST(test_at_bounds_exception)
{
View view(text.c_str(), text.size());
CHECK_THROW(view.at(view.size()), etl::string_view_bounds);
}
//*************************************************************************
TEST(test_non_member_same)
{
View view1(text.c_str(), text.size());
View view2(text.c_str(), text.size());
CHECK(view1 == view2);
CHECK(view1 <= view2);
CHECK(view1 >= view2);
CHECK(!(view1 > view2));
CHECK(!(view1 < view2));
}
//*************************************************************************
TEST(test_non_member_smaller)
{
View view1(text.c_str(), text.size());
View view2(text_smaller.c_str(), text_smaller.size());
CHECK(!(view1 == view2));
CHECK(!(view1 <= view2));
CHECK(view2 <= view1);
CHECK(view1 >= view2);
CHECK(!(view2 >= view1));
CHECK(view1 > view2);
CHECK(!(view2 > view1));
CHECK(!(view1 < view2));
CHECK(view2 < view1);
}
//*************************************************************************
TEST(test_non_member_shorter)
{
View view1(text.c_str(), text.size());
View view2(text_shorter.c_str(), text_shorter.size());
CHECK(!(view1 == view2));
CHECK(!(view1 <= view2));
CHECK(view2 <= view1);
CHECK(view1 >= view2);
CHECK(!(view2 >= view1));
CHECK(view1 > view2);
CHECK(!(view2 > view1));
CHECK(!(view1 < view2));
CHECK(view2 < view1);
}
//*************************************************************************
TEST(test_empty)
{
View view1(text.c_str(), text.c_str());
CHECK(view1.empty());
View view2(text.c_str(), text.c_str() + 1);
CHECK(!view2.empty());
}
//*************************************************************************
TEST(test_swap)
{
View view1(text.c_str());
View view2(text_smaller.c_str());
std::swap(view1, view2);
CHECK_EQUAL(text.size(), view1.size());
CHECK_EQUAL(text_smaller.size(), view2.size());
bool isEqual;
isEqual = std::equal(view1.begin(), view1.end(), text_smaller.begin());
CHECK(isEqual);
isEqual = std::equal(view2.begin(), view2.end(), text.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_remove_prefix_suffix)
{
std::string original = "Hello World";
std::string prefix = "llo World";
std::string prefixsuffix = "llo Wor";
View view(original.c_str());
bool isEqual;
view.remove_prefix(2);
isEqual = std::equal(view.begin(), view.end(), prefix.begin());
CHECK(isEqual);
view.remove_suffix(2);
isEqual = std::equal(view.begin(), view.end(), prefixsuffix.begin());
CHECK(isEqual);
}
//*************************************************************************
TEST(test_copy)
{
View view(text.c_str());
std::array<char, 12> destination;
std::array<char, 12> blank;
size_t count;
blank.fill(0);
// Full text.
destination.fill(0);
count = view.copy(destination.data(), text.size(), 0);
CHECK_EQUAL(text.size(), count);
CHECK_EQUAL(text.size(), strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data(), destination.data(), text.size());
// From position 2, count OK.
destination.fill(0);
count = view.copy(destination.data(), text.size() - 2, 2);
CHECK_EQUAL(text.size() - 2, count);
CHECK_EQUAL(text.size() - 2, strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2);
// From position 2, count too large.
destination.fill(0);
count = view.copy(destination.data(), text.size(), 2);
CHECK_EQUAL(text.size() - 2, count);
CHECK_EQUAL(text.size() - 2, strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2);
// Position too large.
destination.fill(0);
count = view.copy(destination.data(), text.size(), 11);
CHECK_EQUAL(0U, count);
CHECK_ARRAY_EQUAL(blank.data(), destination.data(), text.size());
// From position 2, short range.
destination.fill(0);
count = view.copy(destination.data(), text.size() - 4, 2);
CHECK_EQUAL(text.size() - 4, count);
CHECK_EQUAL(text.size() - 4, strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 4);
}
//*************************************************************************
TEST(test_substr)
{
View view1(text.c_str());
View view2(text.c_str() + 2, text.size() - 2);
View view3;
View view4(text.c_str() + 2, text.size() - 2);
View sub;
// Whole string.
sub = view1.substr(0, text.size());
CHECK_EQUAL(view1, sub);
// From from +2 to -2.
sub = view1.substr(2, text.size() - 2);
CHECK_EQUAL(view2, sub);
// Position too large.
sub = view1.substr(text.size(), 2);
CHECK_EQUAL(view3, sub);
// Count too large.
sub = view1.substr(2, text.size());
CHECK_EQUAL(view4, sub);
}
//*************************************************************************
TEST(test_compare_basic_string_view)
{
View view(text.c_str());
View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str());
CHECK_EQUAL(0, view.compare(view));
CHECK_EQUAL(-1, view_smaller.compare(view));
CHECK_EQUAL(-1, view_shorter.compare(view));
CHECK_EQUAL(1, view.compare(view_smaller));
CHECK_EQUAL(1, view.compare(view_shorter));
}
//*************************************************************************
TEST(test_compare_position_count_view)
{
View view(text.c_str());
View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str());
std::string text_long = std::string("xx") + text + std::string("xx");
View view_long(text_long.c_str());
std::string text_smaller_long = std::string("xx") + text_smaller + std::string("xx");
View view_smaller_long(text_smaller_long.c_str());
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter));
}
//*************************************************************************
TEST(test_compare_position_count_view_position_count)
{
View view(text.c_str());
std::string text_long = std::string("xx") + text + std::string("xx");
View view_long(text_long.c_str());
std::string text_smaller_long = std::string("xx") + text_smaller + std::string("xx");
View view_smaller_long(text_smaller_long.c_str());
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view_long, 2, view.size()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long, 2, view.size()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long, 2, view.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller_long, 2, view.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter_long, 2, text_shorter.size()));
}
//*************************************************************************
TEST(test_compare_text)
{
View view(text.c_str());
View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str());
CHECK_EQUAL(0, view.compare(view.data()));
CHECK_EQUAL(-1, view_smaller.compare(view.data()));
CHECK_EQUAL(1, view.compare(view_smaller.data()));
CHECK_EQUAL(-1, view_shorter.compare(view.data()));
CHECK_EQUAL(1, view.compare(view_shorter.data()));
}
//*************************************************************************
TEST(test_compare_position_count_text)
{
View view(text.c_str());
View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str());
std::string text_long = std::string("xx") + text + std::string("xx");
View view_long(text_long.c_str());
std::string text_smaller_long = std::string("xx") + text_smaller + std::string("xx");
View view_smaller_long(text_smaller_long.c_str());
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view.data()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long.data()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long.data()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller.data()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter.data()));
}
//*************************************************************************
TEST(test_compare_position_count_text_count)
{
View view(text.c_str());
View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str());
std::string text_long = std::string("xx") + text + std::string("xx");
View view_long(text_long.c_str());
std::string text_smaller_long = std::string("xx") + text_smaller + std::string("xx");
View view_smaller_long(text_smaller_long.c_str());
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view.data(), view.size()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long.data(), view_long.size()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long.data(), view_long.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller.data(), view_smaller.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter.data(), view_shorter.size()));
}
//*************************************************************************
TEST(test_starts_with)
{
View view(text.c_str());
View start("Hello");
View notstart("Gello");
View notstartlong("Hello Worldxxxxxx");
CHECK(view.starts_with(start));
CHECK(!view.starts_with(notstart));
CHECK(!view.starts_with(notstartlong));
CHECK(view.starts_with('H'));
CHECK(!view.starts_with('G'));
CHECK(view.starts_with("Hello"));
CHECK(!view.starts_with("Gello"));
CHECK(!view.starts_with("Hello Worldxxxxxx"));
}
//*************************************************************************
TEST(test_ends_with)
{
View view(text.c_str());
View end("World");
View notend("Xorld");
View notendlong("Hello Worldxxxxxx");
CHECK(view.ends_with(end));
CHECK(!view.ends_with(notend));
CHECK(!view.ends_with(notendlong));
CHECK(view.ends_with('d'));
CHECK(!view.ends_with('e'));
CHECK(view.ends_with("World"));
CHECK(!view.ends_with("Xorld"));
CHECK(!view.ends_with("Hello Worldxxxxxx"));
}
//*************************************************************************
TEST(test_find)
{
const char* s1 = "Hello";
const char* s2 = "llo Wor";
const char* s3 = "World";
const char* s4 = "Xorld";
const char* s5 = "Hello Worldxxxxxx";
View view(text.c_str());
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
View v5(s5);
CHECK_EQUAL(0U, view.find(v1));
CHECK_EQUAL(2U, view.find(v2));
CHECK_EQUAL(2U, view.find(v2, 2));
CHECK_EQUAL(6U, view.find(v3));
CHECK_EQUAL(View::npos, view.find(v3, 7));
CHECK_EQUAL(View::npos, view.find(v4));
CHECK_EQUAL(View::npos, view.find(v5));
CHECK_EQUAL(0U, view.find('H'));
CHECK_EQUAL(2U, view.find('l'));
CHECK_EQUAL(2U, view.find('l', 2));
CHECK_EQUAL(View::npos, view.find('X'));
CHECK_EQUAL(0U, view.find(s1));
CHECK_EQUAL(2U, view.find(s2));
CHECK_EQUAL(2U, view.find(s2, 2));
CHECK_EQUAL(6U, view.find(s3));
CHECK_EQUAL(View::npos, view.find(s3, 7));
CHECK_EQUAL(View::npos, view.find(s4));
CHECK_EQUAL(View::npos, view.find(s5));
CHECK_EQUAL(0U, view.find(s1, 0, 3));
CHECK_EQUAL(2U, view.find(s2, 0, 3));
CHECK_EQUAL(2U, view.find(s2, 2, 3));
CHECK_EQUAL(6U, view.find(s3, 0, 3));
CHECK_EQUAL(View::npos, view.find(s3, 7, 3));
CHECK_EQUAL(View::npos, view.find(s4, 0, 3));
CHECK_EQUAL(View::npos, view.find(s5, 0, 15));
}
//*************************************************************************
TEST(test_rfind)
{
const char* s1 = "ab";
const char* s2 = "cd";
const char* s3 = "bcd";
const char* s4 = "abcdabcdabcd";
View view("abcdabcdab");
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
CHECK_EQUAL(8U, view.rfind(v1));
CHECK_EQUAL(6U, view.rfind(v2));
CHECK_EQUAL(2U, view.rfind(v2, 5));
CHECK_EQUAL(View::npos, view.rfind(v4));
CHECK_EQUAL(8U, view.rfind('a'));
CHECK_EQUAL(6U, view.rfind('c'));
CHECK_EQUAL(2U, view.rfind('c', 5));
CHECK_EQUAL(8U, view.rfind(s1));
CHECK_EQUAL(6U, view.rfind(s2));
CHECK_EQUAL(2U, view.rfind(s2, 5));
CHECK_EQUAL(View::npos, view.rfind(s4));
CHECK_EQUAL(1U, view.rfind(s3, 5, 2));
CHECK_EQUAL(View::npos, view.rfind(s4, 0, 11));
}
//*************************************************************************
TEST(test_find_first_of)
{
const char* s1 = "l";
const char* s2 = "o";
const char* s3 = "W";
const char* s4 = "Wol";
const char* s5 = "wOL";
View view("Hello World");
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
View v5(s5);
CHECK_EQUAL(2U, view.find_first_of(v1));
CHECK_EQUAL(4U, view.find_first_of(v2));
CHECK_EQUAL(6U, view.find_first_of(v3));
CHECK_EQUAL(2U, view.find_first_of(v4));
CHECK_EQUAL(View::npos, view.find_first_of(v5));
CHECK_EQUAL(3U, view.find_first_of(v1, 3));
CHECK_EQUAL(4U, view.find_first_of(v2, 2));
CHECK_EQUAL(View::npos, view.find_first_of(v3, 7));
CHECK_EQUAL(6U, view.find_first_of(v4, 5));
CHECK_EQUAL(View::npos, view.find_first_of(v5, 2));
CHECK_EQUAL(2U, view.find_first_of('l'));
CHECK_EQUAL(4U, view.find_first_of('o'));
CHECK_EQUAL(6U, view.find_first_of('W'));
CHECK_EQUAL(View::npos, view.find_first_of('w'));
CHECK_EQUAL(2U, view.find_first_of(s1));
CHECK_EQUAL(4U, view.find_first_of(s2));
CHECK_EQUAL(6U, view.find_first_of(s3));
CHECK_EQUAL(2U, view.find_first_of(s4));
CHECK_EQUAL(View::npos, view.find_first_of(s5));
CHECK_EQUAL(3U, view.find_first_of(s1, 3));
CHECK_EQUAL(4U, view.find_first_of(s2, 2));
CHECK_EQUAL(View::npos, view.find_first_of(s3, 7));
CHECK_EQUAL(6U, view.find_first_of(s4, 5));
CHECK_EQUAL(View::npos, view.find_first_of(s5, 2));
CHECK_EQUAL(3U, view.find_first_of(s1, 3, 1));
CHECK_EQUAL(4U, view.find_first_of(s2, 2, 1));
CHECK_EQUAL(View::npos, view.find_first_of(s3, 7, 1));
CHECK_EQUAL(4U, view.find_first_of(s4, 0, 2));
CHECK_EQUAL(View::npos, view.find_first_of(s5, 2, 3));
}
//*************************************************************************
TEST(test_find_last_of)
{
const char* s1 = "l";
const char* s2 = "o";
const char* s3 = "W";
const char* s4 = "Wol";
const char* s5 = "wOL";
View view("Hello World");
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
View v5(s5);
CHECK_EQUAL(9U, view.find_last_of(v1));
CHECK_EQUAL(7U, view.find_last_of(v2));
CHECK_EQUAL(6U, view.find_last_of(v3));
CHECK_EQUAL(9U, view.find_last_of(v4));
CHECK_EQUAL(View::npos, view.find_last_of(v5));
CHECK_EQUAL(3U, view.find_last_of(v1, 3));
CHECK_EQUAL(View::npos, view.find_last_of(v2, 2));
CHECK_EQUAL(6U, view.find_last_of(v3, 7));
CHECK_EQUAL(4U, view.find_last_of(v4, 5));
CHECK_EQUAL(View::npos, view.find_last_of(v5, 2));
CHECK_EQUAL(9U, view.find_last_of('l'));
CHECK_EQUAL(7U, view.find_last_of('o'));
CHECK_EQUAL(6U, view.find_last_of('W'));
CHECK_EQUAL(View::npos, view.find_last_of('w'));
CHECK_EQUAL(9U, view.find_last_of(s1));
CHECK_EQUAL(7U, view.find_last_of(s2));
CHECK_EQUAL(6U, view.find_last_of(s3));
CHECK_EQUAL(9U, view.find_last_of(s4));
CHECK_EQUAL(View::npos, view.find_last_of(s5));
CHECK_EQUAL(3U, view.find_last_of(s1, 3));
CHECK_EQUAL(View::npos, view.find_last_of(s2, 2));
CHECK_EQUAL(6U, view.find_last_of(s3, 7));
CHECK_EQUAL(4U, view.find_last_of(s4, 5));
CHECK_EQUAL(View::npos, view.find_last_of(s5, 2));
CHECK_EQUAL(3U, view.find_last_of(s1, 3, 1));
CHECK_EQUAL(View::npos, view.find_last_of(s2, 2, 1));
CHECK_EQUAL(6U, view.find_last_of(s3, 7, 1));
CHECK_EQUAL(4U, view.find_last_of(s4, 5, 2));
CHECK_EQUAL(View::npos, view.find_last_of(s5, 2, 3));
}
//*************************************************************************
TEST(test_find_first_not_of)
{
const char* s1 = "H";
const char* s2 = "eH";
const char* s3 = "leH";
const char* s4 = " olleH";
const char* s5 = "wOL";
const char* s6 = "Helo Wrd";
View view("Hello World");
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
View v5(s5);
View v6(s6);
CHECK_EQUAL(1U, view.find_first_not_of(v1));
CHECK_EQUAL(2U, view.find_first_not_of(v2));
CHECK_EQUAL(4U, view.find_first_not_of(v3));
CHECK_EQUAL(6U, view.find_first_not_of(v4));
CHECK_EQUAL(0U, view.find_first_not_of(v5));
CHECK_EQUAL(View::npos, view.find_first_not_of(v6));
CHECK_EQUAL(3U, view.find_first_not_of(v1, 3));
CHECK_EQUAL(2U, view.find_first_not_of(v2, 2));
CHECK_EQUAL(7U, view.find_first_not_of(v3, 7));
CHECK_EQUAL(6U, view.find_first_not_of(v4, 5));
CHECK_EQUAL(2U, view.find_first_not_of(v5, 2));
CHECK_EQUAL(View::npos, view.find_first_not_of(v6, 0));
CHECK_EQUAL(1U, view.find_first_not_of('H'));
CHECK_EQUAL(0U, view.find_first_not_of('e'));
CHECK_EQUAL(1U, view.find_first_not_of(s1));
CHECK_EQUAL(2U, view.find_first_not_of(s2));
CHECK_EQUAL(4U, view.find_first_not_of(s3));
CHECK_EQUAL(6U, view.find_first_not_of(s4));
CHECK_EQUAL(0U, view.find_first_not_of(s5));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6));
CHECK_EQUAL(3U, view.find_first_not_of(s1, 3));
CHECK_EQUAL(2U, view.find_first_not_of(s2, 2));
CHECK_EQUAL(7U, view.find_first_not_of(s3, 7));
CHECK_EQUAL(6U, view.find_first_not_of(s4, 5));
CHECK_EQUAL(2U, view.find_first_not_of(s5, 2));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6, 0));
CHECK_EQUAL(3U, view.find_first_not_of(s1, 3, 1));
CHECK_EQUAL(2U, view.find_first_not_of(s2, 2, 1));
CHECK_EQUAL(7U, view.find_first_not_of(s3, 7, 1));
CHECK_EQUAL(6U, view.find_first_not_of(s4, 5, 2));
CHECK_EQUAL(2U, view.find_first_not_of(s5, 2, 3));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6, 0, 8));
}
//*************************************************************************
TEST(test_find_last_not_of)
{
const char* s1 = "d";
const char* s2 = "dl";
const char* s3 = "dlr";
const char* s4 = "dlroW";
const char* s5 = "DLROw";
const char* s6 = "Helo Wrd";
View view("Hello World");
View v1(s1);
View v2(s2);
View v3(s3);
View v4(s4);
View v5(s5);
View v6(s6);
CHECK_EQUAL(9U, view.find_last_not_of(v1));
CHECK_EQUAL(8U, view.find_last_not_of(v2));
CHECK_EQUAL(7U, view.find_last_not_of(v3));
CHECK_EQUAL(5U, view.find_last_not_of(v4));
CHECK_EQUAL(10U, view.find_last_not_of(v5));
CHECK_EQUAL(View::npos, view.find_last_not_of(v6));
CHECK_EQUAL(9U, view.find_last_not_of(v1, 10));
CHECK_EQUAL(8U, view.find_last_not_of(v2, 9));
CHECK_EQUAL(7U, view.find_last_not_of(v3, 8));
CHECK_EQUAL(5U, view.find_last_not_of(v4, 8));
CHECK_EQUAL(8U, view.find_last_not_of(v5, 8));
CHECK_EQUAL(View::npos, view.find_last_not_of(v6, 10));
CHECK_EQUAL(9U, view.find_last_not_of('d'));
CHECK_EQUAL(10U, view.find_last_not_of('l'));
CHECK_EQUAL(9U, view.find_last_not_of(s1));
CHECK_EQUAL(8U, view.find_last_not_of(s2));
CHECK_EQUAL(7U, view.find_last_not_of(s3));
CHECK_EQUAL(5U, view.find_last_not_of(s4));
CHECK_EQUAL(10U, view.find_last_not_of(s5));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6));
CHECK_EQUAL(9U, view.find_last_not_of(s1, 10));
CHECK_EQUAL(8U, view.find_last_not_of(s2, 9));
CHECK_EQUAL(7U, view.find_last_not_of(s3, 8));
CHECK_EQUAL(5U, view.find_last_not_of(s4, 8));
CHECK_EQUAL(8U, view.find_last_not_of(s5, 8));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6, 10));
CHECK_EQUAL(9U, view.find_last_not_of(s1, 10, 1));
CHECK_EQUAL(9U, view.find_last_not_of(s2, 9, 1));
CHECK_EQUAL(8U, view.find_last_not_of(s3, 9, 2));
CHECK_EQUAL(7U, view.find_last_not_of(s4, 8, 3));
CHECK_EQUAL(8U, view.find_last_not_of(s5, 8, 5));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6, 10, 8));
}
//*************************************************************************
TEST(test_hash)
{
typedef etl::string<11> Text;
typedef etl::wstring<11> WText;
typedef etl::u16string<11> U16Text;
typedef etl::u32string<11> U32Text;
typedef etl::string_view View;
typedef etl::wstring_view WView;
typedef etl::u16string_view U16View;
typedef etl::u32string_view U32View;
Text text("Hello World");
WText wtext(L"Hello World");
U16Text u16text(u"Hello World");
U32Text u32text(U"Hello World");
View view(text.data());
WView wview(wtext.data());
U16View u16view(u16text.data());
U32View u32view(u32text.data());
CHECK_EQUAL(etl::hash<Text>()(text), etl::hash<View>()(view));
CHECK_EQUAL(etl::hash<WText>()(wtext), etl::hash<WView>()(wview));
CHECK_EQUAL(etl::hash<U16Text>()(u16text), etl::hash<U16View>()(u16view));
CHECK_EQUAL(etl::hash<U32Text>()(u32text), etl::hash<U32View>()(u32view));
}
};
}

View File

@ -78,6 +78,8 @@
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<LanguageStandard>
</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -162,6 +164,7 @@
<ClInclude Include="..\..\src\scheduler.h" />
<ClInclude Include="..\..\src\smallest_generator.h" />
<ClInclude Include="..\..\src\sqrt.h" />
<ClInclude Include="..\..\src\string_view.h" />
<ClInclude Include="..\..\src\task.h" />
<ClInclude Include="..\..\src\timer.h" />
<ClInclude Include="..\..\src\type_lookup.h" />
@ -443,6 +446,7 @@
<ClCompile Include="..\test_string_char.cpp" />
<ClCompile Include="..\test_string_u16.cpp" />
<ClCompile Include="..\test_string_u32.cpp" />
<ClCompile Include="..\test_string_view.cpp" />
<ClCompile Include="..\test_string_wchar_t.cpp" />
<ClCompile Include="..\test_task_scheduler.cpp" />
<ClCompile Include="..\test_type_def.cpp" />

View File

@ -564,6 +564,9 @@
<ClInclude Include="..\..\src\array_view.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
<ClInclude Include="..\..\src\string_view.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">
@ -941,6 +944,9 @@
<ClCompile Include="..\test_array_view.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_string_view.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Doxyfile">