mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Updated tests to support C++20 STL
This commit is contained in:
parent
c99d984453
commit
a0023aa9aa
@ -73,7 +73,12 @@ SOFTWARE.
|
||||
#define ETL_POLYMORPHIC_VECTOR
|
||||
#define ETL_POLYMORPHIC_INDIRECT_VECTOR
|
||||
|
||||
#define ETL_CPP20_SUPPORTED 0
|
||||
#if defined(ETL_CPP20_ENABLED)
|
||||
#define ETL_CPP20_SUPPORTED 1
|
||||
#else
|
||||
#define ETL_CPP20_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
|
||||
//#define ETL_POLYMORPHIC_CONTAINERS
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ SOFTWARE.
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <array>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -104,7 +105,8 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_midpoint_etl_random_access_iterator)
|
||||
{
|
||||
etl::deque<int, 10> data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
std::array<int, 10> initial = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
etl::deque<int, 10> data(initial.begin(), initial.end());
|
||||
|
||||
etl::deque<int, 10>::iterator b = data.begin();
|
||||
etl::deque<int, 10>::iterator e = data.end();
|
||||
@ -116,7 +118,8 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_midpoint_etl_bidirectional_iterator)
|
||||
{
|
||||
etl::list<int, 10> data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
std::array<int, 10> initial = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
etl::list<int, 10> data(initial.begin(), initial.end());
|
||||
|
||||
etl::list<int, 10>::iterator b = data.begin();
|
||||
etl::list<int, 10>::iterator e = data.end();
|
||||
|
||||
@ -68,7 +68,7 @@ namespace etl
|
||||
{
|
||||
for (auto c : str)
|
||||
{
|
||||
os << c;
|
||||
os << uint16_t(c);
|
||||
}
|
||||
|
||||
return os;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace etl
|
||||
{
|
||||
for (auto c : str)
|
||||
{
|
||||
os << c;
|
||||
os << uint32_t(c);
|
||||
}
|
||||
|
||||
return os;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace etl
|
||||
{
|
||||
for (auto c : str)
|
||||
{
|
||||
os << c;
|
||||
os << uint16_t(c);
|
||||
}
|
||||
|
||||
return os;
|
||||
|
||||
@ -46,6 +46,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_char)
|
||||
{
|
||||
static const size_t SIZE = 11;
|
||||
|
||||
@ -47,6 +47,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_char)
|
||||
{
|
||||
static constexpr size_t SIZE = 11;
|
||||
|
||||
@ -46,6 +46,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type& c)
|
||||
{
|
||||
os << uint32_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_char)
|
||||
{
|
||||
static const size_t SIZE = 11;
|
||||
|
||||
@ -47,6 +47,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::u32string_ext::value_type& c)
|
||||
{
|
||||
os << uint32_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::u32string_ext::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_char)
|
||||
{
|
||||
static constexpr size_t SIZE = 11;
|
||||
|
||||
@ -40,6 +40,14 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_std_u16)
|
||||
{
|
||||
using String = std::wstring;
|
||||
|
||||
@ -40,6 +40,14 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const std::u32string::value_type& c)
|
||||
{
|
||||
os << uint32_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_std_u32)
|
||||
{
|
||||
using String = std::u32string;
|
||||
|
||||
@ -40,6 +40,14 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_std_wchar_t)
|
||||
{
|
||||
using String = std::wstring;
|
||||
|
||||
@ -38,6 +38,14 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const std::u16string::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_u16)
|
||||
{
|
||||
static const size_t SIZE = 50;
|
||||
|
||||
@ -38,6 +38,14 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type& c)
|
||||
{
|
||||
os << uint32_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_u32)
|
||||
{
|
||||
static const size_t SIZE = 50;
|
||||
|
||||
@ -38,11 +38,19 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_utilities_wchar_t)
|
||||
{
|
||||
static const size_t SIZE = 50;
|
||||
|
||||
using String = etl::wstring<SIZE>;
|
||||
using String = etl::wstring<SIZE>;
|
||||
using IString = etl::iwstring;
|
||||
using StringView = etl::wstring_view;
|
||||
using Char = etl::iwstring::value_type;
|
||||
|
||||
@ -46,6 +46,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_wchar_t)
|
||||
{
|
||||
static const size_t SIZE = 11;
|
||||
@ -581,7 +597,6 @@ namespace
|
||||
CHECK_EQUAL(&constText[0], constText.begin());
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_end)
|
||||
{
|
||||
|
||||
@ -47,6 +47,22 @@ namespace
|
||||
((result1 > 0) && (result2 > 0));
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type& c)
|
||||
{
|
||||
os << uint16_t(c);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type* c)
|
||||
{
|
||||
os << (void*)c;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
SUITE(test_string_char)
|
||||
{
|
||||
static constexpr size_t SIZE = 11;
|
||||
|
||||
@ -810,7 +810,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_CPP20_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user