From cf02ec64c762af8b6bd02cc0d821a47f25d5cfb9 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 15 Apr 2019 19:39:27 +0100 Subject: [PATCH] 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 --- test/test_to_u16string.cpp | 67 ------------------- test/test_to_u32string.cpp | 69 +------------------- test/test_to_wstring.cpp | 129 ------------------------------------- 3 files changed, 1 insertion(+), 264 deletions(-) diff --git a/test/test_to_u16string.cpp b/test/test_to_u16string.cpp index f36f0859..f1aea7da 100644 --- a/test/test_to_u16string.cpp +++ b/test/test_to_u16string.cpp @@ -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)); - } }; } diff --git a/test/test_to_u32string.cpp b/test/test_to_u32string.cpp index e2ce928b..4064dde8 100644 --- a/test/test_to_u32string.cpp +++ b/test/test_to_u32string.cpp @@ -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)); - } }; } diff --git a/test/test_to_wstring.cpp b/test/test_to_wstring.cpp index 48b8cb40..bc575ce1 100644 --- a/test/test_to_wstring.cpp +++ b/test/test_to_wstring.cpp @@ -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); - } }; }