mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Merge remote-tracking branch 'origin/development'
# Conflicts: # include/etl/to_string.h # include/etl/to_u16string.h # include/etl/to_u32string.h # include/etl/to_wstring.h # support/Release notes.txt
This commit is contained in:
parent
ba3ced4420
commit
cf02ec64c7
@ -326,73 +326,6 @@ namespace
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_no_append)
|
||||
{
|
||||
etl::u16string<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::u16string<20>(STR(" 12.345678")), etl::to_u16string(12.345678, str, Format().precision(6).width(10).right()));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("12.345678 ")), etl::to_u16string(12.345678, str, Format().precision(6).width(10).left()));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_append)
|
||||
{
|
||||
etl::u16string<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 12.345678")), etl::to_u16string(12.345678, str, Format().precision(6).width(10).right(), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 12.345678 ")), etl::to_u16string(12.345678, str, Format().precision(6).width(10).left(), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_no_append)
|
||||
{
|
||||
etl::u16string<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::u16string<20>(STR(" 0")), to_u16string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR(" 1")), to_u16string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("0 ")), to_u16string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("1 ")), to_u16string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
|
||||
CHECK_EQUAL(etl::u16string<20>(STR(" false")), to_u16string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR(" true")), to_u16string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("false ")), to_u16string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("true ")), to_u16string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_append)
|
||||
{
|
||||
etl::u16string<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 0")), to_u16string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 1")), to_u16string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 0 ")), to_u16string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result 1 ")), to_u16string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result false")), to_u16string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result true")), to_u16string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result false ")), to_u16string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u16string<20>(STR("Result true ")), to_u16string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ namespace
|
||||
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" 1.000001")), etl::to_string(1.000001, str, Format().precision(6).width(10).right()));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("1.000001 ")), etl::to_string(1.000001, str, Format().precision(6).width(10).left()));
|
||||
|
||||
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right()));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left()));
|
||||
}
|
||||
@ -329,73 +329,6 @@ namespace
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_no_append)
|
||||
{
|
||||
etl::u32string<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" 12.345678")), etl::to_u32string(12.345678, str, Format().precision(6).width(10).right()));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("12.345678 ")), etl::to_u32string(12.345678, str, Format().precision(6).width(10).left()));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_append)
|
||||
{
|
||||
etl::u32string<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 12.345678")), etl::to_u32string(12.345678, str, Format().precision(6).width(10).right(), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 12.345678 ")), etl::to_u32string(12.345678, str, Format().precision(6).width(10).left(), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_no_append)
|
||||
{
|
||||
etl::u32string<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" 0")), to_u32string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" 1")), to_u32string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("0 ")), to_u32string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("1 ")), to_u32string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" false")), to_u32string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR(" true")), to_u32string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("false ")), to_u32string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("true ")), to_u32string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_append)
|
||||
{
|
||||
etl::u32string<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 0")), to_u32string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 1")), to_u32string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 0 ")), to_u32string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result 1 ")), to_u32string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result false")), to_u32string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result true")), to_u32string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result false ")), to_u32string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::u32string<20>(STR("Result true ")), to_u32string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -392,135 +392,6 @@ namespace
|
||||
to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true);
|
||||
CHECK_EQUAL(compare, str);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_no_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::wstring<20>(STR(" 12.345678")), etl::to_wstring(12.345678, str, Format().precision(6).width(10).right()));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("12.345678 ")), etl::to_wstring(12.345678, str, Format().precision(6).width(10).left()));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_floating_point_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 12.345678")), etl::to_wstring(12.345678, str, Format().precision(6).width(10).right(), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 12.345678 ")), etl::to_wstring(12.345678, str, Format().precision(6).width(10).left(), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_no_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
CHECK_EQUAL(etl::wstring<20>(STR(" 0")), to_wstring(false, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR(" 1")), to_wstring(true, str, Format().precision(6).width(10).right().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("0 ")), to_wstring(false, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("1 ")), to_wstring(true, str, Format().precision(6).width(10).left().boolalpha(false)));
|
||||
|
||||
CHECK_EQUAL(etl::wstring<20>(STR(" false")), to_wstring(false, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR(" true")), to_wstring(true, str, Format().precision(6).width(10).right().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("false ")), to_wstring(false, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("true ")), to_wstring(true, str, Format().precision(6).width(10).left().boolalpha(true)));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_bool_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 0")), to_wstring(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 1")), to_wstring(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 0 ")), to_wstring(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result 1 ")), to_wstring(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result false")), to_wstring(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result true")), to_wstring(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result false ")), to_wstring(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
|
||||
str.assign(STR("Result "));
|
||||
CHECK_EQUAL(etl::wstring<20>(STR("Result true ")), to_wstring(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_pointer_no_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
static const volatile int cvi = 0;
|
||||
|
||||
std::wostringstream oss;
|
||||
oss.width(10);
|
||||
oss.fill(STR('0'));
|
||||
oss << std::hex << std::uppercase << std::right << uintptr_t(&cvi);
|
||||
std::wstring temp(oss.str());
|
||||
etl::wstring<20> compare(temp.begin(), temp.end());
|
||||
|
||||
to_wstring(&cvi, str, Format().hex().width(10).right().fill(STR('0')));
|
||||
CHECK_EQUAL(compare, str);
|
||||
|
||||
oss.clear();
|
||||
oss.str(STR(""));
|
||||
oss.width(10);
|
||||
oss.fill(STR('0'));
|
||||
oss << std::hex << std::uppercase << std::left << uintptr_t(&cvi);
|
||||
temp = oss.str();
|
||||
compare.assign(temp.begin(), temp.end());
|
||||
|
||||
to_wstring(&cvi, str, Format().hex().width(10).left().fill(STR('0')));
|
||||
CHECK_EQUAL(compare, str);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_pointer_append)
|
||||
{
|
||||
etl::wstring<20> str;
|
||||
|
||||
static const volatile int cvi = 0;
|
||||
|
||||
std::wostringstream oss;
|
||||
oss.width(10);
|
||||
oss.fill(STR('0'));
|
||||
oss << std::hex << std::uppercase << std::right << uintptr_t(&cvi);
|
||||
std::wstring temp(STR("Result "));
|
||||
temp.append(oss.str());
|
||||
etl::wstring<20> compare(temp.begin(), temp.end());
|
||||
|
||||
str.assign(STR("Result "));
|
||||
to_wstring(&cvi, str, Format().hex().width(10).right().fill(STR('0')), true);
|
||||
CHECK_EQUAL(compare, str);
|
||||
|
||||
oss.clear();
|
||||
oss.str(STR(""));
|
||||
oss.width(10);
|
||||
oss.fill(STR('0'));
|
||||
oss << std::hex << std::uppercase << std::left << uintptr_t(&cvi);
|
||||
temp = STR("Result ");
|
||||
temp.append(oss.str());
|
||||
compare.assign(temp.begin(), temp.end());
|
||||
|
||||
str.assign(STR("Result "));
|
||||
to_wstring(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true);
|
||||
CHECK_EQUAL(compare, str);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user