diff --git a/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp @@ -28,18 +28,20 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" - -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - std::basic_string out = std::format(std::locale(), fmt.template sv(), args...); - if constexpr (std::same_as) - if (out != expected) - std::cerr << "\nFormat string " << fmt.template sv() << "\nExpected output " << expected - << "\nActual output " << out << '\n'; - assert(out == expected); -}; - -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +#include "test_format_string.h" + +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + std::basic_string out = std::format(std::locale(), fmt, std::forward(args)...); + if constexpr (std::same_as) + if (out != expected) + std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " + << out << '\n'; + assert(out == expected); + }; + +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format.locale.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp @@ -30,25 +30,27 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" #ifndef TEST_HAS_NO_LOCALIZATION # include # include #endif -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - std::basic_string out = std::format(fmt.template sv(), args...); +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + std::basic_string out = std::format(fmt, std::forward(args)...); #ifndef TEST_HAS_NO_LOCALIZATION - if constexpr (std::same_as) - if (out != expected) - std::cerr << "\nFormat string " << fmt.template sv() << "\nExpected output " << expected - << "\nActual output " << out << '\n'; + if constexpr (std::same_as) + if (out != expected) + std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " + << out << '\n'; #endif - assert(out == expected); -}; + assert(out == expected); + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -186,50 +186,50 @@ void format_test_string(const W& world, const U& universe, TestFunction check, ExceptionTest check_exception) { // *** Valid input tests *** - // Unsed argument is ignored. TODO FMT what does the Standard mandate? - check.template operator()<"hello {}">(SV("hello world"), world, universe); - check.template operator()<"hello {} and {}">(SV("hello world and universe"), world, universe); - check.template operator()<"hello {0}">(SV("hello world"), world, universe); - check.template operator()<"hello {1}">(SV("hello universe"), world, universe); - check.template operator()<"hello {1} and {0}">(SV("hello universe and world"), world, universe); - - check.template operator()<"hello {:_>}">(SV("hello world"), world); - check.template operator()<"hello {:>8}">(SV("hello world"), world); - check.template operator()<"hello {:_>8}">(SV("hello ___world"), world); - check.template operator()<"hello {:_^8}">(SV("hello _world__"), world); - check.template operator()<"hello {:_<8}">(SV("hello world___"), world); - - check.template operator()<"hello {:>>8}">(SV("hello >>>world"), world); - check.template operator()<"hello {:<>8}">(SV("hello <<8}">(SV("hello ^^^world"), world); - - check.template operator()<"hello {:$>{}}">(SV("hello $world"), world, 6); - check.template operator()<"hello {0:$>{1}}">(SV("hello $world"), world, 6); - check.template operator()<"hello {1:$>{0}}">(SV("hello $world"), 6, world); - - check.template operator()<"hello {:.5}">(SV("hello world"), world); - check.template operator()<"hello {:.5}">(SV("hello unive"), universe); - - check.template operator()<"hello {:.{}}">(SV("hello univer"), universe, 6); - check.template operator()<"hello {0:.{1}}">(SV("hello univer"), universe, 6); - check.template operator()<"hello {1:.{0}}">(SV("hello univer"), 6, universe); - - check.template operator()<"hello {:%^7.7}">(SV("hello %world%"), world); - check.template operator()<"hello {:%^7.7}">(SV("hello univers"), universe); - check.template operator()<"hello {:%^{}.{}}">(SV("hello %world%"), world, 7, 7); - check.template operator()<"hello {0:%^{1}.{2}}">(SV("hello %world%"), world, 7, 7); - check.template operator()<"hello {0:%^{2}.{1}}">(SV("hello %world%"), world, 7, 7); - check.template operator()<"hello {1:%^{0}.{2}}">(SV("hello %world%"), 7, world, 7); - - check.template operator()<"hello {:_>s}">(SV("hello world"), world); - check.template operator()<"hello {:$>{}s}">(SV("hello $world"), world, 6); - check.template operator()<"hello {:.5s}">(SV("hello world"), world); - check.template operator()<"hello {:.{}s}">(SV("hello univer"), universe, 6); - check.template operator()<"hello {:%^7.7s}">(SV("hello %world%"), world); - - check.template operator()<"hello {:#>8.3s}">(SV("hello #####uni"), universe); - check.template operator()<"hello {:#^8.3s}">(SV("hello ##uni###"), universe); - check.template operator()<"hello {:#<8.3s}">(SV("hello uni#####"), universe); + // Unused argument is ignored. TODO FMT what does the Standard mandate? + check(SV("hello world"), SV("hello {}"), world, universe); + check(SV("hello world and universe"), SV("hello {} and {}"), world, universe); + check(SV("hello world"), SV("hello {0}"), world, universe); + check(SV("hello universe"), SV("hello {1}"), world, universe); + check(SV("hello universe and world"), SV("hello {1} and {0}"), world, universe); + + check(SV("hello world"), SV("hello {:_>}"), world); + check(SV("hello world"), SV("hello {:>8}"), world); + check(SV("hello ___world"), SV("hello {:_>8}"), world); + check(SV("hello _world__"), SV("hello {:_^8}"), world); + check(SV("hello world___"), SV("hello {:_<8}"), world); + + check(SV("hello >>>world"), SV("hello {:>>8}"), world); + check(SV("hello <<8}"), world); + check(SV("hello ^^^world"), SV("hello {:^>8}"), world); + + check(SV("hello $world"), SV("hello {:$>{}}"), world, 6); + check(SV("hello $world"), SV("hello {0:$>{1}}"), world, 6); + check(SV("hello $world"), SV("hello {1:$>{0}}"), 6, world); + + check(SV("hello world"), SV("hello {:.5}"), world); + check(SV("hello unive"), SV("hello {:.5}"), universe); + + check(SV("hello univer"), SV("hello {:.{}}"), universe, 6); + check(SV("hello univer"), SV("hello {0:.{1}}"), universe, 6); + check(SV("hello univer"), SV("hello {1:.{0}}"), 6, universe); + + check(SV("hello %world%"), SV("hello {:%^7.7}"), world); + check(SV("hello univers"), SV("hello {:%^7.7}"), universe); + check(SV("hello %world%"), SV("hello {:%^{}.{}}"), world, 7, 7); + check(SV("hello %world%"), SV("hello {0:%^{1}.{2}}"), world, 7, 7); + check(SV("hello %world%"), SV("hello {0:%^{2}.{1}}"), world, 7, 7); + check(SV("hello %world%"), SV("hello {1:%^{0}.{2}}"), 7, world, 7); + + check(SV("hello world"), SV("hello {:_>s}"), world); + check(SV("hello $world"), SV("hello {:$>{}s}"), world, 6); + check(SV("hello world"), SV("hello {:.5s}"), world); + check(SV("hello univer"), SV("hello {:.{}s}"), universe, 6); + check(SV("hello %world%"), SV("hello {:%^7.7s}"), world); + + check(SV("hello #####uni"), SV("hello {:#>8.3s}"), universe); + check(SV("hello ##uni###"), SV("hello {:#^8.3s}"), universe); + check(SV("hello uni#####"), SV("hello {:#<8.3s}"), universe); // *** sign *** check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:-}"), world); @@ -242,7 +242,7 @@ // *** width *** // Width 0 allowed, but not useful for string arguments. - check.template operator()<"hello {:{}}">(SV("hello world"), world, 0); + check(SV("hello world"), SV("hello {:{}}"), world, 0); #ifdef _LIBCPP_VERSION // This limit isn't specified in the Standard. @@ -273,9 +273,9 @@ #endif // Precision 0 allowed, but not useful for string arguments. - check.template operator()<"hello {:.{}}">(SV("hello "), world, 0); + check(SV("hello "), SV("hello {:.{}}"), world, 0); // Precision may have leading zeros. Secondly tests the value is still base 10. - check.template operator()<"hello {:.000010}">(SV("hello 0123456789"), STR("0123456789abcdef")); + check(SV("hello 0123456789"), SV("hello {:.000010}"), STR("0123456789abcdef")); check_exception("A format-spec arg-id replacement shouldn't have a negative value", SV("hello {:.{}}"), world, -1); check_exception("A format-spec arg-id replacement exceeds the maximum supported value", SV("hello {:.{}}"), world, ~0u); @@ -304,91 +304,91 @@ // Make sure all possible types are tested. For clarity don't use macros. if constexpr (std::same_as) { const char* c_string = "aßc"; - check.template operator()<"{:*^5}">(SV("*aßc*"), c_string); - check.template operator()<"{:*^4.2}">(SV("*aß*"), c_string); + check(SV("*aßc*"), SV("{:*^5}"), c_string); + check(SV("*aß*"), SV("{:*^4.2}"), c_string); - check.template operator()<"{:*^5}">(SV("*aßc*"), const_cast(c_string)); - check.template operator()<"{:*^4.2}">(SV("*aß*"), const_cast(c_string)); + check(SV("*aßc*"), SV("{:*^5}"), const_cast(c_string)); + check(SV("*aß*"), SV("{:*^4.2}"), const_cast(c_string)); - check.template operator()<"{:*^5}">(SV("*aßc*"), "aßc"); - check.template operator()<"{:*^4.2}">(SV("*aß*"), "aßc"); + check(SV("*aßc*"), SV("{:*^5}"), "aßc"); + check(SV("*aß*"), SV("{:*^4.2}"), "aßc"); - check.template operator()<"{:*^5}">(SV("*aßc*"), std::string("aßc")); - check.template operator()<"{:*^4.2}">(SV("*aß*"), std::string("aßc")); + check(SV("*aßc*"), SV("{:*^5}"), std::string("aßc")); + check(SV("*aß*"), SV("{:*^4.2}"), std::string("aßc")); - check.template operator()<"{:*^5}">(SV("*aßc*"), std::string_view("aßc")); - check.template operator()<"{:*^4.2}">(SV("*aß*"), std::string_view("aßc")); + check(SV("*aßc*"), SV("{:*^5}"), std::string_view("aßc")); + check(SV("*aß*"), SV("{:*^4.2}"), std::string_view("aßc")); } # ifndef TEST_HAS_NO_WIDE_CHARACTERS else { const wchar_t* c_string = L"aßc"; - check.template operator()<"{:*^5}">(SV("*aßc*"), c_string); - check.template operator()<"{:*^4.2}">(SV("*aß*"), c_string); + check(SV("*aßc*"), SV("{:*^5}"), c_string); + check(SV("*aß*"), SV("{:*^4.2}"), c_string); - check.template operator()<"{:*^5}">(SV("*aßc*"), const_cast(c_string)); - check.template operator()<"{:*^4.2}">(SV("*aß*"), const_cast(c_string)); + check(SV("*aßc*"), SV("{:*^5}"), const_cast(c_string)); + check(SV("*aß*"), SV("{:*^4.2}"), const_cast(c_string)); - check.template operator()<"{:*^5}">(SV("*aßc*"), L"aßc"); - check.template operator()<"{:*^4.2}">(SV("*aß*"), L"aßc"); + check(SV("*aßc*"), SV("{:*^5}"), L"aßc"); + check(SV("*aß*"), SV("{:*^4.2}"), L"aßc"); - check.template operator()<"{:*^5}">(SV("*aßc*"), std::wstring(L"aßc")); - check.template operator()<"{:*^4.2}">(SV("*aß*"), std::wstring(L"aßc")); + check(SV("*aßc*"), SV("{:*^5}"), std::wstring(L"aßc")); + check(SV("*aß*"), SV("{:*^4.2}"), std::wstring(L"aßc")); - check.template operator()<"{:*^5}">(SV("*aßc*"), std::wstring_view(L"aßc")); - check.template operator()<"{:*^4.2}">(SV("*aß*"), std::wstring_view(L"aßc")); + check(SV("*aßc*"), SV("{:*^5}"), std::wstring_view(L"aßc")); + check(SV("*aß*"), SV("{:*^4.2}"), std::wstring_view(L"aßc")); } # endif // TEST_HAS_NO_WIDE_CHARACTERS // ß requires one column - check.template operator()<"{}">(SV("aßc"), STR("aßc")); + check(SV("aßc"), SV("{}"), STR("aßc")); - check.template operator()<"{:.3}">(SV("aßc"), STR("aßc")); - check.template operator()<"{:.2}">(SV("aß"), STR("aßc")); - check.template operator()<"{:.1}">(SV("a"), STR("aßc")); + check(SV("aßc"), SV("{:.3}"), STR("aßc")); + check(SV("aß"), SV("{:.2}"), STR("aßc")); + check(SV("a"), SV("{:.1}"), STR("aßc")); - check.template operator()<"{:3.3}">(SV("aßc"), STR("aßc")); - check.template operator()<"{:2.2}">(SV("aß"), STR("aßc")); - check.template operator()<"{:1.1}">(SV("a"), STR("aßc")); + check(SV("aßc"), SV("{:3.3}"), STR("aßc")); + check(SV("aß"), SV("{:2.2}"), STR("aßc")); + check(SV("a"), SV("{:1.1}"), STR("aßc")); - check.template operator()<"{:-<6}">(SV("aßc---"), STR("aßc")); - check.template operator()<"{:-^6}">(SV("-aßc--"), STR("aßc")); - check.template operator()<"{:->6}">(SV("---aßc"), STR("aßc")); + check(SV("aßc---"), SV("{:-<6}"), STR("aßc")); + check(SV("-aßc--"), SV("{:-^6}"), STR("aßc")); + check(SV("---aßc"), SV("{:->6}"), STR("aßc")); // \u1000 requires two columns - check.template operator()<"{}">(SV("a\u1110c"), STR("a\u1110c")); + check(SV("a\u1110c"), SV("{}"), STR("a\u1110c")); - check.template operator()<"{:.4}">(SV("a\u1100c"), STR("a\u1100c")); - check.template operator()<"{:.3}">(SV("a\u1100"), STR("a\u1100c")); - check.template operator()<"{:.2}">(SV("a"), STR("a\u1100c")); - check.template operator()<"{:.1}">(SV("a"), STR("a\u1100c")); + check(SV("a\u1100c"), SV("{:.4}"), STR("a\u1100c")); + check(SV("a\u1100"), SV("{:.3}"), STR("a\u1100c")); + check(SV("a"), SV("{:.2}"), STR("a\u1100c")); + check(SV("a"), SV("{:.1}"), STR("a\u1100c")); - check.template operator()<"{:-<4.4}">(SV("a\u1100c"), STR("a\u1100c")); - check.template operator()<"{:-<3.3}">(SV("a\u1100"), STR("a\u1100c")); - check.template operator()<"{:-<2.2}">(SV("a-"), STR("a\u1100c")); - check.template operator()<"{:-<1.1}">(SV("a"), STR("a\u1100c")); + check(SV("a\u1100c"), SV("{:-<4.4}"), STR("a\u1100c")); + check(SV("a\u1100"), SV("{:-<3.3}"), STR("a\u1100c")); + check(SV("a-"), SV("{:-<2.2}"), STR("a\u1100c")); + check(SV("a"), SV("{:-<1.1}"), STR("a\u1100c")); - check.template operator()<"{:-<7}">(SV("a\u1110c---"), STR("a\u1110c")); - check.template operator()<"{:-^7}">(SV("-a\u1110c--"), STR("a\u1110c")); - check.template operator()<"{:->7}">(SV("---a\u1110c"), STR("a\u1110c")); + check(SV("a\u1110c---"), SV("{:-<7}"), STR("a\u1110c")); + check(SV("-a\u1110c--"), SV("{:-^7}"), STR("a\u1110c")); + check(SV("---a\u1110c"), SV("{:->7}"), STR("a\u1110c")); // Examples used in P1868R2 - check.template operator()<"{:*^3}">(SV("*\u0041*"), STR("\u0041")); // { LATIN CAPITAL LETTER A } - check.template operator()<"{:*^3}">(SV("*\u00c1*"), STR("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } - check.template operator()<"{:*^3}">( - SV("*\u0041\u0301*"), - STR("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } - check.template operator()<"{:*^3}">(SV("*\u0132*"), STR("\u0132")); // { LATIN CAPITAL LIGATURE IJ } - check.template operator()<"{:*^3}">(SV("*\u0394*"), STR("\u0394")); // { GREEK CAPITAL LETTER DELTA } - - check.template operator()<"{:*^3}">(SV("*\u0429*"), STR("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } - check.template operator()<"{:*^3}">(SV("*\u05d0*"), STR("\u05d0")); // { HEBREW LETTER ALEF } - check.template operator()<"{:*^3}">(SV("*\u0634*"), STR("\u0634")); // { ARABIC LETTER SHEEN } - check.template operator()<"{:*^4}">(SV("*\u3009*"), STR("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } - check.template operator()<"{:*^4}">(SV("*\u754c*"), STR("\u754c")); // { CJK Unified Ideograph-754C } - check.template operator()<"{:*^4}">(SV("*\U0001f921*"), STR("\U0001f921")); // { UNICORN FACE } - check.template operator()<"{:*^4}">( - SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), - STR("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } + check(SV("*\u0041*"), SV("{:*^3}"), STR("\u0041")); // { LATIN CAPITAL LETTER A } + check(SV("*\u00c1*"), SV("{:*^3}"), STR("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } + check(SV("*\u0041\u0301*"), + SV("{:*^3}"), + STR("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } + check(SV("*\u0132*"), SV("{:*^3}"), STR("\u0132")); // { LATIN CAPITAL LIGATURE IJ } + check(SV("*\u0394*"), SV("{:*^3}"), STR("\u0394")); // { GREEK CAPITAL LETTER DELTA } + + check(SV("*\u0429*"), SV("{:*^3}"), STR("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } + check(SV("*\u05d0*"), SV("{:*^3}"), STR("\u05d0")); // { HEBREW LETTER ALEF } + check(SV("*\u0634*"), SV("{:*^3}"), STR("\u0634")); // { ARABIC LETTER SHEEN } + check(SV("*\u3009*"), SV("{:*^4}"), STR("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } + check(SV("*\u754c*"), SV("{:*^4}"), STR("\u754c")); // { CJK Unified Ideograph-754C } + check(SV("*\U0001f921*"), SV("{:*^4}"), STR("\U0001f921")); // { UNICORN FACE } + check(SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), + SV("{:*^4}"), + STR("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } #endif // TEST_HAS_NO_UNICODE } @@ -418,23 +418,23 @@ void format_test_bool(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:7}'">(SV("answer is 'true '"), true); - check.template operator()<"answer is '{:>7}'">(SV("answer is ' true'"), true); - check.template operator()<"answer is '{:<7}'">(SV("answer is 'true '"), true); - check.template operator()<"answer is '{:^7}'">(SV("answer is ' true '"), true); + check(SV("answer is 'true '"), SV("answer is '{:7}'"), true); + check(SV("answer is ' true'"), SV("answer is '{:>7}'"), true); + check(SV("answer is 'true '"), SV("answer is '{:<7}'"), true); + check(SV("answer is ' true '"), SV("answer is '{:^7}'"), true); - check.template operator()<"answer is '{:8s}'">(SV("answer is 'false '"), false); - check.template operator()<"answer is '{:>8s}'">(SV("answer is ' false'"), false); - check.template operator()<"answer is '{:<8s}'">(SV("answer is 'false '"), false); - check.template operator()<"answer is '{:^8s}'">(SV("answer is ' false '"), false); + check(SV("answer is 'false '"), SV("answer is '{:8s}'"), false); + check(SV("answer is ' false'"), SV("answer is '{:>8s}'"), false); + check(SV("answer is 'false '"), SV("answer is '{:<8s}'"), false); + check(SV("answer is ' false '"), SV("answer is '{:^8s}'"), false); - check.template operator()<"answer is '{:->7}'">(SV("answer is '---true'"), true); - check.template operator()<"answer is '{:-<7}'">(SV("answer is 'true---'"), true); - check.template operator()<"answer is '{:-^7}'">(SV("answer is '-true--'"), true); + check(SV("answer is '---true'"), SV("answer is '{:->7}'"), true); + check(SV("answer is 'true---'"), SV("answer is '{:-<7}'"), true); + check(SV("answer is '-true--'"), SV("answer is '{:-^7}'"), true); - check.template operator()<"answer is '{:->8s}'">(SV("answer is '---false'"), false); - check.template operator()<"answer is '{:-<8s}'">(SV("answer is 'false---'"), false); - check.template operator()<"answer is '{:-^8s}'">(SV("answer is '-false--'"), false); + check(SV("answer is '---false'"), SV("answer is '{:->8s}'"), false); + check(SV("answer is 'false---'"), SV("answer is '{:-<8s}'"), false); + check(SV("answer is '-false--'"), SV("answer is '{:-^8s}'"), false); // *** Sign *** check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), true); @@ -473,75 +473,75 @@ template void format_test_bool_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:<1d}'">(SV("answer is '1'"), true); - check.template operator()<"answer is '{:<2d}'">(SV("answer is '1 '"), true); - check.template operator()<"answer is '{:<2d}'">(SV("answer is '0 '"), false); + check(SV("answer is '1'"), SV("answer is '{:<1d}'"), true); + check(SV("answer is '1 '"), SV("answer is '{:<2d}'"), true); + check(SV("answer is '0 '"), SV("answer is '{:<2d}'"), false); - check.template operator()<"answer is '{:6d}'">(SV("answer is ' 1'"), true); - check.template operator()<"answer is '{:>6d}'">(SV("answer is ' 1'"), true); - check.template operator()<"answer is '{:<6d}'">(SV("answer is '1 '"), true); - check.template operator()<"answer is '{:^6d}'">(SV("answer is ' 1 '"), true); + check(SV("answer is ' 1'"), SV("answer is '{:6d}'"), true); + check(SV("answer is ' 1'"), SV("answer is '{:>6d}'"), true); + check(SV("answer is '1 '"), SV("answer is '{:<6d}'"), true); + check(SV("answer is ' 1 '"), SV("answer is '{:^6d}'"), true); - check.template operator()<"answer is '{:*>6d}'">(SV("answer is '*****0'"), false); - check.template operator()<"answer is '{:*<6d}'">(SV("answer is '0*****'"), false); - check.template operator()<"answer is '{:*^6d}'">(SV("answer is '**0***'"), false); + check(SV("answer is '*****0'"), SV("answer is '{:*>6d}'"), false); + check(SV("answer is '0*****'"), SV("answer is '{:*<6d}'"), false); + check(SV("answer is '**0***'"), SV("answer is '{:*^6d}'"), false); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>06d}'">(SV("answer is ' 1'"), true); - check.template operator()<"answer is '{:<06d}'">(SV("answer is '1 '"), true); - check.template operator()<"answer is '{:^06d}'">(SV("answer is ' 1 '"), true); + check(SV("answer is ' 1'"), SV("answer is '{:>06d}'"), true); + check(SV("answer is '1 '"), SV("answer is '{:<06d}'"), true); + check(SV("answer is ' 1 '"), SV("answer is '{:^06d}'"), true); // *** Sign *** - check.template operator()<"answer is {:d}">(SV("answer is 1"), true); - check.template operator()<"answer is {:-d}">(SV("answer is 0"), false); - check.template operator()<"answer is {:+d}">(SV("answer is +1"), true); - check.template operator()<"answer is {: d}">(SV("answer is 0"), false); + check(SV("answer is 1"), SV("answer is {:d}"), true); + check(SV("answer is 0"), SV("answer is {:-d}"), false); + check(SV("answer is +1"), SV("answer is {:+d}"), true); + check(SV("answer is 0"), SV("answer is {: d}"), false); // *** alternate form *** - check.template operator()<"answer is {:+#d}">(SV("answer is +1"), true); - check.template operator()<"answer is {:+b}">(SV("answer is +1"), true); - check.template operator()<"answer is {:+#b}">(SV("answer is +0b1"), true); - check.template operator()<"answer is {:+#B}">(SV("answer is +0B1"), true); - check.template operator()<"answer is {:+o}">(SV("answer is +1"), true); - check.template operator()<"answer is {:+#o}">(SV("answer is +01"), true); - check.template operator()<"answer is {:+x}">(SV("answer is +1"), true); - check.template operator()<"answer is {:+#x}">(SV("answer is +0x1"), true); - check.template operator()<"answer is {:+X}">(SV("answer is +1"), true); - check.template operator()<"answer is {:+#X}">(SV("answer is +0X1"), true); - - check.template operator()<"answer is {:#d}">(SV("answer is 0"), false); - check.template operator()<"answer is {:b}">(SV("answer is 0"), false); - check.template operator()<"answer is {:#b}">(SV("answer is 0b0"), false); - check.template operator()<"answer is {:#B}">(SV("answer is 0B0"), false); - check.template operator()<"answer is {:o}">(SV("answer is 0"), false); - check.template operator()<"answer is {:#o}">(SV("answer is 0"), false); - check.template operator()<"answer is {:x}">(SV("answer is 0"), false); - check.template operator()<"answer is {:#x}">(SV("answer is 0x0"), false); - check.template operator()<"answer is {:X}">(SV("answer is 0"), false); - check.template operator()<"answer is {:#X}">(SV("answer is 0X0"), false); + check(SV("answer is +1"), SV("answer is {:+#d}"), true); + check(SV("answer is +1"), SV("answer is {:+b}"), true); + check(SV("answer is +0b1"), SV("answer is {:+#b}"), true); + check(SV("answer is +0B1"), SV("answer is {:+#B}"), true); + check(SV("answer is +1"), SV("answer is {:+o}"), true); + check(SV("answer is +01"), SV("answer is {:+#o}"), true); + check(SV("answer is +1"), SV("answer is {:+x}"), true); + check(SV("answer is +0x1"), SV("answer is {:+#x}"), true); + check(SV("answer is +1"), SV("answer is {:+X}"), true); + check(SV("answer is +0X1"), SV("answer is {:+#X}"), true); + + check(SV("answer is 0"), SV("answer is {:#d}"), false); + check(SV("answer is 0"), SV("answer is {:b}"), false); + check(SV("answer is 0b0"), SV("answer is {:#b}"), false); + check(SV("answer is 0B0"), SV("answer is {:#B}"), false); + check(SV("answer is 0"), SV("answer is {:o}"), false); + check(SV("answer is 0"), SV("answer is {:#o}"), false); + check(SV("answer is 0"), SV("answer is {:x}"), false); + check(SV("answer is 0x0"), SV("answer is {:#x}"), false); + check(SV("answer is 0"), SV("answer is {:X}"), false); + check(SV("answer is 0X0"), SV("answer is {:#X}"), false); // *** zero-padding & width *** - check.template operator()<"answer is {:+#012d}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+012b}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+#012b}">(SV("answer is +0b000000001"), true); - check.template operator()<"answer is {:+#012B}">(SV("answer is +0B000000001"), true); - check.template operator()<"answer is {:+012o}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+#012o}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+012x}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+#012x}">(SV("answer is +0x000000001"), true); - check.template operator()<"answer is {:+012X}">(SV("answer is +00000000001"), true); - check.template operator()<"answer is {:+#012X}">(SV("answer is +0X000000001"), true); - - check.template operator()<"answer is {:#012d}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:012b}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:#012b}">(SV("answer is 0b0000000000"), false); - check.template operator()<"answer is {:#012B}">(SV("answer is 0B0000000000"), false); - check.template operator()<"answer is {:012o}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:#012o}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:012x}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:#012x}">(SV("answer is 0x0000000000"), false); - check.template operator()<"answer is {:012X}">(SV("answer is 000000000000"), false); - check.template operator()<"answer is {:#012X}">(SV("answer is 0X0000000000"), false); + check(SV("answer is +00000000001"), SV("answer is {:+#012d}"), true); + check(SV("answer is +00000000001"), SV("answer is {:+012b}"), true); + check(SV("answer is +0b000000001"), SV("answer is {:+#012b}"), true); + check(SV("answer is +0B000000001"), SV("answer is {:+#012B}"), true); + check(SV("answer is +00000000001"), SV("answer is {:+012o}"), true); + check(SV("answer is +00000000001"), SV("answer is {:+#012o}"), true); + check(SV("answer is +00000000001"), SV("answer is {:+012x}"), true); + check(SV("answer is +0x000000001"), SV("answer is {:+#012x}"), true); + check(SV("answer is +00000000001"), SV("answer is {:+012X}"), true); + check(SV("answer is +0X000000001"), SV("answer is {:+#012X}"), true); + + check(SV("answer is 000000000000"), SV("answer is {:#012d}"), false); + check(SV("answer is 000000000000"), SV("answer is {:012b}"), false); + check(SV("answer is 0b0000000000"), SV("answer is {:#012b}"), false); + check(SV("answer is 0B0000000000"), SV("answer is {:#012B}"), false); + check(SV("answer is 000000000000"), SV("answer is {:012o}"), false); + check(SV("answer is 000000000000"), SV("answer is {:#012o}"), false); + check(SV("answer is 000000000000"), SV("answer is {:012x}"), false); + check(SV("answer is 0x0000000000"), SV("answer is {:#012x}"), false); + check(SV("answer is 000000000000"), SV("answer is {:012X}"), false); + check(SV("answer is 0X0000000000"), SV("answer is {:#012X}"), false); // *** precision *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), true); @@ -559,121 +559,121 @@ template void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:<1}'">(SV("answer is '42'"), I(42)); - check.template operator()<"answer is '{:<2}'">(SV("answer is '42'"), I(42)); - check.template operator()<"answer is '{:<3}'">(SV("answer is '42 '"), I(42)); + check(SV("answer is '42'"), SV("answer is '{:<1}'"), I(42)); + check(SV("answer is '42'"), SV("answer is '{:<2}'"), I(42)); + check(SV("answer is '42 '"), SV("answer is '{:<3}'"), I(42)); - check.template operator()<"answer is '{:7}'">(SV("answer is ' 42'"), I(42)); - check.template operator()<"answer is '{:>7}'">(SV("answer is ' 42'"), I(42)); - check.template operator()<"answer is '{:<7}'">(SV("answer is '42 '"), I(42)); - check.template operator()<"answer is '{:^7}'">(SV("answer is ' 42 '"), I(42)); + check(SV("answer is ' 42'"), SV("answer is '{:7}'"), I(42)); + check(SV("answer is ' 42'"), SV("answer is '{:>7}'"), I(42)); + check(SV("answer is '42 '"), SV("answer is '{:<7}'"), I(42)); + check(SV("answer is ' 42 '"), SV("answer is '{:^7}'"), I(42)); - check.template operator()<"answer is '{:*>7}'">(SV("answer is '*****42'"), I(42)); - check.template operator()<"answer is '{:*<7}'">(SV("answer is '42*****'"), I(42)); - check.template operator()<"answer is '{:*^7}'">(SV("answer is '**42***'"), I(42)); + check(SV("answer is '*****42'"), SV("answer is '{:*>7}'"), I(42)); + check(SV("answer is '42*****'"), SV("answer is '{:*<7}'"), I(42)); + check(SV("answer is '**42***'"), SV("answer is '{:*^7}'"), I(42)); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07}'">(SV("answer is ' 42'"), I(42)); - check.template operator()<"answer is '{:<07}'">(SV("answer is '42 '"), I(42)); - check.template operator()<"answer is '{:^07}'">(SV("answer is ' 42 '"), I(42)); + check(SV("answer is ' 42'"), SV("answer is '{:>07}'"), I(42)); + check(SV("answer is '42 '"), SV("answer is '{:<07}'"), I(42)); + check(SV("answer is ' 42 '"), SV("answer is '{:^07}'"), I(42)); // *** Sign *** if constexpr (std::signed_integral) - check.template operator()<"answer is {}">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {}">(SV("answer is 42"), I(42)); + check(SV("answer is -42"), SV("answer is {}"), I(-42)); + check(SV("answer is 0"), SV("answer is {}"), I(0)); + check(SV("answer is 42"), SV("answer is {}"), I(42)); if constexpr (std::signed_integral) - check.template operator()<"answer is {:-}">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {:-}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:-}">(SV("answer is 42"), I(42)); + check(SV("answer is -42"), SV("answer is {:-}"), I(-42)); + check(SV("answer is 0"), SV("answer is {:-}"), I(0)); + check(SV("answer is 42"), SV("answer is {:-}"), I(42)); if constexpr (std::signed_integral) - check.template operator()<"answer is {:+}">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {:+}">(SV("answer is +0"), I(0)); - check.template operator()<"answer is {:+}">(SV("answer is +42"), I(42)); + check(SV("answer is -42"), SV("answer is {:+}"), I(-42)); + check(SV("answer is +0"), SV("answer is {:+}"), I(0)); + check(SV("answer is +42"), SV("answer is {:+}"), I(42)); if constexpr (std::signed_integral) - check.template operator()<"answer is {: }">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {: }">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {: }">(SV("answer is 42"), I(42)); + check(SV("answer is -42"), SV("answer is {: }"), I(-42)); + check(SV("answer is 0"), SV("answer is {: }"), I(0)); + check(SV("answer is 42"), SV("answer is {: }"), I(42)); // *** alternate form *** if constexpr (std::signed_integral) { - check.template operator()<"answer is {:#}">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {:#d}">(SV("answer is -42"), I(-42)); - check.template operator()<"answer is {:b}">(SV("answer is -101010"), I(-42)); - check.template operator()<"answer is {:#b}">(SV("answer is -0b101010"), I(-42)); - check.template operator()<"answer is {:#B}">(SV("answer is -0B101010"), I(-42)); - check.template operator()<"answer is {:o}">(SV("answer is -52"), I(-42)); - check.template operator()<"answer is {:#o}">(SV("answer is -052"), I(-42)); - check.template operator()<"answer is {:x}">(SV("answer is -2a"), I(-42)); - check.template operator()<"answer is {:#x}">(SV("answer is -0x2a"), I(-42)); - check.template operator()<"answer is {:X}">(SV("answer is -2A"), I(-42)); - check.template operator()<"answer is {:#X}">(SV("answer is -0X2A"), I(-42)); + check(SV("answer is -42"), SV("answer is {:#}"), I(-42)); + check(SV("answer is -42"), SV("answer is {:#d}"), I(-42)); + check(SV("answer is -101010"), SV("answer is {:b}"), I(-42)); + check(SV("answer is -0b101010"), SV("answer is {:#b}"), I(-42)); + check(SV("answer is -0B101010"), SV("answer is {:#B}"), I(-42)); + check(SV("answer is -52"), SV("answer is {:o}"), I(-42)); + check(SV("answer is -052"), SV("answer is {:#o}"), I(-42)); + check(SV("answer is -2a"), SV("answer is {:x}"), I(-42)); + check(SV("answer is -0x2a"), SV("answer is {:#x}"), I(-42)); + check(SV("answer is -2A"), SV("answer is {:X}"), I(-42)); + check(SV("answer is -0X2A"), SV("answer is {:#X}"), I(-42)); } - check.template operator()<"answer is {:#}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:#d}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:b}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:#b}">(SV("answer is 0b0"), I(0)); - check.template operator()<"answer is {:#B}">(SV("answer is 0B0"), I(0)); - check.template operator()<"answer is {:o}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:#o}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:x}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:#x}">(SV("answer is 0x0"), I(0)); - check.template operator()<"answer is {:X}">(SV("answer is 0"), I(0)); - check.template operator()<"answer is {:#X}">(SV("answer is 0X0"), I(0)); - - check.template operator()<"answer is {:+#}">(SV("answer is +42"), I(42)); - check.template operator()<"answer is {:+#d}">(SV("answer is +42"), I(42)); - check.template operator()<"answer is {:+b}">(SV("answer is +101010"), I(42)); - check.template operator()<"answer is {:+#b}">(SV("answer is +0b101010"), I(42)); - check.template operator()<"answer is {:+#B}">(SV("answer is +0B101010"), I(42)); - check.template operator()<"answer is {:+o}">(SV("answer is +52"), I(42)); - check.template operator()<"answer is {:+#o}">(SV("answer is +052"), I(42)); - check.template operator()<"answer is {:+x}">(SV("answer is +2a"), I(42)); - check.template operator()<"answer is {:+#x}">(SV("answer is +0x2a"), I(42)); - check.template operator()<"answer is {:+X}">(SV("answer is +2A"), I(42)); - check.template operator()<"answer is {:+#X}">(SV("answer is +0X2A"), I(42)); + check(SV("answer is 0"), SV("answer is {:#}"), I(0)); + check(SV("answer is 0"), SV("answer is {:#d}"), I(0)); + check(SV("answer is 0"), SV("answer is {:b}"), I(0)); + check(SV("answer is 0b0"), SV("answer is {:#b}"), I(0)); + check(SV("answer is 0B0"), SV("answer is {:#B}"), I(0)); + check(SV("answer is 0"), SV("answer is {:o}"), I(0)); + check(SV("answer is 0"), SV("answer is {:#o}"), I(0)); + check(SV("answer is 0"), SV("answer is {:x}"), I(0)); + check(SV("answer is 0x0"), SV("answer is {:#x}"), I(0)); + check(SV("answer is 0"), SV("answer is {:X}"), I(0)); + check(SV("answer is 0X0"), SV("answer is {:#X}"), I(0)); + + check(SV("answer is +42"), SV("answer is {:+#}"), I(42)); + check(SV("answer is +42"), SV("answer is {:+#d}"), I(42)); + check(SV("answer is +101010"), SV("answer is {:+b}"), I(42)); + check(SV("answer is +0b101010"), SV("answer is {:+#b}"), I(42)); + check(SV("answer is +0B101010"), SV("answer is {:+#B}"), I(42)); + check(SV("answer is +52"), SV("answer is {:+o}"), I(42)); + check(SV("answer is +052"), SV("answer is {:+#o}"), I(42)); + check(SV("answer is +2a"), SV("answer is {:+x}"), I(42)); + check(SV("answer is +0x2a"), SV("answer is {:+#x}"), I(42)); + check(SV("answer is +2A"), SV("answer is {:+X}"), I(42)); + check(SV("answer is +0X2A"), SV("answer is {:+#X}"), I(42)); // *** zero-padding & width *** if constexpr (std::signed_integral) { - check.template operator()<"answer is {:#012}">(SV("answer is -00000000042"), I(-42)); - check.template operator()<"answer is {:#012d}">(SV("answer is -00000000042"), I(-42)); - check.template operator()<"answer is {:012b}">(SV("answer is -00000101010"), I(-42)); - check.template operator()<"answer is {:#012b}">(SV("answer is -0b000101010"), I(-42)); - check.template operator()<"answer is {:#012B}">(SV("answer is -0B000101010"), I(-42)); - check.template operator()<"answer is {:012o}">(SV("answer is -00000000052"), I(-42)); - check.template operator()<"answer is {:#012o}">(SV("answer is -00000000052"), I(-42)); - check.template operator()<"answer is {:012x}">(SV("answer is -0000000002a"), I(-42)); - check.template operator()<"answer is {:#012x}">(SV("answer is -0x00000002a"), I(-42)); - check.template operator()<"answer is {:012X}">(SV("answer is -0000000002A"), I(-42)); - check.template operator()<"answer is {:#012X}">(SV("answer is -0X00000002A"), I(-42)); + check(SV("answer is -00000000042"), SV("answer is {:#012}"), I(-42)); + check(SV("answer is -00000000042"), SV("answer is {:#012d}"), I(-42)); + check(SV("answer is -00000101010"), SV("answer is {:012b}"), I(-42)); + check(SV("answer is -0b000101010"), SV("answer is {:#012b}"), I(-42)); + check(SV("answer is -0B000101010"), SV("answer is {:#012B}"), I(-42)); + check(SV("answer is -00000000052"), SV("answer is {:012o}"), I(-42)); + check(SV("answer is -00000000052"), SV("answer is {:#012o}"), I(-42)); + check(SV("answer is -0000000002a"), SV("answer is {:012x}"), I(-42)); + check(SV("answer is -0x00000002a"), SV("answer is {:#012x}"), I(-42)); + check(SV("answer is -0000000002A"), SV("answer is {:012X}"), I(-42)); + check(SV("answer is -0X00000002A"), SV("answer is {:#012X}"), I(-42)); } - check.template operator()<"answer is {:#012}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:#012d}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:012b}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:#012b}">(SV("answer is 0b0000000000"), I(0)); - check.template operator()<"answer is {:#012B}">(SV("answer is 0B0000000000"), I(0)); - check.template operator()<"answer is {:012o}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:#012o}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:012x}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:#012x}">(SV("answer is 0x0000000000"), I(0)); - check.template operator()<"answer is {:012X}">(SV("answer is 000000000000"), I(0)); - check.template operator()<"answer is {:#012X}">(SV("answer is 0X0000000000"), I(0)); - - check.template operator()<"answer is {:+#012}">(SV("answer is +00000000042"), I(42)); - check.template operator()<"answer is {:+#012d}">(SV("answer is +00000000042"), I(42)); - check.template operator()<"answer is {:+012b}">(SV("answer is +00000101010"), I(42)); - check.template operator()<"answer is {:+#012b}">(SV("answer is +0b000101010"), I(42)); - check.template operator()<"answer is {:+#012B}">(SV("answer is +0B000101010"), I(42)); - check.template operator()<"answer is {:+012o}">(SV("answer is +00000000052"), I(42)); - check.template operator()<"answer is {:+#012o}">(SV("answer is +00000000052"), I(42)); - check.template operator()<"answer is {:+012x}">(SV("answer is +0000000002a"), I(42)); - check.template operator()<"answer is {:+#012x}">(SV("answer is +0x00000002a"), I(42)); - check.template operator()<"answer is {:+012X}">(SV("answer is +0000000002A"), I(42)); - check.template operator()<"answer is {:+#012X}">(SV("answer is +0X00000002A"), I(42)); + check(SV("answer is 000000000000"), SV("answer is {:#012}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:#012d}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:012b}"), I(0)); + check(SV("answer is 0b0000000000"), SV("answer is {:#012b}"), I(0)); + check(SV("answer is 0B0000000000"), SV("answer is {:#012B}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:012o}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:#012o}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:012x}"), I(0)); + check(SV("answer is 0x0000000000"), SV("answer is {:#012x}"), I(0)); + check(SV("answer is 000000000000"), SV("answer is {:012X}"), I(0)); + check(SV("answer is 0X0000000000"), SV("answer is {:#012X}"), I(0)); + + check(SV("answer is +00000000042"), SV("answer is {:+#012}"), I(42)); + check(SV("answer is +00000000042"), SV("answer is {:+#012d}"), I(42)); + check(SV("answer is +00000101010"), SV("answer is {:+012b}"), I(42)); + check(SV("answer is +0b000101010"), SV("answer is {:+#012b}"), I(42)); + check(SV("answer is +0B000101010"), SV("answer is {:+#012B}"), I(42)); + check(SV("answer is +00000000052"), SV("answer is {:+012o}"), I(42)); + check(SV("answer is +00000000052"), SV("answer is {:+#012o}"), I(42)); + check(SV("answer is +0000000002a"), SV("answer is {:+012x}"), I(42)); + check(SV("answer is +0x00000002a"), SV("answer is {:+#012x}"), I(42)); + check(SV("answer is +0000000002A"), SV("answer is {:+012X}"), I(42)); + check(SV("answer is +0X00000002A"), SV("answer is {:+#012X}"), I(42)); // *** precision *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), I(0)); @@ -691,17 +691,17 @@ template void format_test_integer_as_char(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:6c}'">(SV("answer is '* '"), I(42)); - check.template operator()<"answer is '{:>6c}'">(SV("answer is ' *'"), I(42)); - check.template operator()<"answer is '{:<6c}'">(SV("answer is '* '"), I(42)); - check.template operator()<"answer is '{:^6c}'">(SV("answer is ' * '"), I(42)); + check(SV("answer is '* '"), SV("answer is '{:6c}'"), I(42)); + check(SV("answer is ' *'"), SV("answer is '{:>6c}'"), I(42)); + check(SV("answer is '* '"), SV("answer is '{:<6c}'"), I(42)); + check(SV("answer is ' * '"), SV("answer is '{:^6c}'"), I(42)); - check.template operator()<"answer is '{:->6c}'">(SV("answer is '-----*'"), I(42)); - check.template operator()<"answer is '{:-<6c}'">(SV("answer is '*-----'"), I(42)); - check.template operator()<"answer is '{:-^6c}'">(SV("answer is '--*---'"), I(42)); + check(SV("answer is '-----*'"), SV("answer is '{:->6c}'"), I(42)); + check(SV("answer is '*-----'"), SV("answer is '{:-<6c}'"), I(42)); + check(SV("answer is '--*---'"), SV("answer is '{:-^6c}'"), I(42)); // *** Sign *** - check.template operator()<"answer is {:c}">(SV("answer is *"), I(42)); + check(SV("answer is *"), SV("answer is {:c}"), I(42)); check_exception("A sign field isn't allowed in this format-spec", SV("answer is {:-c}"), I(42)); check_exception("A sign field isn't allowed in this format-spec", SV("answer is {:+c}"), I(42)); check_exception("A sign field isn't allowed in this format-spec", SV("answer is {: c}"), I(42)); @@ -719,7 +719,7 @@ // *** locale-specific form *** // Note it has no effect but it's allowed. - check.template operator()<"answer is '{:Lc}'">(SV("answer is '*'"), I(42)); + check(SV("answer is '*'"), SV("answer is '{:Lc}'"), I(42)); // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) @@ -756,70 +756,68 @@ format_test_integer<__int128_t, CharT>(check, check_exception); #endif // *** check the minma and maxima *** - check.template operator()<"{:#b}">(SV("-0b10000000"), std::numeric_limits::min()); - check.template operator()<"{:#o}">(SV("-0200"), std::numeric_limits::min()); - check.template operator()<"{:#}">(SV("-128"), std::numeric_limits::min()); - check.template operator()<"{:#x}">(SV("-0x80"), std::numeric_limits::min()); - - check.template operator()<"{:#b}">(SV("-0b1000000000000000"), std::numeric_limits::min()); - check.template operator()<"{:#o}">(SV("-0100000"), std::numeric_limits::min()); - check.template operator()<"{:#}">(SV("-32768"), std::numeric_limits::min()); - check.template operator()<"{:#x}">(SV("-0x8000"), std::numeric_limits::min()); - - check.template operator()<"{:#b}">(SV("-0b10000000000000000000000000000000"), std::numeric_limits::min()); - check.template operator()<"{:#o}">(SV("-020000000000"), std::numeric_limits::min()); - check.template operator()<"{:#}">(SV("-2147483648"), std::numeric_limits::min()); - check.template operator()<"{:#x}">(SV("-0x80000000"), std::numeric_limits::min()); - - check.template operator()<"{:#b}">(SV("-0b1000000000000000000000000000000000000000000000000000000000000000"), - std::numeric_limits::min()); - check.template operator()<"{:#o}">(SV("-01000000000000000000000"), std::numeric_limits::min()); - check.template operator()<"{:#}">(SV("-9223372036854775808"), std::numeric_limits::min()); - check.template operator()<"{:#x}">(SV("-0x8000000000000000"), std::numeric_limits::min()); + check(SV("-0b10000000"), SV("{:#b}"), std::numeric_limits::min()); + check(SV("-0200"), SV("{:#o}"), std::numeric_limits::min()); + check(SV("-128"), SV("{:#}"), std::numeric_limits::min()); + check(SV("-0x80"), SV("{:#x}"), std::numeric_limits::min()); + + check(SV("-0b1000000000000000"), SV("{:#b}"), std::numeric_limits::min()); + check(SV("-0100000"), SV("{:#o}"), std::numeric_limits::min()); + check(SV("-32768"), SV("{:#}"), std::numeric_limits::min()); + check(SV("-0x8000"), SV("{:#x}"), std::numeric_limits::min()); + + check(SV("-0b10000000000000000000000000000000"), SV("{:#b}"), std::numeric_limits::min()); + check(SV("-020000000000"), SV("{:#o}"), std::numeric_limits::min()); + check(SV("-2147483648"), SV("{:#}"), std::numeric_limits::min()); + check(SV("-0x80000000"), SV("{:#x}"), std::numeric_limits::min()); + + check(SV("-0b1000000000000000000000000000000000000000000000000000000000000000"), + SV("{:#b}"), + std::numeric_limits::min()); + check(SV("-01000000000000000000000"), SV("{:#o}"), std::numeric_limits::min()); + check(SV("-9223372036854775808"), SV("{:#}"), std::numeric_limits::min()); + check(SV("-0x8000000000000000"), SV("{:#x}"), std::numeric_limits::min()); #ifndef TEST_HAS_NO_INT128 - check.template operator()<"{:#b}">( - SV("-0b1000000000000000000000000000000000000000000000000000000000000000" - "0000000000000000000000000000000000000000000000000000000000000000"), - std::numeric_limits<__int128_t>::min()); - check.template - operator()<"{:#o}">(SV("-02000000000000000000000000000000000000000000"), std::numeric_limits<__int128_t>::min()); - check.template - operator()<"{:#}">(SV("-170141183460469231731687303715884105728"), std::numeric_limits<__int128_t>::min()); - check.template operator()<"{:#x}">(SV("-0x80000000000000000000000000000000"), std::numeric_limits<__int128_t>::min()); + check(SV("-0b1000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000"), + SV("{:#b}"), + std::numeric_limits<__int128_t>::min()); + check(SV("-02000000000000000000000000000000000000000000"), SV("{:#o}"), std::numeric_limits<__int128_t>::min()); + check(SV("-170141183460469231731687303715884105728"), SV("{:#}"), std::numeric_limits<__int128_t>::min()); + check(SV("-0x80000000000000000000000000000000"), SV("{:#x}"), std::numeric_limits<__int128_t>::min()); #endif - check.template operator()<"{:#b}">(SV("0b1111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("0177"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("127"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0x7f"), std::numeric_limits::max()); + check(SV("0b1111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("0177"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("127"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0x7f"), SV("{:#x}"), std::numeric_limits::max()); - check.template operator()<"{:#b}">(SV("0b111111111111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("077777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("32767"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0x7fff"), std::numeric_limits::max()); + check(SV("0b111111111111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("077777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("32767"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0x7fff"), SV("{:#x}"), std::numeric_limits::max()); - check.template operator()<"{:#b}">(SV("0b1111111111111111111111111111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("017777777777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("2147483647"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0x7fffffff"), std::numeric_limits::max()); + check(SV("0b1111111111111111111111111111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("017777777777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("2147483647"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0x7fffffff"), SV("{:#x}"), std::numeric_limits::max()); - check.template operator()<"{:#b}">(SV("0b111111111111111111111111111111111111111111111111111111111111111"), - std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("0777777777777777777777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("9223372036854775807"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0x7fffffffffffffff"), std::numeric_limits::max()); + check(SV("0b111111111111111111111111111111111111111111111111111111111111111"), + SV("{:#b}"), + std::numeric_limits::max()); + check(SV("0777777777777777777777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("9223372036854775807"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0x7fffffffffffffff"), SV("{:#x}"), std::numeric_limits::max()); #ifndef TEST_HAS_NO_INT128 - check.template operator()<"{:#b}">( - SV("0b111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111"), - std::numeric_limits<__int128_t>::max()); - check.template - operator()<"{:#o}">(SV("01777777777777777777777777777777777777777777"), std::numeric_limits<__int128_t>::max()); - check.template - operator()<"{:#}">(SV("170141183460469231731687303715884105727"), std::numeric_limits<__int128_t>::max()); - check.template operator()<"{:#x}">(SV("0x7fffffffffffffffffffffffffffffff"), std::numeric_limits<__int128_t>::max()); + check(SV("0b111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111"), + SV("{:#b}"), + std::numeric_limits<__int128_t>::max()); + check(SV("01777777777777777777777777777777777777777777"), SV("{:#o}"), std::numeric_limits<__int128_t>::max()); + check(SV("170141183460469231731687303715884105727"), SV("{:#}"), std::numeric_limits<__int128_t>::max()); + check(SV("0x7fffffffffffffffffffffffffffffff"), SV("{:#x}"), std::numeric_limits<__int128_t>::max()); #endif } @@ -834,37 +832,36 @@ format_test_integer<__uint128_t, CharT>(check, check_exception); #endif // *** test the maxima *** - check.template operator()<"{:#b}">(SV("0b11111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("0377"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("255"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0xff"), std::numeric_limits::max()); - - check.template operator()<"{:#b}">(SV("0b1111111111111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("0177777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("65535"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0xffff"), std::numeric_limits::max()); - - check.template operator()<"{:#b}">(SV("0b11111111111111111111111111111111"), std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("037777777777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("4294967295"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0xffffffff"), std::numeric_limits::max()); - - check.template operator()<"{:#b}">(SV("0b1111111111111111111111111111111111111111111111111111111111111111"), - std::numeric_limits::max()); - check.template operator()<"{:#o}">(SV("01777777777777777777777"), std::numeric_limits::max()); - check.template operator()<"{:#}">(SV("18446744073709551615"), std::numeric_limits::max()); - check.template operator()<"{:#x}">(SV("0xffffffffffffffff"), std::numeric_limits::max()); + check(SV("0b11111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("0377"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("255"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0xff"), SV("{:#x}"), std::numeric_limits::max()); + + check(SV("0b1111111111111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("0177777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("65535"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0xffff"), SV("{:#x}"), std::numeric_limits::max()); + + check(SV("0b11111111111111111111111111111111"), SV("{:#b}"), std::numeric_limits::max()); + check(SV("037777777777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("4294967295"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0xffffffff"), SV("{:#x}"), std::numeric_limits::max()); + + check(SV("0b1111111111111111111111111111111111111111111111111111111111111111"), + SV("{:#b}"), + std::numeric_limits::max()); + check(SV("01777777777777777777777"), SV("{:#o}"), std::numeric_limits::max()); + check(SV("18446744073709551615"), SV("{:#}"), std::numeric_limits::max()); + check(SV("0xffffffffffffffff"), SV("{:#x}"), std::numeric_limits::max()); #ifndef TEST_HAS_NO_INT128 - check.template operator()<"{:#b}">( - SV("0b1111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111"), - std::numeric_limits<__uint128_t>::max()); - check.template - operator()<"{:#o}">(SV("03777777777777777777777777777777777777777777"), std::numeric_limits<__uint128_t>::max()); - check.template - operator()<"{:#}">(SV("340282366920938463463374607431768211455"), std::numeric_limits<__uint128_t>::max()); - check.template operator()<"{:#x}">(SV("0xffffffffffffffffffffffffffffffff"), std::numeric_limits<__uint128_t>::max()); + check(SV("0b1111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111"), + SV("{:#b}"), + std::numeric_limits<__uint128_t>::max()); + check(SV("03777777777777777777777777777777777777777777"), SV("{:#o}"), std::numeric_limits<__uint128_t>::max()); + check(SV("340282366920938463463374607431768211455"), SV("{:#}"), std::numeric_limits<__uint128_t>::max()); + check(SV("0xffffffffffffffffffffffffffffffff"), SV("{:#x}"), std::numeric_limits<__uint128_t>::max()); #endif } @@ -873,24 +870,24 @@ // ***** Char type ***** // *** align-fill & width *** - check.template operator()<"answer is '{:6}'">(SV("answer is '* '"), CharT('*')); + check(SV("answer is '* '"), SV("answer is '{:6}'"), CharT('*')); - check.template operator()<"answer is '{:>6}'">(SV("answer is ' *'"), CharT('*')); - check.template operator()<"answer is '{:<6}'">(SV("answer is '* '"), CharT('*')); - check.template operator()<"answer is '{:^6}'">(SV("answer is ' * '"), CharT('*')); + check(SV("answer is ' *'"), SV("answer is '{:>6}'"), CharT('*')); + check(SV("answer is '* '"), SV("answer is '{:<6}'"), CharT('*')); + check(SV("answer is ' * '"), SV("answer is '{:^6}'"), CharT('*')); - check.template operator()<"answer is '{:6c}'">(SV("answer is '* '"), CharT('*')); - check.template operator()<"answer is '{:>6c}'">(SV("answer is ' *'"), CharT('*')); - check.template operator()<"answer is '{:<6c}'">(SV("answer is '* '"), CharT('*')); - check.template operator()<"answer is '{:^6c}'">(SV("answer is ' * '"), CharT('*')); + check(SV("answer is '* '"), SV("answer is '{:6c}'"), CharT('*')); + check(SV("answer is ' *'"), SV("answer is '{:>6c}'"), CharT('*')); + check(SV("answer is '* '"), SV("answer is '{:<6c}'"), CharT('*')); + check(SV("answer is ' * '"), SV("answer is '{:^6c}'"), CharT('*')); - check.template operator()<"answer is '{:->6}'">(SV("answer is '-----*'"), CharT('*')); - check.template operator()<"answer is '{:-<6}'">(SV("answer is '*-----'"), CharT('*')); - check.template operator()<"answer is '{:-^6}'">(SV("answer is '--*---'"), CharT('*')); + check(SV("answer is '-----*'"), SV("answer is '{:->6}'"), CharT('*')); + check(SV("answer is '*-----'"), SV("answer is '{:-<6}'"), CharT('*')); + check(SV("answer is '--*---'"), SV("answer is '{:-^6}'"), CharT('*')); - check.template operator()<"answer is '{:->6c}'">(SV("answer is '-----*'"), CharT('*')); - check.template operator()<"answer is '{:-<6c}'">(SV("answer is '*-----'"), CharT('*')); - check.template operator()<"answer is '{:-^6c}'">(SV("answer is '--*---'"), CharT('*')); + check(SV("answer is '-----*'"), SV("answer is '{:->6c}'"), CharT('*')); + check(SV("answer is '*-----'"), SV("answer is '{:-<6c}'"), CharT('*')); + check(SV("answer is '--*---'"), SV("answer is '{:-^6c}'"), CharT('*')); // *** Sign *** check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), CharT('*')); @@ -920,8 +917,8 @@ // *** locale-specific form *** // Note it has no effect but it's allowed. - check.template operator()<"answer is '{:L}'">(SV("answer is '*'"), '*'); - check.template operator()<"answer is '{:Lc}'">(SV("answer is '*'"), '*'); + check(SV("answer is '*'"), SV("answer is '{:L}'"), '*'); + check(SV("answer is '*'"), SV("answer is '{:Lc}'"), '*'); // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) @@ -931,55 +928,55 @@ template void format_test_char_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:<1d}'">(SV("answer is '42'"), CharT('*')); + check(SV("answer is '42'"), SV("answer is '{:<1d}'"), CharT('*')); - check.template operator()<"answer is '{:<2d}'">(SV("answer is '42'"), CharT('*')); - check.template operator()<"answer is '{:<3d}'">(SV("answer is '42 '"), CharT('*')); + check(SV("answer is '42'"), SV("answer is '{:<2d}'"), CharT('*')); + check(SV("answer is '42 '"), SV("answer is '{:<3d}'"), CharT('*')); - check.template operator()<"answer is '{:7d}'">(SV("answer is ' 42'"), CharT('*')); - check.template operator()<"answer is '{:>7d}'">(SV("answer is ' 42'"), CharT('*')); - check.template operator()<"answer is '{:<7d}'">(SV("answer is '42 '"), CharT('*')); - check.template operator()<"answer is '{:^7d}'">(SV("answer is ' 42 '"), CharT('*')); + check(SV("answer is ' 42'"), SV("answer is '{:7d}'"), CharT('*')); + check(SV("answer is ' 42'"), SV("answer is '{:>7d}'"), CharT('*')); + check(SV("answer is '42 '"), SV("answer is '{:<7d}'"), CharT('*')); + check(SV("answer is ' 42 '"), SV("answer is '{:^7d}'"), CharT('*')); - check.template operator()<"answer is '{:*>7d}'">(SV("answer is '*****42'"), CharT('*')); - check.template operator()<"answer is '{:*<7d}'">(SV("answer is '42*****'"), CharT('*')); - check.template operator()<"answer is '{:*^7d}'">(SV("answer is '**42***'"), CharT('*')); + check(SV("answer is '*****42'"), SV("answer is '{:*>7d}'"), CharT('*')); + check(SV("answer is '42*****'"), SV("answer is '{:*<7d}'"), CharT('*')); + check(SV("answer is '**42***'"), SV("answer is '{:*^7d}'"), CharT('*')); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07d}'">(SV("answer is ' 42'"), CharT('*')); - check.template operator()<"answer is '{:<07d}'">(SV("answer is '42 '"), CharT('*')); - check.template operator()<"answer is '{:^07d}'">(SV("answer is ' 42 '"), CharT('*')); + check(SV("answer is ' 42'"), SV("answer is '{:>07d}'"), CharT('*')); + check(SV("answer is '42 '"), SV("answer is '{:<07d}'"), CharT('*')); + check(SV("answer is ' 42 '"), SV("answer is '{:^07d}'"), CharT('*')); // *** Sign *** - check.template operator()<"answer is {:d}">(SV("answer is 42"), CharT('*')); - check.template operator()<"answer is {:-d}">(SV("answer is 42"), CharT('*')); - check.template operator()<"answer is {:+d}">(SV("answer is +42"), CharT('*')); - check.template operator()<"answer is {: d}">(SV("answer is 42"), CharT('*')); + check(SV("answer is 42"), SV("answer is {:d}"), CharT('*')); + check(SV("answer is 42"), SV("answer is {:-d}"), CharT('*')); + check(SV("answer is +42"), SV("answer is {:+d}"), CharT('*')); + check(SV("answer is 42"), SV("answer is {: d}"), CharT('*')); // *** alternate form *** - check.template operator()<"answer is {:+#d}">(SV("answer is +42"), CharT('*')); - check.template operator()<"answer is {:+b}">(SV("answer is +101010"), CharT('*')); - check.template operator()<"answer is {:+#b}">(SV("answer is +0b101010"), CharT('*')); - check.template operator()<"answer is {:+#B}">(SV("answer is +0B101010"), CharT('*')); - check.template operator()<"answer is {:+o}">(SV("answer is +52"), CharT('*')); - check.template operator()<"answer is {:+#o}">(SV("answer is +052"), CharT('*')); - check.template operator()<"answer is {:+x}">(SV("answer is +2a"), CharT('*')); - check.template operator()<"answer is {:+#x}">(SV("answer is +0x2a"), CharT('*')); - check.template operator()<"answer is {:+X}">(SV("answer is +2A"), CharT('*')); - check.template operator()<"answer is {:+#X}">(SV("answer is +0X2A"), CharT('*')); + check(SV("answer is +42"), SV("answer is {:+#d}"), CharT('*')); + check(SV("answer is +101010"), SV("answer is {:+b}"), CharT('*')); + check(SV("answer is +0b101010"), SV("answer is {:+#b}"), CharT('*')); + check(SV("answer is +0B101010"), SV("answer is {:+#B}"), CharT('*')); + check(SV("answer is +52"), SV("answer is {:+o}"), CharT('*')); + check(SV("answer is +052"), SV("answer is {:+#o}"), CharT('*')); + check(SV("answer is +2a"), SV("answer is {:+x}"), CharT('*')); + check(SV("answer is +0x2a"), SV("answer is {:+#x}"), CharT('*')); + check(SV("answer is +2A"), SV("answer is {:+X}"), CharT('*')); + check(SV("answer is +0X2A"), SV("answer is {:+#X}"), CharT('*')); // *** zero-padding & width *** - check.template operator()<"answer is {:+#012d}">(SV("answer is +00000000042"), CharT('*')); - check.template operator()<"answer is {:+012b}">(SV("answer is +00000101010"), CharT('*')); - check.template operator()<"answer is {:+#012b}">(SV("answer is +0b000101010"), CharT('*')); - check.template operator()<"answer is {:+#012B}">(SV("answer is +0B000101010"), CharT('*')); - check.template operator()<"answer is {:+012o}">(SV("answer is +00000000052"), CharT('*')); - check.template operator()<"answer is {:+#012o}">(SV("answer is +00000000052"), CharT('*')); - check.template operator()<"answer is {:+012x}">(SV("answer is +0000000002a"), CharT('*')); - check.template operator()<"answer is {:+#012x}">(SV("answer is +0x00000002a"), CharT('*')); - check.template operator()<"answer is {:+012X}">(SV("answer is +0000000002A"), CharT('*')); - - check.template operator()<"answer is {:+#012X}">(SV("answer is +0X00000002A"), CharT('*')); + check(SV("answer is +00000000042"), SV("answer is {:+#012d}"), CharT('*')); + check(SV("answer is +00000101010"), SV("answer is {:+012b}"), CharT('*')); + check(SV("answer is +0b000101010"), SV("answer is {:+#012b}"), CharT('*')); + check(SV("answer is +0B000101010"), SV("answer is {:+#012B}"), CharT('*')); + check(SV("answer is +00000000052"), SV("answer is {:+012o}"), CharT('*')); + check(SV("answer is +00000000052"), SV("answer is {:+#012o}"), CharT('*')); + check(SV("answer is +0000000002a"), SV("answer is {:+012x}"), CharT('*')); + check(SV("answer is +0x00000002a"), SV("answer is {:+#012x}"), CharT('*')); + check(SV("answer is +0000000002A"), SV("answer is {:+012X}"), CharT('*')); + + check(SV("answer is +0X00000002A"), SV("answer is {:+#012X}"), CharT('*')); // *** precision *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:.d}"), CharT('*')); @@ -1001,116 +998,116 @@ // Test whether the hexadecimal letters are the proper case. // The precision is too large for float, so two tests are used. - check.template operator()<"answer is '{:a}'">(SV("answer is '1.abcp+0'"), F(0x1.abcp+0)); - check.template operator()<"answer is '{:a}'">(SV("answer is '1.defp+0'"), F(0x1.defp+0)); + check(SV("answer is '1.abcp+0'"), SV("answer is '{:a}'"), F(0x1.abcp+0)); + check(SV("answer is '1.defp+0'"), SV("answer is '{:a}'"), F(0x1.defp+0)); // *** align-fill & width *** - check.template operator()<"answer is '{:7a}'">(SV("answer is ' 1p-2'"), F(0.25)); - check.template operator()<"answer is '{:>7a}'">(SV("answer is ' 1p-2'"), F(0.25)); - check.template operator()<"answer is '{:<7a}'">(SV("answer is '1p-2 '"), F(0.25)); - check.template operator()<"answer is '{:^7a}'">(SV("answer is ' 1p-2 '"), F(0.25)); + check(SV("answer is ' 1p-2'"), SV("answer is '{:7a}'"), F(0.25)); + check(SV("answer is ' 1p-2'"), SV("answer is '{:>7a}'"), F(0.25)); + check(SV("answer is '1p-2 '"), SV("answer is '{:<7a}'"), F(0.25)); + check(SV("answer is ' 1p-2 '"), SV("answer is '{:^7a}'"), F(0.25)); - check.template operator()<"answer is '{:->7a}'">(SV("answer is '---1p-3'"), F(125e-3)); - check.template operator()<"answer is '{:-<7a}'">(SV("answer is '1p-3---'"), F(125e-3)); - check.template operator()<"answer is '{:-^7a}'">(SV("answer is '-1p-3--'"), F(125e-3)); + check(SV("answer is '---1p-3'"), SV("answer is '{:->7a}'"), F(125e-3)); + check(SV("answer is '1p-3---'"), SV("answer is '{:-<7a}'"), F(125e-3)); + check(SV("answer is '-1p-3--'"), SV("answer is '{:-^7a}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6a}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6a}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6a}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6a}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6a}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6a}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7a}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7a}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7a}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7a}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6a}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6a}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6a}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6a}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6a}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6a}'"), nan_pos); - check.template operator()<"answer is '{:0>7a}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7a}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7a}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7a}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7a}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7a}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07a}'">(SV("answer is ' 1p-2'"), F(0.25)); - check.template operator()<"answer is '{:<07a}'">(SV("answer is '1p-2 '"), F(0.25)); - check.template operator()<"answer is '{:^07a}'">(SV("answer is ' 1p-2 '"), F(0.25)); + check(SV("answer is ' 1p-2'"), SV("answer is '{:>07a}'"), F(0.25)); + check(SV("answer is '1p-2 '"), SV("answer is '{:<07a}'"), F(0.25)); + check(SV("answer is ' 1p-2 '"), SV("answer is '{:^07a}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:a}'">(SV("answer is '0p+0'"), F(0)); - check.template operator()<"answer is '{:-a}'">(SV("answer is '0p+0'"), F(0)); - check.template operator()<"answer is '{:+a}'">(SV("answer is '+0p+0'"), F(0)); - check.template operator()<"answer is '{: a}'">(SV("answer is ' 0p+0'"), F(0)); + check(SV("answer is '0p+0'"), SV("answer is '{:a}'"), F(0)); + check(SV("answer is '0p+0'"), SV("answer is '{:-a}'"), F(0)); + check(SV("answer is '+0p+0'"), SV("answer is '{:+a}'"), F(0)); + check(SV("answer is ' 0p+0'"), SV("answer is '{: a}'"), F(0)); - check.template operator()<"answer is '{:a}'">(SV("answer is '-0p+0'"), F(-0.)); - check.template operator()<"answer is '{:-a}'">(SV("answer is '-0p+0'"), F(-0.)); - check.template operator()<"answer is '{:+a}'">(SV("answer is '-0p+0'"), F(-0.)); - check.template operator()<"answer is '{: a}'">(SV("answer is '-0p+0'"), F(-0.)); + check(SV("answer is '-0p+0'"), SV("answer is '{:a}'"), F(-0.)); + check(SV("answer is '-0p+0'"), SV("answer is '{:-a}'"), F(-0.)); + check(SV("answer is '-0p+0'"), SV("answer is '{:+a}'"), F(-0.)); + check(SV("answer is '-0p+0'"), SV("answer is '{: a}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+a}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+a}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: a}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: a}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:a}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-a}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: a}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: a}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:a}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-a}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: a}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: a}'"), nan_neg); // *** alternate form *** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:a}'">(SV("answer is '0p+0'"), F(0)); - check.template operator()<"answer is '{:#a}'">(SV("answer is '0.p+0'"), F(0)); + check(SV("answer is '0p+0'"), SV("answer is '{:a}'"), F(0)); + check(SV("answer is '0.p+0'"), SV("answer is '{:#a}'"), F(0)); - check.template operator()<"answer is '{:.0a}'">(SV("answer is '1p+1'"), F(2.5)); - check.template operator()<"answer is '{:#.0a}'">(SV("answer is '1.p+1'"), F(2.5)); - check.template operator()<"answer is '{:#a}'">(SV("answer is '1.4p+1'"), F(2.5)); + check(SV("answer is '1p+1'"), SV("answer is '{:.0a}'"), F(2.5)); + check(SV("answer is '1.p+1'"), SV("answer is '{:#.0a}'"), F(2.5)); + check(SV("answer is '1.4p+1'"), SV("answer is '{:#a}'"), F(2.5)); - check.template operator()<"answer is '{:#a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#a}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#a}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#a}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#a}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#a}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:04a}'">(SV("answer is '1p-5'"), 0.03125); - check.template operator()<"answer is '{:+05a}'">(SV("answer is '+1p-5'"), 0.03125); - check.template operator()<"answer is '{:+06a}'">(SV("answer is '+01p-5'"), 0.03125); - - check.template operator()<"answer is '{:07a}'">(SV("answer is '0001p-5'"), 0.03125); - check.template operator()<"answer is '{:-07a}'">(SV("answer is '0001p-5'"), 0.03125); - check.template operator()<"answer is '{:+07a}'">(SV("answer is '+001p-5'"), 0.03125); - check.template operator()<"answer is '{: 07a}'">(SV("answer is ' 001p-5'"), 0.03125); - - check.template operator()<"answer is '{:010a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010a}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010a}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010a}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010a}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010a}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010a}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010a}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010a}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010a}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010a}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '1p-5'"), SV("answer is '{:04a}'"), 0.03125); + check(SV("answer is '+1p-5'"), SV("answer is '{:+05a}'"), 0.03125); + check(SV("answer is '+01p-5'"), SV("answer is '{:+06a}'"), 0.03125); + + check(SV("answer is '0001p-5'"), SV("answer is '{:07a}'"), 0.03125); + check(SV("answer is '0001p-5'"), SV("answer is '{:-07a}'"), 0.03125); + check(SV("answer is '+001p-5'"), SV("answer is '{:+07a}'"), 0.03125); + check(SV("answer is ' 001p-5'"), SV("answer is '{: 07a}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010a}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010a}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010a}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010a}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010a}'"), nan_neg); // *** precision *** // See format_test_floating_point_hex_lower_case_precision @@ -1126,116 +1123,116 @@ // Test whether the hexadecimal letters are the proper case. // The precision is too large for float, so two tests are used. - check.template operator()<"answer is '{:A}'">(SV("answer is '1.ABCP+0'"), F(0x1.abcp+0)); - check.template operator()<"answer is '{:A}'">(SV("answer is '1.DEFP+0'"), F(0x1.defp+0)); + check(SV("answer is '1.ABCP+0'"), SV("answer is '{:A}'"), F(0x1.abcp+0)); + check(SV("answer is '1.DEFP+0'"), SV("answer is '{:A}'"), F(0x1.defp+0)); // *** align-fill & width *** - check.template operator()<"answer is '{:7A}'">(SV("answer is ' 1P-2'"), F(0.25)); - check.template operator()<"answer is '{:>7A}'">(SV("answer is ' 1P-2'"), F(0.25)); - check.template operator()<"answer is '{:<7A}'">(SV("answer is '1P-2 '"), F(0.25)); - check.template operator()<"answer is '{:^7A}'">(SV("answer is ' 1P-2 '"), F(0.25)); + check(SV("answer is ' 1P-2'"), SV("answer is '{:7A}'"), F(0.25)); + check(SV("answer is ' 1P-2'"), SV("answer is '{:>7A}'"), F(0.25)); + check(SV("answer is '1P-2 '"), SV("answer is '{:<7A}'"), F(0.25)); + check(SV("answer is ' 1P-2 '"), SV("answer is '{:^7A}'"), F(0.25)); - check.template operator()<"answer is '{:->7A}'">(SV("answer is '---1P-3'"), F(125e-3)); - check.template operator()<"answer is '{:-<7A}'">(SV("answer is '1P-3---'"), F(125e-3)); - check.template operator()<"answer is '{:-^7A}'">(SV("answer is '-1P-3--'"), F(125e-3)); + check(SV("answer is '---1P-3'"), SV("answer is '{:->7A}'"), F(125e-3)); + check(SV("answer is '1P-3---'"), SV("answer is '{:-<7A}'"), F(125e-3)); + check(SV("answer is '-1P-3--'"), SV("answer is '{:-^7A}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6A}'">(SV("answer is '***INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6A}'">(SV("answer is 'INF***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6A}'">(SV("answer is '*INF**'"), std::numeric_limits::infinity()); + check(SV("answer is '***INF'"), SV("answer is '{:*>6A}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF***'"), SV("answer is '{:*<6A}'"), std::numeric_limits::infinity()); + check(SV("answer is '*INF**'"), SV("answer is '{:*^6A}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7A}'">(SV("answer is '###-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7A}'">(SV("answer is '-INF###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7A}'">(SV("answer is '#-INF##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-INF'"), SV("answer is '{:#>7A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF###'"), SV("answer is '{:#<7A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-INF##'"), SV("answer is '{:#^7A}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6A}'">(SV("answer is '^^^NAN'"), nan_pos); - check.template operator()<"answer is '{:^<6A}'">(SV("answer is 'NAN^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6A}'">(SV("answer is '^NAN^^'"), nan_pos); + check(SV("answer is '^^^NAN'"), SV("answer is '{:^>6A}'"), nan_pos); + check(SV("answer is 'NAN^^^'"), SV("answer is '{:^<6A}'"), nan_pos); + check(SV("answer is '^NAN^^'"), SV("answer is '{:^^6A}'"), nan_pos); - check.template operator()<"answer is '{:0>7A}'">(SV("answer is '000-NAN'"), nan_neg); - check.template operator()<"answer is '{:0<7A}'">(SV("answer is '-NAN000'"), nan_neg); - check.template operator()<"answer is '{:0^7A}'">(SV("answer is '0-NAN00'"), nan_neg); + check(SV("answer is '000-NAN'"), SV("answer is '{:0>7A}'"), nan_neg); + check(SV("answer is '-NAN000'"), SV("answer is '{:0<7A}'"), nan_neg); + check(SV("answer is '0-NAN00'"), SV("answer is '{:0^7A}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07A}'">(SV("answer is ' 1P-2'"), F(0.25)); - check.template operator()<"answer is '{:<07A}'">(SV("answer is '1P-2 '"), F(0.25)); - check.template operator()<"answer is '{:^07A}'">(SV("answer is ' 1P-2 '"), F(0.25)); + check(SV("answer is ' 1P-2'"), SV("answer is '{:>07A}'"), F(0.25)); + check(SV("answer is '1P-2 '"), SV("answer is '{:<07A}'"), F(0.25)); + check(SV("answer is ' 1P-2 '"), SV("answer is '{:^07A}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:A}'">(SV("answer is '0P+0'"), F(0)); - check.template operator()<"answer is '{:-A}'">(SV("answer is '0P+0'"), F(0)); - check.template operator()<"answer is '{:+A}'">(SV("answer is '+0P+0'"), F(0)); - check.template operator()<"answer is '{: A}'">(SV("answer is ' 0P+0'"), F(0)); + check(SV("answer is '0P+0'"), SV("answer is '{:A}'"), F(0)); + check(SV("answer is '0P+0'"), SV("answer is '{:-A}'"), F(0)); + check(SV("answer is '+0P+0'"), SV("answer is '{:+A}'"), F(0)); + check(SV("answer is ' 0P+0'"), SV("answer is '{: A}'"), F(0)); - check.template operator()<"answer is '{:A}'">(SV("answer is '-0P+0'"), F(-0.)); - check.template operator()<"answer is '{:-A}'">(SV("answer is '-0P+0'"), F(-0.)); - check.template operator()<"answer is '{:+A}'">(SV("answer is '-0P+0'"), F(-0.)); - check.template operator()<"answer is '{: A}'">(SV("answer is '-0P+0'"), F(-0.)); + check(SV("answer is '-0P+0'"), SV("answer is '{:A}'"), F(-0.)); + check(SV("answer is '-0P+0'"), SV("answer is '{:-A}'"), F(-0.)); + check(SV("answer is '-0P+0'"), SV("answer is '{:+A}'"), F(-0.)); + check(SV("answer is '-0P+0'"), SV("answer is '{: A}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+A}'">(SV("answer is '+INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:-A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:+A}'">(SV("answer is '+NAN'"), nan_pos); - check.template operator()<"answer is '{: A}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:-A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:+A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{: A}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'INF'"), SV("answer is '{:A}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:-A}'"), std::numeric_limits::infinity()); + check(SV("answer is '+INF'"), SV("answer is '{:+A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: A}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-INF'"), SV("answer is '{:A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:-A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:+A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{: A}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'NAN'"), SV("answer is '{:A}'"), nan_pos); + check(SV("answer is 'NAN'"), SV("answer is '{:-A}'"), nan_pos); + check(SV("answer is '+NAN'"), SV("answer is '{:+A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: A}'"), nan_pos); + + check(SV("answer is '-NAN'"), SV("answer is '{:A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:-A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:+A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{: A}'"), nan_neg); // *** alternate form *** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:A}'">(SV("answer is '0P+0'"), F(0)); - check.template operator()<"answer is '{:#A}'">(SV("answer is '0.P+0'"), F(0)); + check(SV("answer is '0P+0'"), SV("answer is '{:A}'"), F(0)); + check(SV("answer is '0.P+0'"), SV("answer is '{:#A}'"), F(0)); - check.template operator()<"answer is '{:.0A}'">(SV("answer is '1P+1'"), F(2.5)); - check.template operator()<"answer is '{:#.0A}'">(SV("answer is '1.P+1'"), F(2.5)); - check.template operator()<"answer is '{:#A}'">(SV("answer is '1.4P+1'"), F(2.5)); + check(SV("answer is '1P+1'"), SV("answer is '{:.0A}'"), F(2.5)); + check(SV("answer is '1.P+1'"), SV("answer is '{:#.0A}'"), F(2.5)); + check(SV("answer is '1.4P+1'"), SV("answer is '{:#A}'"), F(2.5)); - check.template operator()<"answer is '{:#A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:#A}'"), std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:#A}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:#A}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'NAN'"), SV("answer is '{:#A}'"), nan_pos); + check(SV("answer is '-NAN'"), SV("answer is '{:#A}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:04A}'">(SV("answer is '1P-5'"), 0.03125); - check.template operator()<"answer is '{:+05A}'">(SV("answer is '+1P-5'"), 0.03125); - check.template operator()<"answer is '{:+06A}'">(SV("answer is '+01P-5'"), 0.03125); - - check.template operator()<"answer is '{:07A}'">(SV("answer is '0001P-5'"), 0.03125); - check.template operator()<"answer is '{:-07A}'">(SV("answer is '0001P-5'"), 0.03125); - check.template operator()<"answer is '{:+07A}'">(SV("answer is '+001P-5'"), 0.03125); - check.template operator()<"answer is '{: 07A}'">(SV("answer is ' 001P-5'"), 0.03125); - - check.template operator()<"answer is '{:010A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010A}'">(SV("answer is ' +INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010A}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010A}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010A}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010A}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010A}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:-010A}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:+010A}'">(SV("answer is ' +NAN'"), nan_pos); - check.template operator()<"answer is '{: 010A}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:010A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:-010A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:+010A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{: 010A}'">(SV("answer is ' -NAN'"), nan_neg); + check(SV("answer is '1P-5'"), SV("answer is '{:04A}'"), 0.03125); + check(SV("answer is '+1P-5'"), SV("answer is '{:+05A}'"), 0.03125); + check(SV("answer is '+01P-5'"), SV("answer is '{:+06A}'"), 0.03125); + + check(SV("answer is '0001P-5'"), SV("answer is '{:07A}'"), 0.03125); + check(SV("answer is '0001P-5'"), SV("answer is '{:-07A}'"), 0.03125); + check(SV("answer is '+001P-5'"), SV("answer is '{:+07A}'"), 0.03125); + check(SV("answer is ' 001P-5'"), SV("answer is '{: 07A}'"), 0.03125); + + check(SV("answer is ' INF'"), SV("answer is '{:010A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{:-010A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +INF'"), SV("answer is '{:+010A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: 010A}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -INF'"), SV("answer is '{:010A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:-010A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:+010A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{: 010A}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' NAN'"), SV("answer is '{:010A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{:-010A}'"), nan_pos); + check(SV("answer is ' +NAN'"), SV("answer is '{:+010A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: 010A}'"), nan_pos); + + check(SV("answer is ' -NAN'"), SV("answer is '{:010A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:-010A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:+010A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{: 010A}'"), nan_neg); // *** precision *** // See format_test_floating_point_hex_upper_case_precision @@ -1250,109 +1247,106 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:14.6a}'">(SV("answer is ' 1.000000p-2'"), F(0.25)); - check.template operator()<"answer is '{:>14.6a}'">(SV("answer is ' 1.000000p-2'"), F(0.25)); - check.template operator()<"answer is '{:<14.6a}'">(SV("answer is '1.000000p-2 '"), F(0.25)); - check.template operator()<"answer is '{:^14.6a}'">(SV("answer is ' 1.000000p-2 '"), F(0.25)); + check(SV("answer is ' 1.000000p-2'"), SV("answer is '{:14.6a}'"), F(0.25)); + check(SV("answer is ' 1.000000p-2'"), SV("answer is '{:>14.6a}'"), F(0.25)); + check(SV("answer is '1.000000p-2 '"), SV("answer is '{:<14.6a}'"), F(0.25)); + check(SV("answer is ' 1.000000p-2 '"), SV("answer is '{:^14.6a}'"), F(0.25)); - check.template operator()<"answer is '{:->14.6a}'">(SV("answer is '---1.000000p-3'"), F(125e-3)); - check.template operator()<"answer is '{:-<14.6a}'">(SV("answer is '1.000000p-3---'"), F(125e-3)); - check.template operator()<"answer is '{:-^14.6a}'">(SV("answer is '-1.000000p-3--'"), F(125e-3)); + check(SV("answer is '---1.000000p-3'"), SV("answer is '{:->14.6a}'"), F(125e-3)); + check(SV("answer is '1.000000p-3---'"), SV("answer is '{:-<14.6a}'"), F(125e-3)); + check(SV("answer is '-1.000000p-3--'"), SV("answer is '{:-^14.6a}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6.6a}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6.6a}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6.6a}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6.6a}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7.6a}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7.6a}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7.6a}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7.6a}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6.6a}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6.6a}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6.6a}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6.6a}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6.6a}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6.6a}'"), nan_pos); - check.template operator()<"answer is '{:0>7.6a}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7.6a}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7.6a}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7.6a}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7.6a}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7.6a}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>014.6a}'">(SV("answer is ' 1.000000p-2'"), F(0.25)); - check.template operator()<"answer is '{:<014.6a}'">(SV("answer is '1.000000p-2 '"), F(0.25)); - check.template operator()<"answer is '{:^014.6a}'">(SV("answer is ' 1.000000p-2 '"), F(0.25)); + check(SV("answer is ' 1.000000p-2'"), SV("answer is '{:>014.6a}'"), F(0.25)); + check(SV("answer is '1.000000p-2 '"), SV("answer is '{:<014.6a}'"), F(0.25)); + check(SV("answer is ' 1.000000p-2 '"), SV("answer is '{:^014.6a}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:.6a}'">(SV("answer is '0.000000p+0'"), F(0)); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is '0.000000p+0'"), F(0)); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '+0.000000p+0'"), F(0)); - check.template operator()<"answer is '{: .6a}'">(SV("answer is ' 0.000000p+0'"), F(0)); + check(SV("answer is '0.000000p+0'"), SV("answer is '{:.6a}'"), F(0)); + check(SV("answer is '0.000000p+0'"), SV("answer is '{:-.6a}'"), F(0)); + check(SV("answer is '+0.000000p+0'"), SV("answer is '{:+.6a}'"), F(0)); + check(SV("answer is ' 0.000000p+0'"), SV("answer is '{: .6a}'"), F(0)); - check.template operator()<"answer is '{:.6a}'">(SV("answer is '-0.000000p+0'"), F(-0.)); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is '-0.000000p+0'"), F(-0.)); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '-0.000000p+0'"), F(-0.)); - check.template operator()<"answer is '{: .6a}'">(SV("answer is '-0.000000p+0'"), F(-0.)); + check(SV("answer is '-0.000000p+0'"), SV("answer is '{:.6a}'"), F(-0.)); + check(SV("answer is '-0.000000p+0'"), SV("answer is '{:-.6a}'"), F(-0.)); + check(SV("answer is '-0.000000p+0'"), SV("answer is '{:+.6a}'"), F(-0.)); + check(SV("answer is '-0.000000p+0'"), SV("answer is '{: .6a}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:.6a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: .6a}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:.6a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-.6a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+.6a}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: .6a}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: .6a}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: .6a}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:.6a}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-.6a}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+.6a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: .6a}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:.6a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-.6a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+.6a}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: .6a}'"), nan_neg); // *** alternate form *** - check.template operator()<"answer is '{:#.6a}'">(SV("answer is '1.400000p+1'"), F(2.5)); + check(SV("answer is '1.400000p+1'"), SV("answer is '{:#.6a}'"), F(2.5)); - check.template operator()<"answer is '{:#.6a}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6a}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#.6a}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6a}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#.6a}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#.6a}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#.6a}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:011.6a}'">(SV("answer is '1.000000p-5'"), 0.03125); - check.template operator()<"answer is '{:+012.6a}'">(SV("answer is '+1.000000p-5'"), 0.03125); - check.template operator()<"answer is '{:+013.6a}'">(SV("answer is '+01.000000p-5'"), 0.03125); - - check.template operator()<"answer is '{:014.6a}'">(SV("answer is '0001.000000p-5'"), 0.03125); - check.template operator()<"answer is '{:-014.6a}'">(SV("answer is '0001.000000p-5'"), 0.03125); - check.template operator()<"answer is '{:+014.6a}'">(SV("answer is '+001.000000p-5'"), 0.03125); - check.template operator()<"answer is '{: 014.6a}'">(SV("answer is ' 001.000000p-5'"), 0.03125); - - check.template operator()<"answer is '{:010.6a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6a}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6a}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6a}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6a}'">(SV("answer is ' -inf'"), - -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6a}'">(SV("answer is ' -inf'"), - -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6a}'">(SV("answer is ' -inf'"), - -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6a}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010.6a}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010.6a}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010.6a}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010.6a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010.6a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010.6a}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010.6a}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '1.000000p-5'"), SV("answer is '{:011.6a}'"), 0.03125); + check(SV("answer is '+1.000000p-5'"), SV("answer is '{:+012.6a}'"), 0.03125); + check(SV("answer is '+01.000000p-5'"), SV("answer is '{:+013.6a}'"), 0.03125); + + check(SV("answer is '0001.000000p-5'"), SV("answer is '{:014.6a}'"), 0.03125); + check(SV("answer is '0001.000000p-5'"), SV("answer is '{:-014.6a}'"), 0.03125); + check(SV("answer is '+001.000000p-5'"), SV("answer is '{:+014.6a}'"), 0.03125); + check(SV("answer is ' 001.000000p-5'"), SV("answer is '{: 014.6a}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010.6a}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010.6a}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010.6a}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010.6a}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010.6a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010.6a}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010.6a}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010.6a}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010.6a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010.6a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010.6a}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010.6a}'"), nan_neg); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1364,109 +1358,106 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:14.6A}'">(SV("answer is ' 1.000000P-2'"), F(0.25)); - check.template operator()<"answer is '{:>14.6A}'">(SV("answer is ' 1.000000P-2'"), F(0.25)); - check.template operator()<"answer is '{:<14.6A}'">(SV("answer is '1.000000P-2 '"), F(0.25)); - check.template operator()<"answer is '{:^14.6A}'">(SV("answer is ' 1.000000P-2 '"), F(0.25)); + check(SV("answer is ' 1.000000P-2'"), SV("answer is '{:14.6A}'"), F(0.25)); + check(SV("answer is ' 1.000000P-2'"), SV("answer is '{:>14.6A}'"), F(0.25)); + check(SV("answer is '1.000000P-2 '"), SV("answer is '{:<14.6A}'"), F(0.25)); + check(SV("answer is ' 1.000000P-2 '"), SV("answer is '{:^14.6A}'"), F(0.25)); - check.template operator()<"answer is '{:->14.6A}'">(SV("answer is '---1.000000P-3'"), F(125e-3)); - check.template operator()<"answer is '{:-<14.6A}'">(SV("answer is '1.000000P-3---'"), F(125e-3)); - check.template operator()<"answer is '{:-^14.6A}'">(SV("answer is '-1.000000P-3--'"), F(125e-3)); + check(SV("answer is '---1.000000P-3'"), SV("answer is '{:->14.6A}'"), F(125e-3)); + check(SV("answer is '1.000000P-3---'"), SV("answer is '{:-<14.6A}'"), F(125e-3)); + check(SV("answer is '-1.000000P-3--'"), SV("answer is '{:-^14.6A}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6.6A}'">(SV("answer is '***INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6.6A}'">(SV("answer is 'INF***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6.6A}'">(SV("answer is '*INF**'"), std::numeric_limits::infinity()); + check(SV("answer is '***INF'"), SV("answer is '{:*>6.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF***'"), SV("answer is '{:*<6.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is '*INF**'"), SV("answer is '{:*^6.6A}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7.6A}'">(SV("answer is '###-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7.6A}'">(SV("answer is '-INF###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7.6A}'">(SV("answer is '#-INF##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-INF'"), SV("answer is '{:#>7.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF###'"), SV("answer is '{:#<7.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-INF##'"), SV("answer is '{:#^7.6A}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6.6A}'">(SV("answer is '^^^NAN'"), nan_pos); - check.template operator()<"answer is '{:^<6.6A}'">(SV("answer is 'NAN^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6.6A}'">(SV("answer is '^NAN^^'"), nan_pos); + check(SV("answer is '^^^NAN'"), SV("answer is '{:^>6.6A}'"), nan_pos); + check(SV("answer is 'NAN^^^'"), SV("answer is '{:^<6.6A}'"), nan_pos); + check(SV("answer is '^NAN^^'"), SV("answer is '{:^^6.6A}'"), nan_pos); - check.template operator()<"answer is '{:0>7.6A}'">(SV("answer is '000-NAN'"), nan_neg); - check.template operator()<"answer is '{:0<7.6A}'">(SV("answer is '-NAN000'"), nan_neg); - check.template operator()<"answer is '{:0^7.6A}'">(SV("answer is '0-NAN00'"), nan_neg); + check(SV("answer is '000-NAN'"), SV("answer is '{:0>7.6A}'"), nan_neg); + check(SV("answer is '-NAN000'"), SV("answer is '{:0<7.6A}'"), nan_neg); + check(SV("answer is '0-NAN00'"), SV("answer is '{:0^7.6A}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>014.6A}'">(SV("answer is ' 1.000000P-2'"), F(0.25)); - check.template operator()<"answer is '{:<014.6A}'">(SV("answer is '1.000000P-2 '"), F(0.25)); - check.template operator()<"answer is '{:^014.6A}'">(SV("answer is ' 1.000000P-2 '"), F(0.25)); + check(SV("answer is ' 1.000000P-2'"), SV("answer is '{:>014.6A}'"), F(0.25)); + check(SV("answer is '1.000000P-2 '"), SV("answer is '{:<014.6A}'"), F(0.25)); + check(SV("answer is ' 1.000000P-2 '"), SV("answer is '{:^014.6A}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:.6A}'">(SV("answer is '0.000000P+0'"), F(0)); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is '0.000000P+0'"), F(0)); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '+0.000000P+0'"), F(0)); - check.template operator()<"answer is '{: .6A}'">(SV("answer is ' 0.000000P+0'"), F(0)); + check(SV("answer is '0.000000P+0'"), SV("answer is '{:.6A}'"), F(0)); + check(SV("answer is '0.000000P+0'"), SV("answer is '{:-.6A}'"), F(0)); + check(SV("answer is '+0.000000P+0'"), SV("answer is '{:+.6A}'"), F(0)); + check(SV("answer is ' 0.000000P+0'"), SV("answer is '{: .6A}'"), F(0)); - check.template operator()<"answer is '{:.6A}'">(SV("answer is '-0.000000P+0'"), F(-0.)); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is '-0.000000P+0'"), F(-0.)); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '-0.000000P+0'"), F(-0.)); - check.template operator()<"answer is '{: .6A}'">(SV("answer is '-0.000000P+0'"), F(-0.)); + check(SV("answer is '-0.000000P+0'"), SV("answer is '{:.6A}'"), F(-0.)); + check(SV("answer is '-0.000000P+0'"), SV("answer is '{:-.6A}'"), F(-0.)); + check(SV("answer is '-0.000000P+0'"), SV("answer is '{:+.6A}'"), F(-0.)); + check(SV("answer is '-0.000000P+0'"), SV("answer is '{: .6A}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:.6A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '+INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '+NAN'"), nan_pos); - check.template operator()<"answer is '{: .6A}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:.6A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:-.6A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:+.6A}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{: .6A}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'INF'"), SV("answer is '{:.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:-.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is '+INF'"), SV("answer is '{:+.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: .6A}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-INF'"), SV("answer is '{:.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:-.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:+.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{: .6A}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'NAN'"), SV("answer is '{:.6A}'"), nan_pos); + check(SV("answer is 'NAN'"), SV("answer is '{:-.6A}'"), nan_pos); + check(SV("answer is '+NAN'"), SV("answer is '{:+.6A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: .6A}'"), nan_pos); + + check(SV("answer is '-NAN'"), SV("answer is '{:.6A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:-.6A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:+.6A}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{: .6A}'"), nan_neg); // *** alternate form *** - check.template operator()<"answer is '{:#.6A}'">(SV("answer is '1.400000P+1'"), F(2.5)); + check(SV("answer is '1.400000P+1'"), SV("answer is '{:#.6A}'"), F(2.5)); - check.template operator()<"answer is '{:#.6A}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6A}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:#.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:#.6A}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6A}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:#.6A}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'NAN'"), SV("answer is '{:#.6A}'"), nan_pos); + check(SV("answer is '-NAN'"), SV("answer is '{:#.6A}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:011.6A}'">(SV("answer is '1.000000P-5'"), 0.03125); - check.template operator()<"answer is '{:+012.6A}'">(SV("answer is '+1.000000P-5'"), 0.03125); - check.template operator()<"answer is '{:+013.6A}'">(SV("answer is '+01.000000P-5'"), 0.03125); - - check.template operator()<"answer is '{:014.6A}'">(SV("answer is '0001.000000P-5'"), 0.03125); - check.template operator()<"answer is '{:-014.6A}'">(SV("answer is '0001.000000P-5'"), 0.03125); - check.template operator()<"answer is '{:+014.6A}'">(SV("answer is '+001.000000P-5'"), 0.03125); - check.template operator()<"answer is '{: 014.6A}'">(SV("answer is ' 001.000000P-5'"), 0.03125); - - check.template operator()<"answer is '{:010.6A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6A}'">(SV("answer is ' +INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6A}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6A}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6A}'">(SV("answer is ' -INF'"), - -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6A}'">(SV("answer is ' -INF'"), - -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6A}'">(SV("answer is ' -INF'"), - -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6A}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:-010.6A}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:+010.6A}'">(SV("answer is ' +NAN'"), nan_pos); - check.template operator()<"answer is '{: 010.6A}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:010.6A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:-010.6A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:+010.6A}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{: 010.6A}'">(SV("answer is ' -NAN'"), nan_neg); + check(SV("answer is '1.000000P-5'"), SV("answer is '{:011.6A}'"), 0.03125); + check(SV("answer is '+1.000000P-5'"), SV("answer is '{:+012.6A}'"), 0.03125); + check(SV("answer is '+01.000000P-5'"), SV("answer is '{:+013.6A}'"), 0.03125); + + check(SV("answer is '0001.000000P-5'"), SV("answer is '{:014.6A}'"), 0.03125); + check(SV("answer is '0001.000000P-5'"), SV("answer is '{:-014.6A}'"), 0.03125); + check(SV("answer is '+001.000000P-5'"), SV("answer is '{:+014.6A}'"), 0.03125); + check(SV("answer is ' 001.000000P-5'"), SV("answer is '{: 014.6A}'"), 0.03125); + + check(SV("answer is ' INF'"), SV("answer is '{:010.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{:-010.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +INF'"), SV("answer is '{:+010.6A}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: 010.6A}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -INF'"), SV("answer is '{:010.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:-010.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:+010.6A}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{: 010.6A}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' NAN'"), SV("answer is '{:010.6A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{:-010.6A}'"), nan_pos); + check(SV("answer is ' +NAN'"), SV("answer is '{:+010.6A}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: 010.6A}'"), nan_pos); + + check(SV("answer is ' -NAN'"), SV("answer is '{:010.6A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:-010.6A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:+010.6A}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{: 010.6A}'"), nan_neg); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1478,118 +1469,118 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:15e}'">(SV("answer is ' 2.500000e-01'"), F(0.25)); - check.template operator()<"answer is '{:>15e}'">(SV("answer is ' 2.500000e-01'"), F(0.25)); - check.template operator()<"answer is '{:<15e}'">(SV("answer is '2.500000e-01 '"), F(0.25)); - check.template operator()<"answer is '{:^15e}'">(SV("answer is ' 2.500000e-01 '"), F(0.25)); + check(SV("answer is ' 2.500000e-01'"), SV("answer is '{:15e}'"), F(0.25)); + check(SV("answer is ' 2.500000e-01'"), SV("answer is '{:>15e}'"), F(0.25)); + check(SV("answer is '2.500000e-01 '"), SV("answer is '{:<15e}'"), F(0.25)); + check(SV("answer is ' 2.500000e-01 '"), SV("answer is '{:^15e}'"), F(0.25)); - check.template operator()<"answer is '{:->15e}'">(SV("answer is '---1.250000e-01'"), F(125e-3)); - check.template operator()<"answer is '{:-<15e}'">(SV("answer is '1.250000e-01---'"), F(125e-3)); - check.template operator()<"answer is '{:-^15e}'">(SV("answer is '-1.250000e-01--'"), F(125e-3)); + check(SV("answer is '---1.250000e-01'"), SV("answer is '{:->15e}'"), F(125e-3)); + check(SV("answer is '1.250000e-01---'"), SV("answer is '{:-<15e}'"), F(125e-3)); + check(SV("answer is '-1.250000e-01--'"), SV("answer is '{:-^15e}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6e}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6e}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6e}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6e}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6e}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6e}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7e}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7e}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7e}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7e}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7e}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7e}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6e}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6e}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6e}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6e}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6e}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6e}'"), nan_pos); - check.template operator()<"answer is '{:0>7e}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7e}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7e}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7e}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7e}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7e}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>015e}'">(SV("answer is ' 2.500000e-01'"), F(0.25)); - check.template operator()<"answer is '{:<015e}'">(SV("answer is '2.500000e-01 '"), F(0.25)); - check.template operator()<"answer is '{:^015e}'">(SV("answer is ' 2.500000e-01 '"), F(0.25)); + check(SV("answer is ' 2.500000e-01'"), SV("answer is '{:>015e}'"), F(0.25)); + check(SV("answer is '2.500000e-01 '"), SV("answer is '{:<015e}'"), F(0.25)); + check(SV("answer is ' 2.500000e-01 '"), SV("answer is '{:^015e}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:e}'">(SV("answer is '0.000000e+00'"), F(0)); - check.template operator()<"answer is '{:-e}'">(SV("answer is '0.000000e+00'"), F(0)); - check.template operator()<"answer is '{:+e}'">(SV("answer is '+0.000000e+00'"), F(0)); - check.template operator()<"answer is '{: e}'">(SV("answer is ' 0.000000e+00'"), F(0)); + check(SV("answer is '0.000000e+00'"), SV("answer is '{:e}'"), F(0)); + check(SV("answer is '0.000000e+00'"), SV("answer is '{:-e}'"), F(0)); + check(SV("answer is '+0.000000e+00'"), SV("answer is '{:+e}'"), F(0)); + check(SV("answer is ' 0.000000e+00'"), SV("answer is '{: e}'"), F(0)); - check.template operator()<"answer is '{:e}'">(SV("answer is '-0.000000e+00'"), F(-0.)); - check.template operator()<"answer is '{:-e}'">(SV("answer is '-0.000000e+00'"), F(-0.)); - check.template operator()<"answer is '{:+e}'">(SV("answer is '-0.000000e+00'"), F(-0.)); - check.template operator()<"answer is '{: e}'">(SV("answer is '-0.000000e+00'"), F(-0.)); + check(SV("answer is '-0.000000e+00'"), SV("answer is '{:e}'"), F(-0.)); + check(SV("answer is '-0.000000e+00'"), SV("answer is '{:-e}'"), F(-0.)); + check(SV("answer is '-0.000000e+00'"), SV("answer is '{:+e}'"), F(-0.)); + check(SV("answer is '-0.000000e+00'"), SV("answer is '{: e}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:e}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-e}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+e}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: e}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:e}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-e}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+e}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: e}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:e}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-e}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+e}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: e}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:e}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-e}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+e}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: e}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:e}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-e}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+e}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: e}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:e}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-e}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+e}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: e}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:e}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-e}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+e}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: e}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:e}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-e}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+e}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: e}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0e}'">(SV("answer is '0e+00'"), F(0)); - check.template operator()<"answer is '{:#.0e}'">(SV("answer is '0.e+00'"), F(0)); + check(SV("answer is '0e+00'"), SV("answer is '{:.0e}'"), F(0)); + check(SV("answer is '0.e+00'"), SV("answer is '{:#.0e}'"), F(0)); - check.template operator()<"answer is '{:#e}'">(SV("answer is '0.000000e+00'"), F(0)); - check.template operator()<"answer is '{:#e}'">(SV("answer is '2.500000e+00'"), F(2.5)); + check(SV("answer is '0.000000e+00'"), SV("answer is '{:#e}'"), F(0)); + check(SV("answer is '2.500000e+00'"), SV("answer is '{:#e}'"), F(2.5)); - check.template operator()<"answer is '{:#e}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#e}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#e}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#e}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#e}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#e}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#e}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#e}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:07e}'">(SV("answer is '3.125000e-02'"), 0.03125); - check.template operator()<"answer is '{:+07e}'">(SV("answer is '+3.125000e-02'"), 0.03125); - check.template operator()<"answer is '{:+08e}'">(SV("answer is '+3.125000e-02'"), 0.03125); - check.template operator()<"answer is '{:+09e}'">(SV("answer is '+3.125000e-02'"), 0.03125); - - check.template operator()<"answer is '{:014e}'">(SV("answer is '003.125000e-02'"), 0.03125); - check.template operator()<"answer is '{:-014e}'">(SV("answer is '003.125000e-02'"), 0.03125); - check.template operator()<"answer is '{:+014e}'">(SV("answer is '+03.125000e-02'"), 0.03125); - check.template operator()<"answer is '{: 014e}'">(SV("answer is ' 03.125000e-02'"), 0.03125); - - check.template operator()<"answer is '{:010e}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010e}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010e}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010e}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010e}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010e}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010e}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010e}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010e}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010e}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010e}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010e}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010e}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010e}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010e}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010e}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '3.125000e-02'"), SV("answer is '{:07e}'"), 0.03125); + check(SV("answer is '+3.125000e-02'"), SV("answer is '{:+07e}'"), 0.03125); + check(SV("answer is '+3.125000e-02'"), SV("answer is '{:+08e}'"), 0.03125); + check(SV("answer is '+3.125000e-02'"), SV("answer is '{:+09e}'"), 0.03125); + + check(SV("answer is '003.125000e-02'"), SV("answer is '{:014e}'"), 0.03125); + check(SV("answer is '003.125000e-02'"), SV("answer is '{:-014e}'"), 0.03125); + check(SV("answer is '+03.125000e-02'"), SV("answer is '{:+014e}'"), 0.03125); + check(SV("answer is ' 03.125000e-02'"), SV("answer is '{: 014e}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010e}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010e}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010e}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010e}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010e}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010e}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010e}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010e}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010e}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010e}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010e}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010e}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010e}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010e}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010e}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010e}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0e}'">(SV("answer is '3e-02'"), 0.03125); - check.template operator()<"answer is '{:.1e}'">(SV("answer is '3.1e-02'"), 0.03125); - check.template operator()<"answer is '{:.3e}'">(SV("answer is '3.125e-02'"), 0.03125); - check.template operator()<"answer is '{:.10e}'">(SV("answer is '3.1250000000e-02'"), 0.03125); + check(SV("answer is '3e-02'"), SV("answer is '{:.0e}'"), 0.03125); + check(SV("answer is '3.1e-02'"), SV("answer is '{:.1e}'"), 0.03125); + check(SV("answer is '3.125e-02'"), SV("answer is '{:.3e}'"), 0.03125); + check(SV("answer is '3.1250000000e-02'"), SV("answer is '{:.10e}'"), 0.03125); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1601,118 +1592,118 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:15E}'">(SV("answer is ' 2.500000E-01'"), F(0.25)); - check.template operator()<"answer is '{:>15E}'">(SV("answer is ' 2.500000E-01'"), F(0.25)); - check.template operator()<"answer is '{:<15E}'">(SV("answer is '2.500000E-01 '"), F(0.25)); - check.template operator()<"answer is '{:^15E}'">(SV("answer is ' 2.500000E-01 '"), F(0.25)); + check(SV("answer is ' 2.500000E-01'"), SV("answer is '{:15E}'"), F(0.25)); + check(SV("answer is ' 2.500000E-01'"), SV("answer is '{:>15E}'"), F(0.25)); + check(SV("answer is '2.500000E-01 '"), SV("answer is '{:<15E}'"), F(0.25)); + check(SV("answer is ' 2.500000E-01 '"), SV("answer is '{:^15E}'"), F(0.25)); - check.template operator()<"answer is '{:->15E}'">(SV("answer is '---1.250000E-01'"), F(125e-3)); - check.template operator()<"answer is '{:-<15E}'">(SV("answer is '1.250000E-01---'"), F(125e-3)); - check.template operator()<"answer is '{:-^15E}'">(SV("answer is '-1.250000E-01--'"), F(125e-3)); + check(SV("answer is '---1.250000E-01'"), SV("answer is '{:->15E}'"), F(125e-3)); + check(SV("answer is '1.250000E-01---'"), SV("answer is '{:-<15E}'"), F(125e-3)); + check(SV("answer is '-1.250000E-01--'"), SV("answer is '{:-^15E}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6E}'">(SV("answer is '***INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6E}'">(SV("answer is 'INF***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6E}'">(SV("answer is '*INF**'"), std::numeric_limits::infinity()); + check(SV("answer is '***INF'"), SV("answer is '{:*>6E}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF***'"), SV("answer is '{:*<6E}'"), std::numeric_limits::infinity()); + check(SV("answer is '*INF**'"), SV("answer is '{:*^6E}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7E}'">(SV("answer is '###-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7E}'">(SV("answer is '-INF###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7E}'">(SV("answer is '#-INF##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-INF'"), SV("answer is '{:#>7E}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF###'"), SV("answer is '{:#<7E}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-INF##'"), SV("answer is '{:#^7E}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6E}'">(SV("answer is '^^^NAN'"), nan_pos); - check.template operator()<"answer is '{:^<6E}'">(SV("answer is 'NAN^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6E}'">(SV("answer is '^NAN^^'"), nan_pos); + check(SV("answer is '^^^NAN'"), SV("answer is '{:^>6E}'"), nan_pos); + check(SV("answer is 'NAN^^^'"), SV("answer is '{:^<6E}'"), nan_pos); + check(SV("answer is '^NAN^^'"), SV("answer is '{:^^6E}'"), nan_pos); - check.template operator()<"answer is '{:0>7E}'">(SV("answer is '000-NAN'"), nan_neg); - check.template operator()<"answer is '{:0<7E}'">(SV("answer is '-NAN000'"), nan_neg); - check.template operator()<"answer is '{:0^7E}'">(SV("answer is '0-NAN00'"), nan_neg); + check(SV("answer is '000-NAN'"), SV("answer is '{:0>7E}'"), nan_neg); + check(SV("answer is '-NAN000'"), SV("answer is '{:0<7E}'"), nan_neg); + check(SV("answer is '0-NAN00'"), SV("answer is '{:0^7E}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>015E}'">(SV("answer is ' 2.500000E-01'"), F(0.25)); - check.template operator()<"answer is '{:<015E}'">(SV("answer is '2.500000E-01 '"), F(0.25)); - check.template operator()<"answer is '{:^015E}'">(SV("answer is ' 2.500000E-01 '"), F(0.25)); + check(SV("answer is ' 2.500000E-01'"), SV("answer is '{:>015E}'"), F(0.25)); + check(SV("answer is '2.500000E-01 '"), SV("answer is '{:<015E}'"), F(0.25)); + check(SV("answer is ' 2.500000E-01 '"), SV("answer is '{:^015E}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:E}'">(SV("answer is '0.000000E+00'"), F(0)); - check.template operator()<"answer is '{:-E}'">(SV("answer is '0.000000E+00'"), F(0)); - check.template operator()<"answer is '{:+E}'">(SV("answer is '+0.000000E+00'"), F(0)); - check.template operator()<"answer is '{: E}'">(SV("answer is ' 0.000000E+00'"), F(0)); + check(SV("answer is '0.000000E+00'"), SV("answer is '{:E}'"), F(0)); + check(SV("answer is '0.000000E+00'"), SV("answer is '{:-E}'"), F(0)); + check(SV("answer is '+0.000000E+00'"), SV("answer is '{:+E}'"), F(0)); + check(SV("answer is ' 0.000000E+00'"), SV("answer is '{: E}'"), F(0)); - check.template operator()<"answer is '{:E}'">(SV("answer is '-0.000000E+00'"), F(-0.)); - check.template operator()<"answer is '{:-E}'">(SV("answer is '-0.000000E+00'"), F(-0.)); - check.template operator()<"answer is '{:+E}'">(SV("answer is '-0.000000E+00'"), F(-0.)); - check.template operator()<"answer is '{: E}'">(SV("answer is '-0.000000E+00'"), F(-0.)); + check(SV("answer is '-0.000000E+00'"), SV("answer is '{:E}'"), F(-0.)); + check(SV("answer is '-0.000000E+00'"), SV("answer is '{:-E}'"), F(-0.)); + check(SV("answer is '-0.000000E+00'"), SV("answer is '{:+E}'"), F(-0.)); + check(SV("answer is '-0.000000E+00'"), SV("answer is '{: E}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:E}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-E}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+E}'">(SV("answer is '+INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: E}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:E}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-E}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+E}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: E}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:E}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:-E}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:+E}'">(SV("answer is '+NAN'"), nan_pos); - check.template operator()<"answer is '{: E}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:E}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:-E}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:+E}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{: E}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'INF'"), SV("answer is '{:E}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:-E}'"), std::numeric_limits::infinity()); + check(SV("answer is '+INF'"), SV("answer is '{:+E}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: E}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-INF'"), SV("answer is '{:E}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:-E}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:+E}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{: E}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'NAN'"), SV("answer is '{:E}'"), nan_pos); + check(SV("answer is 'NAN'"), SV("answer is '{:-E}'"), nan_pos); + check(SV("answer is '+NAN'"), SV("answer is '{:+E}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: E}'"), nan_pos); + + check(SV("answer is '-NAN'"), SV("answer is '{:E}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:-E}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:+E}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{: E}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0E}'">(SV("answer is '0E+00'"), F(0)); - check.template operator()<"answer is '{:#.0E}'">(SV("answer is '0.E+00'"), F(0)); + check(SV("answer is '0E+00'"), SV("answer is '{:.0E}'"), F(0)); + check(SV("answer is '0.E+00'"), SV("answer is '{:#.0E}'"), F(0)); - check.template operator()<"answer is '{:#E}'">(SV("answer is '0.000000E+00'"), F(0)); - check.template operator()<"answer is '{:#E}'">(SV("answer is '2.500000E+00'"), F(2.5)); + check(SV("answer is '0.000000E+00'"), SV("answer is '{:#E}'"), F(0)); + check(SV("answer is '2.500000E+00'"), SV("answer is '{:#E}'"), F(2.5)); - check.template operator()<"answer is '{:#E}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#E}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:#E}'"), std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:#E}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#E}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:#E}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'NAN'"), SV("answer is '{:#E}'"), nan_pos); + check(SV("answer is '-NAN'"), SV("answer is '{:#E}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:07E}'">(SV("answer is '3.125000E-02'"), 0.03125); - check.template operator()<"answer is '{:+07E}'">(SV("answer is '+3.125000E-02'"), 0.03125); - check.template operator()<"answer is '{:+08E}'">(SV("answer is '+3.125000E-02'"), 0.03125); - check.template operator()<"answer is '{:+09E}'">(SV("answer is '+3.125000E-02'"), 0.03125); - - check.template operator()<"answer is '{:014E}'">(SV("answer is '003.125000E-02'"), 0.03125); - check.template operator()<"answer is '{:-014E}'">(SV("answer is '003.125000E-02'"), 0.03125); - check.template operator()<"answer is '{:+014E}'">(SV("answer is '+03.125000E-02'"), 0.03125); - check.template operator()<"answer is '{: 014E}'">(SV("answer is ' 03.125000E-02'"), 0.03125); - - check.template operator()<"answer is '{:010E}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010E}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010E}'">(SV("answer is ' +INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010E}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010E}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010E}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010E}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010E}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010E}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:-010E}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:+010E}'">(SV("answer is ' +NAN'"), nan_pos); - check.template operator()<"answer is '{: 010E}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:010E}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:-010E}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:+010E}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{: 010E}'">(SV("answer is ' -NAN'"), nan_neg); + check(SV("answer is '3.125000E-02'"), SV("answer is '{:07E}'"), 0.03125); + check(SV("answer is '+3.125000E-02'"), SV("answer is '{:+07E}'"), 0.03125); + check(SV("answer is '+3.125000E-02'"), SV("answer is '{:+08E}'"), 0.03125); + check(SV("answer is '+3.125000E-02'"), SV("answer is '{:+09E}'"), 0.03125); + + check(SV("answer is '003.125000E-02'"), SV("answer is '{:014E}'"), 0.03125); + check(SV("answer is '003.125000E-02'"), SV("answer is '{:-014E}'"), 0.03125); + check(SV("answer is '+03.125000E-02'"), SV("answer is '{:+014E}'"), 0.03125); + check(SV("answer is ' 03.125000E-02'"), SV("answer is '{: 014E}'"), 0.03125); + + check(SV("answer is ' INF'"), SV("answer is '{:010E}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{:-010E}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +INF'"), SV("answer is '{:+010E}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: 010E}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -INF'"), SV("answer is '{:010E}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:-010E}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:+010E}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{: 010E}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' NAN'"), SV("answer is '{:010E}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{:-010E}'"), nan_pos); + check(SV("answer is ' +NAN'"), SV("answer is '{:+010E}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: 010E}'"), nan_pos); + + check(SV("answer is ' -NAN'"), SV("answer is '{:010E}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:-010E}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:+010E}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{: 010E}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0E}'">(SV("answer is '3E-02'"), 0.03125); - check.template operator()<"answer is '{:.1E}'">(SV("answer is '3.1E-02'"), 0.03125); - check.template operator()<"answer is '{:.3E}'">(SV("answer is '3.125E-02'"), 0.03125); - check.template operator()<"answer is '{:.10E}'">(SV("answer is '3.1250000000E-02'"), 0.03125); + check(SV("answer is '3E-02'"), SV("answer is '{:.0E}'"), 0.03125); + check(SV("answer is '3.1E-02'"), SV("answer is '{:.1E}'"), 0.03125); + check(SV("answer is '3.125E-02'"), SV("answer is '{:.3E}'"), 0.03125); + check(SV("answer is '3.1250000000E-02'"), SV("answer is '{:.10E}'"), 0.03125); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1724,118 +1715,118 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:11f}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:>11f}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:<11f}'">(SV("answer is '0.250000 '"), F(0.25)); - check.template operator()<"answer is '{:^11f}'">(SV("answer is ' 0.250000 '"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:11f}'"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:>11f}'"), F(0.25)); + check(SV("answer is '0.250000 '"), SV("answer is '{:<11f}'"), F(0.25)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^11f}'"), F(0.25)); - check.template operator()<"answer is '{:->11f}'">(SV("answer is '---0.125000'"), F(125e-3)); - check.template operator()<"answer is '{:-<11f}'">(SV("answer is '0.125000---'"), F(125e-3)); - check.template operator()<"answer is '{:-^11f}'">(SV("answer is '-0.125000--'"), F(125e-3)); + check(SV("answer is '---0.125000'"), SV("answer is '{:->11f}'"), F(125e-3)); + check(SV("answer is '0.125000---'"), SV("answer is '{:-<11f}'"), F(125e-3)); + check(SV("answer is '-0.125000--'"), SV("answer is '{:-^11f}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6f}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6f}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6f}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6f}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6f}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6f}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7f}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7f}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7f}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7f}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7f}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7f}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6f}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6f}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6f}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6f}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6f}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6f}'"), nan_pos); - check.template operator()<"answer is '{:0>7f}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7f}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7f}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7f}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7f}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7f}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>011f}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:<011f}'">(SV("answer is '0.250000 '"), F(0.25)); - check.template operator()<"answer is '{:^011f}'">(SV("answer is ' 0.250000 '"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:>011f}'"), F(0.25)); + check(SV("answer is '0.250000 '"), SV("answer is '{:<011f}'"), F(0.25)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^011f}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:f}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:-f}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:+f}'">(SV("answer is '+0.000000'"), F(0)); - check.template operator()<"answer is '{: f}'">(SV("answer is ' 0.000000'"), F(0)); + check(SV("answer is '0.000000'"), SV("answer is '{:f}'"), F(0)); + check(SV("answer is '0.000000'"), SV("answer is '{:-f}'"), F(0)); + check(SV("answer is '+0.000000'"), SV("answer is '{:+f}'"), F(0)); + check(SV("answer is ' 0.000000'"), SV("answer is '{: f}'"), F(0)); - check.template operator()<"answer is '{:f}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{:-f}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{:+f}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{: f}'">(SV("answer is '-0.000000'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:f}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:-f}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:+f}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{: f}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:f}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-f}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+f}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: f}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:f}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-f}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+f}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: f}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:f}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-f}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+f}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: f}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:f}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-f}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+f}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: f}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:f}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-f}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+f}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: f}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:f}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-f}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+f}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: f}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:f}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-f}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+f}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: f}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:f}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-f}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+f}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: f}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0f}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:#.0f}'">(SV("answer is '0.'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.0f}'"), F(0)); + check(SV("answer is '0.'"), SV("answer is '{:#.0f}'"), F(0)); - check.template operator()<"answer is '{:#f}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:#f}'">(SV("answer is '2.500000'"), F(2.5)); + check(SV("answer is '0.000000'"), SV("answer is '{:#f}'"), F(0)); + check(SV("answer is '2.500000'"), SV("answer is '{:#f}'"), F(2.5)); - check.template operator()<"answer is '{:#f}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#f}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#f}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#f}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#f}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#f}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#f}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#f}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:07f}'">(SV("answer is '0.031250'"), 0.03125); - check.template operator()<"answer is '{:+07f}'">(SV("answer is '+0.031250'"), 0.03125); - check.template operator()<"answer is '{:+08f}'">(SV("answer is '+0.031250'"), 0.03125); - check.template operator()<"answer is '{:+09f}'">(SV("answer is '+0.031250'"), 0.03125); - - check.template operator()<"answer is '{:010f}'">(SV("answer is '000.031250'"), 0.03125); - check.template operator()<"answer is '{:-010f}'">(SV("answer is '000.031250'"), 0.03125); - check.template operator()<"answer is '{:+010f}'">(SV("answer is '+00.031250'"), 0.03125); - check.template operator()<"answer is '{: 010f}'">(SV("answer is ' 00.031250'"), 0.03125); - - check.template operator()<"answer is '{:010f}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010f}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010f}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010f}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010f}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010f}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010f}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010f}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010f}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010f}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010f}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010f}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010f}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010f}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010f}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010f}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '0.031250'"), SV("answer is '{:07f}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+07f}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+08f}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+09f}'"), 0.03125); + + check(SV("answer is '000.031250'"), SV("answer is '{:010f}'"), 0.03125); + check(SV("answer is '000.031250'"), SV("answer is '{:-010f}'"), 0.03125); + check(SV("answer is '+00.031250'"), SV("answer is '{:+010f}'"), 0.03125); + check(SV("answer is ' 00.031250'"), SV("answer is '{: 010f}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010f}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010f}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010f}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010f}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010f}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010f}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010f}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010f}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010f}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010f}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010f}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010f}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010f}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010f}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010f}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010f}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0f}'">(SV("answer is '0'"), 0.03125); - check.template operator()<"answer is '{:.1f}'">(SV("answer is '0.0'"), 0.03125); - check.template operator()<"answer is '{:.5f}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.10f}'">(SV("answer is '0.0312500000'"), 0.03125); + check(SV("answer is '0'"), SV("answer is '{:.0f}'"), 0.03125); + check(SV("answer is '0.0'"), SV("answer is '{:.1f}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.5f}'"), 0.03125); + check(SV("answer is '0.0312500000'"), SV("answer is '{:.10f}'"), 0.03125); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1847,118 +1838,118 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:11F}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:>11F}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:<11F}'">(SV("answer is '0.250000 '"), F(0.25)); - check.template operator()<"answer is '{:^11F}'">(SV("answer is ' 0.250000 '"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:11F}'"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:>11F}'"), F(0.25)); + check(SV("answer is '0.250000 '"), SV("answer is '{:<11F}'"), F(0.25)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^11F}'"), F(0.25)); - check.template operator()<"answer is '{:->11F}'">(SV("answer is '---0.125000'"), F(125e-3)); - check.template operator()<"answer is '{:-<11F}'">(SV("answer is '0.125000---'"), F(125e-3)); - check.template operator()<"answer is '{:-^11F}'">(SV("answer is '-0.125000--'"), F(125e-3)); + check(SV("answer is '---0.125000'"), SV("answer is '{:->11F}'"), F(125e-3)); + check(SV("answer is '0.125000---'"), SV("answer is '{:-<11F}'"), F(125e-3)); + check(SV("answer is '-0.125000--'"), SV("answer is '{:-^11F}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6F}'">(SV("answer is '***INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6F}'">(SV("answer is 'INF***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6F}'">(SV("answer is '*INF**'"), std::numeric_limits::infinity()); + check(SV("answer is '***INF'"), SV("answer is '{:*>6F}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF***'"), SV("answer is '{:*<6F}'"), std::numeric_limits::infinity()); + check(SV("answer is '*INF**'"), SV("answer is '{:*^6F}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7F}'">(SV("answer is '###-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7F}'">(SV("answer is '-INF###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7F}'">(SV("answer is '#-INF##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-INF'"), SV("answer is '{:#>7F}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF###'"), SV("answer is '{:#<7F}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-INF##'"), SV("answer is '{:#^7F}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6F}'">(SV("answer is '^^^NAN'"), nan_pos); - check.template operator()<"answer is '{:^<6F}'">(SV("answer is 'NAN^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6F}'">(SV("answer is '^NAN^^'"), nan_pos); + check(SV("answer is '^^^NAN'"), SV("answer is '{:^>6F}'"), nan_pos); + check(SV("answer is 'NAN^^^'"), SV("answer is '{:^<6F}'"), nan_pos); + check(SV("answer is '^NAN^^'"), SV("answer is '{:^^6F}'"), nan_pos); - check.template operator()<"answer is '{:0>7F}'">(SV("answer is '000-NAN'"), nan_neg); - check.template operator()<"answer is '{:0<7F}'">(SV("answer is '-NAN000'"), nan_neg); - check.template operator()<"answer is '{:0^7F}'">(SV("answer is '0-NAN00'"), nan_neg); + check(SV("answer is '000-NAN'"), SV("answer is '{:0>7F}'"), nan_neg); + check(SV("answer is '-NAN000'"), SV("answer is '{:0<7F}'"), nan_neg); + check(SV("answer is '0-NAN00'"), SV("answer is '{:0^7F}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>011F}'">(SV("answer is ' 0.250000'"), F(0.25)); - check.template operator()<"answer is '{:<011F}'">(SV("answer is '0.250000 '"), F(0.25)); - check.template operator()<"answer is '{:^011F}'">(SV("answer is ' 0.250000 '"), F(0.25)); + check(SV("answer is ' 0.250000'"), SV("answer is '{:>011F}'"), F(0.25)); + check(SV("answer is '0.250000 '"), SV("answer is '{:<011F}'"), F(0.25)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^011F}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:F}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:-F}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:+F}'">(SV("answer is '+0.000000'"), F(0)); - check.template operator()<"answer is '{: F}'">(SV("answer is ' 0.000000'"), F(0)); + check(SV("answer is '0.000000'"), SV("answer is '{:F}'"), F(0)); + check(SV("answer is '0.000000'"), SV("answer is '{:-F}'"), F(0)); + check(SV("answer is '+0.000000'"), SV("answer is '{:+F}'"), F(0)); + check(SV("answer is ' 0.000000'"), SV("answer is '{: F}'"), F(0)); - check.template operator()<"answer is '{:F}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{:-F}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{:+F}'">(SV("answer is '-0.000000'"), F(-0.)); - check.template operator()<"answer is '{: F}'">(SV("answer is '-0.000000'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:F}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:-F}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{:+F}'"), F(-0.)); + check(SV("answer is '-0.000000'"), SV("answer is '{: F}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:F}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-F}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+F}'">(SV("answer is '+INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: F}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:F}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-F}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+F}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: F}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:F}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:-F}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:+F}'">(SV("answer is '+NAN'"), nan_pos); - check.template operator()<"answer is '{: F}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:F}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:-F}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:+F}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{: F}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'INF'"), SV("answer is '{:F}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:-F}'"), std::numeric_limits::infinity()); + check(SV("answer is '+INF'"), SV("answer is '{:+F}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: F}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-INF'"), SV("answer is '{:F}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:-F}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:+F}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{: F}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'NAN'"), SV("answer is '{:F}'"), nan_pos); + check(SV("answer is 'NAN'"), SV("answer is '{:-F}'"), nan_pos); + check(SV("answer is '+NAN'"), SV("answer is '{:+F}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: F}'"), nan_pos); + + check(SV("answer is '-NAN'"), SV("answer is '{:F}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:-F}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:+F}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{: F}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0F}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:#.0F}'">(SV("answer is '0.'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.0F}'"), F(0)); + check(SV("answer is '0.'"), SV("answer is '{:#.0F}'"), F(0)); - check.template operator()<"answer is '{:#F}'">(SV("answer is '0.000000'"), F(0)); - check.template operator()<"answer is '{:#F}'">(SV("answer is '2.500000'"), F(2.5)); + check(SV("answer is '0.000000'"), SV("answer is '{:#F}'"), F(0)); + check(SV("answer is '2.500000'"), SV("answer is '{:#F}'"), F(2.5)); - check.template operator()<"answer is '{:#F}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#F}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:#F}'"), std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:#F}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#F}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:#F}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'NAN'"), SV("answer is '{:#F}'"), nan_pos); + check(SV("answer is '-NAN'"), SV("answer is '{:#F}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:07F}'">(SV("answer is '0.031250'"), 0.03125); - check.template operator()<"answer is '{:+07F}'">(SV("answer is '+0.031250'"), 0.03125); - check.template operator()<"answer is '{:+08F}'">(SV("answer is '+0.031250'"), 0.03125); - check.template operator()<"answer is '{:+09F}'">(SV("answer is '+0.031250'"), 0.03125); - - check.template operator()<"answer is '{:010F}'">(SV("answer is '000.031250'"), 0.03125); - check.template operator()<"answer is '{:-010F}'">(SV("answer is '000.031250'"), 0.03125); - check.template operator()<"answer is '{:+010F}'">(SV("answer is '+00.031250'"), 0.03125); - check.template operator()<"answer is '{: 010F}'">(SV("answer is ' 00.031250'"), 0.03125); - - check.template operator()<"answer is '{:010F}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010F}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010F}'">(SV("answer is ' +INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010F}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010F}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010F}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010F}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010F}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010F}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:-010F}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:+010F}'">(SV("answer is ' +NAN'"), nan_pos); - check.template operator()<"answer is '{: 010F}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:010F}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:-010F}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:+010F}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{: 010F}'">(SV("answer is ' -NAN'"), nan_neg); + check(SV("answer is '0.031250'"), SV("answer is '{:07F}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+07F}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+08F}'"), 0.03125); + check(SV("answer is '+0.031250'"), SV("answer is '{:+09F}'"), 0.03125); + + check(SV("answer is '000.031250'"), SV("answer is '{:010F}'"), 0.03125); + check(SV("answer is '000.031250'"), SV("answer is '{:-010F}'"), 0.03125); + check(SV("answer is '+00.031250'"), SV("answer is '{:+010F}'"), 0.03125); + check(SV("answer is ' 00.031250'"), SV("answer is '{: 010F}'"), 0.03125); + + check(SV("answer is ' INF'"), SV("answer is '{:010F}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{:-010F}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +INF'"), SV("answer is '{:+010F}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: 010F}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -INF'"), SV("answer is '{:010F}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:-010F}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:+010F}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{: 010F}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' NAN'"), SV("answer is '{:010F}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{:-010F}'"), nan_pos); + check(SV("answer is ' +NAN'"), SV("answer is '{:+010F}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: 010F}'"), nan_pos); + + check(SV("answer is ' -NAN'"), SV("answer is '{:010F}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:-010F}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:+010F}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{: 010F}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0F}'">(SV("answer is '0'"), 0.03125); - check.template operator()<"answer is '{:.1F}'">(SV("answer is '0.0'"), 0.03125); - check.template operator()<"answer is '{:.5F}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.10F}'">(SV("answer is '0.0312500000'"), 0.03125); + check(SV("answer is '0'"), SV("answer is '{:.0F}'"), 0.03125); + check(SV("answer is '0.0'"), SV("answer is '{:.1F}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.5F}'"), 0.03125); + check(SV("answer is '0.0312500000'"), SV("answer is '{:.10F}'"), 0.03125); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1970,148 +1961,148 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:7g}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:>7g}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<7g}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^7g}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:7g}'"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>7g}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<7g}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^7g}'"), F(0.25)); - check.template operator()<"answer is '{:->8g}'">(SV("answer is '---0.125'"), F(125e-3)); - check.template operator()<"answer is '{:-<8g}'">(SV("answer is '0.125---'"), F(125e-3)); - check.template operator()<"answer is '{:-^8g}'">(SV("answer is '-0.125--'"), F(125e-3)); + check(SV("answer is '---0.125'"), SV("answer is '{:->8g}'"), F(125e-3)); + check(SV("answer is '0.125---'"), SV("answer is '{:-<8g}'"), F(125e-3)); + check(SV("answer is '-0.125--'"), SV("answer is '{:-^8g}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6g}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6g}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6g}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6g}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6g}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6g}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7g}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7g}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7g}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7g}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7g}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7g}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6g}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6g}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6g}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6g}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6g}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6g}'"), nan_pos); - check.template operator()<"answer is '{:0>7g}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7g}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7g}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7g}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7g}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7g}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07g}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<07g}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^07g}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>07g}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<07g}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07g}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:g}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:-g}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:+g}'">(SV("answer is '+0'"), F(0)); - check.template operator()<"answer is '{: g}'">(SV("answer is ' 0'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:g}'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:-g}'"), F(0)); + check(SV("answer is '+0'"), SV("answer is '{:+g}'"), F(0)); + check(SV("answer is ' 0'"), SV("answer is '{: g}'"), F(0)); - check.template operator()<"answer is '{:g}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:-g}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:+g}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{: g}'">(SV("answer is '-0'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:g}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:-g}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:+g}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{: g}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:g}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-g}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+g}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: g}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:g}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-g}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+g}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: g}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:g}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-g}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+g}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: g}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:g}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-g}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+g}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: g}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:g}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-g}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+g}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: g}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:g}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-g}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+g}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: g}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:g}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-g}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+g}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: g}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:g}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-g}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+g}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: g}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0g}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:#.0g}'">(SV("answer is '0.'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.0g}'"), F(0)); + check(SV("answer is '0.'"), SV("answer is '{:#.0g}'"), F(0)); - check.template operator()<"answer is '{:#g}'">(SV("answer is '0.00000'"), F(0)); - check.template operator()<"answer is '{:#g}'">(SV("answer is '2.50000'"), F(2.5)); + check(SV("answer is '0.00000'"), SV("answer is '{:#g}'"), F(0)); + check(SV("answer is '2.50000'"), SV("answer is '{:#g}'"), F(2.5)); - check.template operator()<"answer is '{:#g}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#g}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#g}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#g}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#g}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#g}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#g}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#g}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:06g}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:+06g}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+07g}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+08g}'">(SV("answer is '+0.03125'"), 0.03125); - - check.template operator()<"answer is '{:09g}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:-09g}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:+09g}'">(SV("answer is '+00.03125'"), 0.03125); - check.template operator()<"answer is '{: 09g}'">(SV("answer is ' 00.03125'"), 0.03125); - - check.template operator()<"answer is '{:010g}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010g}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010g}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010g}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010g}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010g}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010g}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010g}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010g}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010g}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010g}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010g}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010g}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010g}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010g}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010g}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '0.03125'"), SV("answer is '{:06g}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+06g}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+07g}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+08g}'"), 0.03125); + + check(SV("answer is '000.03125'"), SV("answer is '{:09g}'"), 0.03125); + check(SV("answer is '000.03125'"), SV("answer is '{:-09g}'"), 0.03125); + check(SV("answer is '+00.03125'"), SV("answer is '{:+09g}'"), 0.03125); + check(SV("answer is ' 00.03125'"), SV("answer is '{: 09g}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010g}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010g}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010g}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010g}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010g}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010g}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010g}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010g}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010g}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010g}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010g}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010g}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010g}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010g}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010g}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010g}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0g}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.1g}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.2g}'">(SV("answer is '0.031'"), 0.03125); - check.template operator()<"answer is '{:.3g}'">(SV("answer is '0.0312'"), 0.03125); - check.template operator()<"answer is '{:.4g}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.5g}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.10g}'">(SV("answer is '0.03125'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.0g}'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.1g}'"), 0.03125); + check(SV("answer is '0.031'"), SV("answer is '{:.2g}'"), 0.03125); + check(SV("answer is '0.0312'"), SV("answer is '{:.3g}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.4g}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.5g}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.10g}'"), 0.03125); // *** precision & alternate form *** // Output validated with printf("%#xg") - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.'"), 1.2, 0); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.'"), 1.2, 1); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.2'"), 1.2, 2); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.20'"), 1.2, 3); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.200'"), 1.2, 4); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.2000'"), 1.2, 5); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.20000'"), 1.2, 6); - - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.e+03'"), 1200.0, 0); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.e+03'"), 1200.0, 1); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.2e+03'"), 1200.0, 2); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.20e+03'"), 1200.0, 3); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1200.'"), 1200.0, 4); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1200.0'"), 1200.0, 5); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1200.00'"), 1200.0, 6); - - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.e+06'"), 1200000.0, 0); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.e+06'"), 1200000.0, 1); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.2e+06'"), 1200000.0, 2); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.20e+06'"), 1200000.0, 3); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.200e+06'"), 1200000.0, 4); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.2000e+06'"), 1200000.0, 5); - check.template operator()<"answer is '{:#.{}g}'">(SV("answer is '1.20000e+06'"), 1200000.0, 6); + check(SV("answer is '1.'"), SV("answer is '{:#.{}g}'"), 1.2, 0); + check(SV("answer is '1.'"), SV("answer is '{:#.{}g}'"), 1.2, 1); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}g}'"), 1.2, 2); + check(SV("answer is '1.20'"), SV("answer is '{:#.{}g}'"), 1.2, 3); + check(SV("answer is '1.200'"), SV("answer is '{:#.{}g}'"), 1.2, 4); + check(SV("answer is '1.2000'"), SV("answer is '{:#.{}g}'"), 1.2, 5); + check(SV("answer is '1.20000'"), SV("answer is '{:#.{}g}'"), 1.2, 6); + + check(SV("answer is '1.e+03'"), SV("answer is '{:#.{}g}'"), 1200.0, 0); + check(SV("answer is '1.e+03'"), SV("answer is '{:#.{}g}'"), 1200.0, 1); + check(SV("answer is '1.2e+03'"), SV("answer is '{:#.{}g}'"), 1200.0, 2); + check(SV("answer is '1.20e+03'"), SV("answer is '{:#.{}g}'"), 1200.0, 3); + check(SV("answer is '1200.'"), SV("answer is '{:#.{}g}'"), 1200.0, 4); + check(SV("answer is '1200.0'"), SV("answer is '{:#.{}g}'"), 1200.0, 5); + check(SV("answer is '1200.00'"), SV("answer is '{:#.{}g}'"), 1200.0, 6); + + check(SV("answer is '1.e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 0); + check(SV("answer is '1.e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 1); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 2); + check(SV("answer is '1.20e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 3); + check(SV("answer is '1.200e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 4); + check(SV("answer is '1.2000e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 5); + check(SV("answer is '1.20000e+06'"), SV("answer is '{:#.{}g}'"), 1200000.0, 6); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2123,148 +2114,148 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:7G}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:>7G}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<7G}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^7G}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:7G}'"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>7G}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<7G}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^7G}'"), F(0.25)); - check.template operator()<"answer is '{:->8G}'">(SV("answer is '---0.125'"), F(125e-3)); - check.template operator()<"answer is '{:-<8G}'">(SV("answer is '0.125---'"), F(125e-3)); - check.template operator()<"answer is '{:-^8G}'">(SV("answer is '-0.125--'"), F(125e-3)); + check(SV("answer is '---0.125'"), SV("answer is '{:->8G}'"), F(125e-3)); + check(SV("answer is '0.125---'"), SV("answer is '{:-<8G}'"), F(125e-3)); + check(SV("answer is '-0.125--'"), SV("answer is '{:-^8G}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6G}'">(SV("answer is '***INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6G}'">(SV("answer is 'INF***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6G}'">(SV("answer is '*INF**'"), std::numeric_limits::infinity()); + check(SV("answer is '***INF'"), SV("answer is '{:*>6G}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF***'"), SV("answer is '{:*<6G}'"), std::numeric_limits::infinity()); + check(SV("answer is '*INF**'"), SV("answer is '{:*^6G}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7G}'">(SV("answer is '###-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7G}'">(SV("answer is '-INF###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7G}'">(SV("answer is '#-INF##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-INF'"), SV("answer is '{:#>7G}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF###'"), SV("answer is '{:#<7G}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-INF##'"), SV("answer is '{:#^7G}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6G}'">(SV("answer is '^^^NAN'"), nan_pos); - check.template operator()<"answer is '{:^<6G}'">(SV("answer is 'NAN^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6G}'">(SV("answer is '^NAN^^'"), nan_pos); + check(SV("answer is '^^^NAN'"), SV("answer is '{:^>6G}'"), nan_pos); + check(SV("answer is 'NAN^^^'"), SV("answer is '{:^<6G}'"), nan_pos); + check(SV("answer is '^NAN^^'"), SV("answer is '{:^^6G}'"), nan_pos); - check.template operator()<"answer is '{:0>7G}'">(SV("answer is '000-NAN'"), nan_neg); - check.template operator()<"answer is '{:0<7G}'">(SV("answer is '-NAN000'"), nan_neg); - check.template operator()<"answer is '{:0^7G}'">(SV("answer is '0-NAN00'"), nan_neg); + check(SV("answer is '000-NAN'"), SV("answer is '{:0>7G}'"), nan_neg); + check(SV("answer is '-NAN000'"), SV("answer is '{:0<7G}'"), nan_neg); + check(SV("answer is '0-NAN00'"), SV("answer is '{:0^7G}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07G}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<07G}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^07G}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>07G}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<07G}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07G}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:G}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:-G}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:+G}'">(SV("answer is '+0'"), F(0)); - check.template operator()<"answer is '{: G}'">(SV("answer is ' 0'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:G}'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:-G}'"), F(0)); + check(SV("answer is '+0'"), SV("answer is '{:+G}'"), F(0)); + check(SV("answer is ' 0'"), SV("answer is '{: G}'"), F(0)); - check.template operator()<"answer is '{:G}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:-G}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:+G}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{: G}'">(SV("answer is '-0'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:G}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:-G}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:+G}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{: G}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:G}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-G}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+G}'">(SV("answer is '+INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: G}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:G}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-G}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+G}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: G}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:G}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:-G}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:+G}'">(SV("answer is '+NAN'"), nan_pos); - check.template operator()<"answer is '{: G}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:G}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:-G}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{:+G}'">(SV("answer is '-NAN'"), nan_neg); - check.template operator()<"answer is '{: G}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'INF'"), SV("answer is '{:G}'"), std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:-G}'"), std::numeric_limits::infinity()); + check(SV("answer is '+INF'"), SV("answer is '{:+G}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: G}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-INF'"), SV("answer is '{:G}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:-G}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:+G}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{: G}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'NAN'"), SV("answer is '{:G}'"), nan_pos); + check(SV("answer is 'NAN'"), SV("answer is '{:-G}'"), nan_pos); + check(SV("answer is '+NAN'"), SV("answer is '{:+G}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: G}'"), nan_pos); + + check(SV("answer is '-NAN'"), SV("answer is '{:G}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:-G}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{:+G}'"), nan_neg); + check(SV("answer is '-NAN'"), SV("answer is '{: G}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0G}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:#.0G}'">(SV("answer is '0.'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.0G}'"), F(0)); + check(SV("answer is '0.'"), SV("answer is '{:#.0G}'"), F(0)); - check.template operator()<"answer is '{:#G}'">(SV("answer is '0.00000'"), F(0)); - check.template operator()<"answer is '{:#G}'">(SV("answer is '2.50000'"), F(2.5)); + check(SV("answer is '0.00000'"), SV("answer is '{:#G}'"), F(0)); + check(SV("answer is '2.50000'"), SV("answer is '{:#G}'"), F(2.5)); - check.template operator()<"answer is '{:#G}'">(SV("answer is 'INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#G}'">(SV("answer is '-INF'"), -std::numeric_limits::infinity()); + check(SV("answer is 'INF'"), SV("answer is '{:#G}'"), std::numeric_limits::infinity()); + check(SV("answer is '-INF'"), SV("answer is '{:#G}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#G}'">(SV("answer is 'NAN'"), nan_pos); - check.template operator()<"answer is '{:#G}'">(SV("answer is '-NAN'"), nan_neg); + check(SV("answer is 'NAN'"), SV("answer is '{:#G}'"), nan_pos); + check(SV("answer is '-NAN'"), SV("answer is '{:#G}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:06G}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:+06G}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+07G}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+08G}'">(SV("answer is '+0.03125'"), 0.03125); - - check.template operator()<"answer is '{:09G}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:-09G}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:+09G}'">(SV("answer is '+00.03125'"), 0.03125); - check.template operator()<"answer is '{: 09G}'">(SV("answer is ' 00.03125'"), 0.03125); - - check.template operator()<"answer is '{:010G}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010G}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010G}'">(SV("answer is ' +INF'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010G}'">(SV("answer is ' INF'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010G}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010G}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010G}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010G}'">(SV("answer is ' -INF'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010G}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:-010G}'">(SV("answer is ' NAN'"), nan_pos); - check.template operator()<"answer is '{:+010G}'">(SV("answer is ' +NAN'"), nan_pos); - check.template operator()<"answer is '{: 010G}'">(SV("answer is ' NAN'"), nan_pos); - - check.template operator()<"answer is '{:010G}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:-010G}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{:+010G}'">(SV("answer is ' -NAN'"), nan_neg); - check.template operator()<"answer is '{: 010G}'">(SV("answer is ' -NAN'"), nan_neg); + check(SV("answer is '0.03125'"), SV("answer is '{:06G}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+06G}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+07G}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+08G}'"), 0.03125); + + check(SV("answer is '000.03125'"), SV("answer is '{:09G}'"), 0.03125); + check(SV("answer is '000.03125'"), SV("answer is '{:-09G}'"), 0.03125); + check(SV("answer is '+00.03125'"), SV("answer is '{:+09G}'"), 0.03125); + check(SV("answer is ' 00.03125'"), SV("answer is '{: 09G}'"), 0.03125); + + check(SV("answer is ' INF'"), SV("answer is '{:010G}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{:-010G}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +INF'"), SV("answer is '{:+010G}'"), std::numeric_limits::infinity()); + check(SV("answer is ' INF'"), SV("answer is '{: 010G}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -INF'"), SV("answer is '{:010G}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:-010G}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{:+010G}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -INF'"), SV("answer is '{: 010G}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' NAN'"), SV("answer is '{:010G}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{:-010G}'"), nan_pos); + check(SV("answer is ' +NAN'"), SV("answer is '{:+010G}'"), nan_pos); + check(SV("answer is ' NAN'"), SV("answer is '{: 010G}'"), nan_pos); + + check(SV("answer is ' -NAN'"), SV("answer is '{:010G}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:-010G}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{:+010G}'"), nan_neg); + check(SV("answer is ' -NAN'"), SV("answer is '{: 010G}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0G}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.1G}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.2G}'">(SV("answer is '0.031'"), 0.03125); - check.template operator()<"answer is '{:.3G}'">(SV("answer is '0.0312'"), 0.03125); - check.template operator()<"answer is '{:.4G}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.5G}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.10G}'">(SV("answer is '0.03125'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.0G}'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.1G}'"), 0.03125); + check(SV("answer is '0.031'"), SV("answer is '{:.2G}'"), 0.03125); + check(SV("answer is '0.0312'"), SV("answer is '{:.3G}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.4G}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.5G}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.10G}'"), 0.03125); // *** precision & alternate form *** // Output validated with printf("%#xg") - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.'"), 1.2, 0); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.'"), 1.2, 1); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.2'"), 1.2, 2); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.20'"), 1.2, 3); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.200'"), 1.2, 4); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.2000'"), 1.2, 5); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.20000'"), 1.2, 6); - - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.E+03'"), 1200.0, 0); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.E+03'"), 1200.0, 1); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.2E+03'"), 1200.0, 2); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.20E+03'"), 1200.0, 3); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1200.'"), 1200.0, 4); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1200.0'"), 1200.0, 5); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1200.00'"), 1200.0, 6); - - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.E+06'"), 1200000.0, 0); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.E+06'"), 1200000.0, 1); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.2E+06'"), 1200000.0, 2); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.20E+06'"), 1200000.0, 3); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.200E+06'"), 1200000.0, 4); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.2000E+06'"), 1200000.0, 5); - check.template operator()<"answer is '{:#.{}G}'">(SV("answer is '1.20000E+06'"), 1200000.0, 6); + check(SV("answer is '1.'"), SV("answer is '{:#.{}G}'"), 1.2, 0); + check(SV("answer is '1.'"), SV("answer is '{:#.{}G}'"), 1.2, 1); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}G}'"), 1.2, 2); + check(SV("answer is '1.20'"), SV("answer is '{:#.{}G}'"), 1.2, 3); + check(SV("answer is '1.200'"), SV("answer is '{:#.{}G}'"), 1.2, 4); + check(SV("answer is '1.2000'"), SV("answer is '{:#.{}G}'"), 1.2, 5); + check(SV("answer is '1.20000'"), SV("answer is '{:#.{}G}'"), 1.2, 6); + + check(SV("answer is '1.E+03'"), SV("answer is '{:#.{}G}'"), 1200.0, 0); + check(SV("answer is '1.E+03'"), SV("answer is '{:#.{}G}'"), 1200.0, 1); + check(SV("answer is '1.2E+03'"), SV("answer is '{:#.{}G}'"), 1200.0, 2); + check(SV("answer is '1.20E+03'"), SV("answer is '{:#.{}G}'"), 1200.0, 3); + check(SV("answer is '1200.'"), SV("answer is '{:#.{}G}'"), 1200.0, 4); + check(SV("answer is '1200.0'"), SV("answer is '{:#.{}G}'"), 1200.0, 5); + check(SV("answer is '1200.00'"), SV("answer is '{:#.{}G}'"), 1200.0, 6); + + check(SV("answer is '1.E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 0); + check(SV("answer is '1.E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 1); + check(SV("answer is '1.2E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 2); + check(SV("answer is '1.20E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 3); + check(SV("answer is '1.200E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 4); + check(SV("answer is '1.2000E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 5); + check(SV("answer is '1.20000E+06'"), SV("answer is '{:#.{}G}'"), 1200000.0, 6); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2276,108 +2267,108 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:7}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:>7}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<7}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^7}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:7}'"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>7}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<7}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^7}'"), F(0.25)); - check.template operator()<"answer is '{:->8}'">(SV("answer is '---0.125'"), F(125e-3)); - check.template operator()<"answer is '{:-<8}'">(SV("answer is '0.125---'"), F(125e-3)); - check.template operator()<"answer is '{:-^8}'">(SV("answer is '-0.125--'"), F(125e-3)); + check(SV("answer is '---0.125'"), SV("answer is '{:->8}'"), F(125e-3)); + check(SV("answer is '0.125---'"), SV("answer is '{:-<8}'"), F(125e-3)); + check(SV("answer is '-0.125--'"), SV("answer is '{:-^8}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6}'"), nan_pos); - check.template operator()<"answer is '{:0>7}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<07}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^07}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>07}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<07}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:-}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:+}'">(SV("answer is '+0'"), F(0)); - check.template operator()<"answer is '{: }'">(SV("answer is ' 0'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:}'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:-}'"), F(0)); + check(SV("answer is '+0'"), SV("answer is '{:+}'"), F(0)); + check(SV("answer is ' 0'"), SV("answer is '{: }'"), F(0)); - check.template operator()<"answer is '{:}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:-}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:+}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{: }'">(SV("answer is '-0'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:-}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:+}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{: }'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: }'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: }'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: }'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: }'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: }'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: }'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: }'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: }'"), nan_neg); // *** alternate form *** - check.template operator()<"answer is '{:#}'">(SV("answer is '0.'"), F(0)); - check.template operator()<"answer is '{:#}'">(SV("answer is '2.5'"), F(2.5)); + check(SV("answer is '0.'"), SV("answer is '{:#}'"), F(0)); + check(SV("answer is '2.5'"), SV("answer is '{:#}'"), F(2.5)); - check.template operator()<"answer is '{:#}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:07}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:+07}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+08}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+09}'">(SV("answer is '+00.03125'"), 0.03125); - - check.template operator()<"answer is '{:010}'">(SV("answer is '0000.03125'"), 0.03125); - check.template operator()<"answer is '{:-010}'">(SV("answer is '0000.03125'"), 0.03125); - check.template operator()<"answer is '{:+010}'">(SV("answer is '+000.03125'"), 0.03125); - check.template operator()<"answer is '{: 010}'">(SV("answer is ' 000.03125'"), 0.03125); - - check.template operator()<"answer is '{:010}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '0.03125'"), SV("answer is '{:07}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+07}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+08}'"), 0.03125); + check(SV("answer is '+00.03125'"), SV("answer is '{:+09}'"), 0.03125); + + check(SV("answer is '0000.03125'"), SV("answer is '{:010}'"), 0.03125); + check(SV("answer is '0000.03125'"), SV("answer is '{:-010}'"), 0.03125); + check(SV("answer is '+000.03125'"), SV("answer is '{:+010}'"), 0.03125); + check(SV("answer is ' 000.03125'"), SV("answer is '{: 010}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010}'"), nan_neg); // *** precision *** // See format_test_floating_point_default_precision @@ -2393,147 +2384,147 @@ auto nan_neg = std::copysign(nan_pos, static_cast(-1.0)); // "-nan" // *** align-fill & width *** - check.template operator()<"answer is '{:7.6}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:>7.6}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<7.6}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^7.6}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:7.6}'"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>7.6}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<7.6}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^7.6}'"), F(0.25)); - check.template operator()<"answer is '{:->8.6}'">(SV("answer is '---0.125'"), F(125e-3)); - check.template operator()<"answer is '{:-<8.6}'">(SV("answer is '0.125---'"), F(125e-3)); - check.template operator()<"answer is '{:-^8.6}'">(SV("answer is '-0.125--'"), F(125e-3)); + check(SV("answer is '---0.125'"), SV("answer is '{:->8.6}'"), F(125e-3)); + check(SV("answer is '0.125---'"), SV("answer is '{:-<8.6}'"), F(125e-3)); + check(SV("answer is '-0.125--'"), SV("answer is '{:-^8.6}'"), F(125e-3)); - check.template operator()<"answer is '{:*>6.6}'">(SV("answer is '***inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*<6.6}'">(SV("answer is 'inf***'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:*^6.6}'">(SV("answer is '*inf**'"), std::numeric_limits::infinity()); + check(SV("answer is '***inf'"), SV("answer is '{:*>6.6}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf***'"), SV("answer is '{:*<6.6}'"), std::numeric_limits::infinity()); + check(SV("answer is '*inf**'"), SV("answer is '{:*^6.6}'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#>7.6}'">(SV("answer is '###-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#<7.6}'">(SV("answer is '-inf###'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#^7.6}'">(SV("answer is '#-inf##'"), -std::numeric_limits::infinity()); + check(SV("answer is '###-inf'"), SV("answer is '{:#>7.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf###'"), SV("answer is '{:#<7.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is '#-inf##'"), SV("answer is '{:#^7.6}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:^>6.6}'">(SV("answer is '^^^nan'"), nan_pos); - check.template operator()<"answer is '{:^<6.6}'">(SV("answer is 'nan^^^'"), nan_pos); - check.template operator()<"answer is '{:^^6.6}'">(SV("answer is '^nan^^'"), nan_pos); + check(SV("answer is '^^^nan'"), SV("answer is '{:^>6.6}'"), nan_pos); + check(SV("answer is 'nan^^^'"), SV("answer is '{:^<6.6}'"), nan_pos); + check(SV("answer is '^nan^^'"), SV("answer is '{:^^6.6}'"), nan_pos); - check.template operator()<"answer is '{:0>7.6}'">(SV("answer is '000-nan'"), nan_neg); - check.template operator()<"answer is '{:0<7.6}'">(SV("answer is '-nan000'"), nan_neg); - check.template operator()<"answer is '{:0^7.6}'">(SV("answer is '0-nan00'"), nan_neg); + check(SV("answer is '000-nan'"), SV("answer is '{:0>7.6}'"), nan_neg); + check(SV("answer is '-nan000'"), SV("answer is '{:0<7.6}'"), nan_neg); + check(SV("answer is '0-nan00'"), SV("answer is '{:0^7.6}'"), nan_neg); // Test whether zero padding is ignored - check.template operator()<"answer is '{:>07.6}'">(SV("answer is ' 0.25'"), F(0.25)); - check.template operator()<"answer is '{:<07.6}'">(SV("answer is '0.25 '"), F(0.25)); - check.template operator()<"answer is '{:^07.6}'">(SV("answer is ' 0.25 '"), F(0.25)); + check(SV("answer is ' 0.25'"), SV("answer is '{:>07.6}'"), F(0.25)); + check(SV("answer is '0.25 '"), SV("answer is '{:<07.6}'"), F(0.25)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07.6}'"), F(0.25)); // *** Sign *** - check.template operator()<"answer is '{:.6}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:-.6}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '+0'"), F(0)); - check.template operator()<"answer is '{: .6}'">(SV("answer is ' 0'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.6}'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:-.6}'"), F(0)); + check(SV("answer is '+0'"), SV("answer is '{:+.6}'"), F(0)); + check(SV("answer is ' 0'"), SV("answer is '{: .6}'"), F(0)); - check.template operator()<"answer is '{:.6}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:-.6}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '-0'"), F(-0.)); - check.template operator()<"answer is '{: .6}'">(SV("answer is '-0'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:.6}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:-.6}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{:+.6}'"), F(-0.)); + check(SV("answer is '-0'"), SV("answer is '{: .6}'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check.template operator()<"answer is '{:.6}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '+inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-.6}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: .6}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:.6}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:-.6}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '+nan'"), nan_pos); - check.template operator()<"answer is '{: .6}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:.6}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:-.6}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{:+.6}'">(SV("answer is '-nan'"), nan_neg); - check.template operator()<"answer is '{: .6}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'inf'"), SV("answer is '{:.6}'"), std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:-.6}'"), std::numeric_limits::infinity()); + check(SV("answer is '+inf'"), SV("answer is '{:+.6}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: .6}'"), std::numeric_limits::infinity()); + + check(SV("answer is '-inf'"), SV("answer is '{:.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:-.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:+.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{: .6}'"), -std::numeric_limits::infinity()); + + check(SV("answer is 'nan'"), SV("answer is '{:.6}'"), nan_pos); + check(SV("answer is 'nan'"), SV("answer is '{:-.6}'"), nan_pos); + check(SV("answer is '+nan'"), SV("answer is '{:+.6}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: .6}'"), nan_pos); + + check(SV("answer is '-nan'"), SV("answer is '{:.6}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:-.6}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{:+.6}'"), nan_neg); + check(SV("answer is '-nan'"), SV("answer is '{: .6}'"), nan_neg); // *** alternate form ** // When precision is zero there's no decimal point except when the alternate form is specified. - check.template operator()<"answer is '{:.0}'">(SV("answer is '0'"), F(0)); - check.template operator()<"answer is '{:#.0}'">(SV("answer is '0.'"), F(0)); + check(SV("answer is '0'"), SV("answer is '{:.0}'"), F(0)); + check(SV("answer is '0.'"), SV("answer is '{:#.0}'"), F(0)); - check.template operator()<"answer is '{:#.6}'">(SV("answer is '0.'"), F(0)); - check.template operator()<"answer is '{:#.6}'">(SV("answer is '2.5'"), F(2.5)); + check(SV("answer is '0.'"), SV("answer is '{:#.6}'"), F(0)); + check(SV("answer is '2.5'"), SV("answer is '{:#.6}'"), F(2.5)); - check.template operator()<"answer is '{:#.6}'">(SV("answer is 'inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6}'">(SV("answer is '-inf'"), -std::numeric_limits::infinity()); + check(SV("answer is 'inf'"), SV("answer is '{:#.6}'"), std::numeric_limits::infinity()); + check(SV("answer is '-inf'"), SV("answer is '{:#.6}'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:#.6}'">(SV("answer is 'nan'"), nan_pos); - check.template operator()<"answer is '{:#.6}'">(SV("answer is '-nan'"), nan_neg); + check(SV("answer is 'nan'"), SV("answer is '{:#.6}'"), nan_pos); + check(SV("answer is '-nan'"), SV("answer is '{:#.6}'"), nan_neg); // *** zero-padding & width *** - check.template operator()<"answer is '{:06.6}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:+06.6}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+07.6}'">(SV("answer is '+0.03125'"), 0.03125); - check.template operator()<"answer is '{:+08.6}'">(SV("answer is '+0.03125'"), 0.03125); - - check.template operator()<"answer is '{:09.6}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:-09.6}'">(SV("answer is '000.03125'"), 0.03125); - check.template operator()<"answer is '{:+09.6}'">(SV("answer is '+00.03125'"), 0.03125); - check.template operator()<"answer is '{: 09.6}'">(SV("answer is ' 00.03125'"), 0.03125); - - check.template operator()<"answer is '{:010.6}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6}'">(SV("answer is ' +inf'"), std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6}'">(SV("answer is ' inf'"), std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:-010.6}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{:+010.6}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - check.template operator()<"answer is '{: 010.6}'">(SV("answer is ' -inf'"), -std::numeric_limits::infinity()); - - check.template operator()<"answer is '{:010.6}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:-010.6}'">(SV("answer is ' nan'"), nan_pos); - check.template operator()<"answer is '{:+010.6}'">(SV("answer is ' +nan'"), nan_pos); - check.template operator()<"answer is '{: 010.6}'">(SV("answer is ' nan'"), nan_pos); - - check.template operator()<"answer is '{:010.6}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:-010.6}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{:+010.6}'">(SV("answer is ' -nan'"), nan_neg); - check.template operator()<"answer is '{: 010.6}'">(SV("answer is ' -nan'"), nan_neg); + check(SV("answer is '0.03125'"), SV("answer is '{:06.6}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+06.6}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+07.6}'"), 0.03125); + check(SV("answer is '+0.03125'"), SV("answer is '{:+08.6}'"), 0.03125); + + check(SV("answer is '000.03125'"), SV("answer is '{:09.6}'"), 0.03125); + check(SV("answer is '000.03125'"), SV("answer is '{:-09.6}'"), 0.03125); + check(SV("answer is '+00.03125'"), SV("answer is '{:+09.6}'"), 0.03125); + check(SV("answer is ' 00.03125'"), SV("answer is '{: 09.6}'"), 0.03125); + + check(SV("answer is ' inf'"), SV("answer is '{:010.6}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{:-010.6}'"), std::numeric_limits::infinity()); + check(SV("answer is ' +inf'"), SV("answer is '{:+010.6}'"), std::numeric_limits::infinity()); + check(SV("answer is ' inf'"), SV("answer is '{: 010.6}'"), std::numeric_limits::infinity()); + + check(SV("answer is ' -inf'"), SV("answer is '{:010.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:-010.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{:+010.6}'"), -std::numeric_limits::infinity()); + check(SV("answer is ' -inf'"), SV("answer is '{: 010.6}'"), -std::numeric_limits::infinity()); + + check(SV("answer is ' nan'"), SV("answer is '{:010.6}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{:-010.6}'"), nan_pos); + check(SV("answer is ' +nan'"), SV("answer is '{:+010.6}'"), nan_pos); + check(SV("answer is ' nan'"), SV("answer is '{: 010.6}'"), nan_pos); + + check(SV("answer is ' -nan'"), SV("answer is '{:010.6}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:-010.6}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{:+010.6}'"), nan_neg); + check(SV("answer is ' -nan'"), SV("answer is '{: 010.6}'"), nan_neg); // *** precision *** - check.template operator()<"answer is '{:.0}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.1}'">(SV("answer is '0.03'"), 0.03125); - check.template operator()<"answer is '{:.2}'">(SV("answer is '0.031'"), 0.03125); - check.template operator()<"answer is '{:.3}'">(SV("answer is '0.0312'"), 0.03125); - check.template operator()<"answer is '{:.4}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.5}'">(SV("answer is '0.03125'"), 0.03125); - check.template operator()<"answer is '{:.10}'">(SV("answer is '0.03125'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.0}'"), 0.03125); + check(SV("answer is '0.03'"), SV("answer is '{:.1}'"), 0.03125); + check(SV("answer is '0.031'"), SV("answer is '{:.2}'"), 0.03125); + check(SV("answer is '0.0312'"), SV("answer is '{:.3}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.4}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.5}'"), 0.03125); + check(SV("answer is '0.03125'"), SV("answer is '{:.10}'"), 0.03125); // *** precision & alternate form *** - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.'"), 1.2, 0); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.'"), 1.2, 1); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2'"), 1.2, 2); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2'"), 1.2, 3); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2'"), 1.2, 4); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2'"), 1.2, 5); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2'"), 1.2, 6); - - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.e+03'"), 1200.0, 0); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.e+03'"), 1200.0, 1); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+03'"), 1200.0, 2); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+03'"), 1200.0, 3); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1200.'"), 1200.0, 4); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1200.'"), 1200.0, 5); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1200.'"), 1200.0, 6); - - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.e+06'"), 1200000.0, 0); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.e+06'"), 1200000.0, 1); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+06'"), 1200000.0, 2); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+06'"), 1200000.0, 3); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+06'"), 1200000.0, 4); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+06'"), 1200000.0, 5); - check.template operator()<"answer is '{:#.{}}'">(SV("answer is '1.2e+06'"), 1200000.0, 6); + check(SV("answer is '1.'"), SV("answer is '{:#.{}}'"), 1.2, 0); + check(SV("answer is '1.'"), SV("answer is '{:#.{}}'"), 1.2, 1); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}}'"), 1.2, 2); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}}'"), 1.2, 3); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}}'"), 1.2, 4); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}}'"), 1.2, 5); + check(SV("answer is '1.2'"), SV("answer is '{:#.{}}'"), 1.2, 6); + + check(SV("answer is '1.e+03'"), SV("answer is '{:#.{}}'"), 1200.0, 0); + check(SV("answer is '1.e+03'"), SV("answer is '{:#.{}}'"), 1200.0, 1); + check(SV("answer is '1.2e+03'"), SV("answer is '{:#.{}}'"), 1200.0, 2); + check(SV("answer is '1.2e+03'"), SV("answer is '{:#.{}}'"), 1200.0, 3); + check(SV("answer is '1200.'"), SV("answer is '{:#.{}}'"), 1200.0, 4); + check(SV("answer is '1200.'"), SV("answer is '{:#.{}}'"), 1200.0, 5); + check(SV("answer is '1200.'"), SV("answer is '{:#.{}}'"), 1200.0, 6); + + check(SV("answer is '1.e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 0); + check(SV("answer is '1.e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 1); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 2); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 3); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 4); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 5); + check(SV("answer is '1.2e+06'"), SV("answer is '{:#.{}}'"), 1200000.0, 6); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2573,14 +2564,14 @@ template void format_test_pointer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check.template operator()<"answer is '{:6}'">(SV("answer is ' 0x0'"), P(nullptr)); - check.template operator()<"answer is '{:>6}'">(SV("answer is ' 0x0'"), P(nullptr)); - check.template operator()<"answer is '{:<6}'">(SV("answer is '0x0 '"), P(nullptr)); - check.template operator()<"answer is '{:^6}'">(SV("answer is ' 0x0 '"), P(nullptr)); + check(SV("answer is ' 0x0'"), SV("answer is '{:6}'"), P(nullptr)); + check(SV("answer is ' 0x0'"), SV("answer is '{:>6}'"), P(nullptr)); + check(SV("answer is '0x0 '"), SV("answer is '{:<6}'"), P(nullptr)); + check(SV("answer is ' 0x0 '"), SV("answer is '{:^6}'"), P(nullptr)); - check.template operator()<"answer is '{:->6}'">(SV("answer is '---0x0'"), P(nullptr)); - check.template operator()<"answer is '{:-<6}'">(SV("answer is '0x0---'"), P(nullptr)); - check.template operator()<"answer is '{:-^6}'">(SV("answer is '-0x0--'"), P(nullptr)); + check(SV("answer is '---0x0'"), SV("answer is '{:->6}'"), P(nullptr)); + check(SV("answer is '0x0---'"), SV("answer is '{:-<6}'"), P(nullptr)); + check(SV("answer is '-0x0--'"), SV("answer is '{:-^6}'"), P(nullptr)); // *** Sign *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), P(nullptr)); @@ -2607,20 +2598,20 @@ template void format_test_handle(TestFunction check, ExceptionTest check_exception) { // *** Valid permuatations *** - check.template operator()<"answer is '{}'">(SV("answer is '0xaaaa'"), status::foo); - check.template operator()<"answer is '{:x}'">(SV("answer is '0xaaaa'"), status::foo); - check.template operator()<"answer is '{:X}'">(SV("answer is '0XAAAA'"), status::foo); - check.template operator()<"answer is '{:s}'">(SV("answer is 'foo'"), status::foo); + check(SV("answer is '0xaaaa'"), SV("answer is '{}'"), status::foo); + check(SV("answer is '0xaaaa'"), SV("answer is '{:x}'"), status::foo); + check(SV("answer is '0XAAAA'"), SV("answer is '{:X}'"), status::foo); + check(SV("answer is 'foo'"), SV("answer is '{:s}'"), status::foo); - check.template operator()<"answer is '{}'">(SV("answer is '0x5555'"), status::bar); - check.template operator()<"answer is '{:x}'">(SV("answer is '0x5555'"), status::bar); - check.template operator()<"answer is '{:X}'">(SV("answer is '0X5555'"), status::bar); - check.template operator()<"answer is '{:s}'">(SV("answer is 'bar'"), status::bar); + check(SV("answer is '0x5555'"), SV("answer is '{}'"), status::bar); + check(SV("answer is '0x5555'"), SV("answer is '{:x}'"), status::bar); + check(SV("answer is '0X5555'"), SV("answer is '{:X}'"), status::bar); + check(SV("answer is 'bar'"), SV("answer is '{:s}'"), status::bar); - check.template operator()<"answer is '{}'">(SV("answer is '0xaa55'"), status::foobar); - check.template operator()<"answer is '{:x}'">(SV("answer is '0xaa55'"), status::foobar); - check.template operator()<"answer is '{:X}'">(SV("answer is '0XAA55'"), status::foobar); - check.template operator()<"answer is '{:s}'">(SV("answer is 'foobar'"), status::foobar); + check(SV("answer is '0xaa55'"), SV("answer is '{}'"), status::foobar); + check(SV("answer is '0xaa55'"), SV("answer is '{:x}'"), status::foobar); + check(SV("answer is '0XAA55'"), SV("answer is '{:X}'"), status::foobar); + check(SV("answer is 'foobar'"), SV("answer is '{:s}'"), status::foobar); // P2418 Changed the argument from a const reference to a forwarding reference. // This mainly affects handle classes, however since we use an abstraction @@ -2691,26 +2682,25 @@ "The quick brown fox jumps over the lazy dog." "The quick brown fox jumps over the lazy dog."); assert(str.size() > minimum); - check.template operator()<"{}">(std::basic_string_view{str}, str); + check(std::basic_string_view{str}, SV("{}"), str); // Fill std::basic_string fill(minimum, CharT('*')); - check.template operator()<"{:*<{}}">(std::basic_string_view{str + fill}, str, str.size() + minimum); - check.template operator()<"{:*^{}}">( - std::basic_string_view{fill + str + fill}, str, minimum + str.size() + minimum); - check.template operator()<"{:*>{}}">(std::basic_string_view{fill + str}, str, minimum + str.size()); + check(std::basic_string_view{str + fill}, SV("{:*<{}}"), str, str.size() + minimum); + check(std::basic_string_view{fill + str + fill}, SV("{:*^{}}"), str, minimum + str.size() + minimum); + check(std::basic_string_view{fill + str}, SV("{:*>{}}"), str, minimum + str.size()); } template void format_tests(TestFunction check, ExceptionTest check_exception) { // *** Test escaping *** - check.template operator()<"{{">(SV("{")); - check.template operator()<"}}">(SV("}")); + check(SV("{"), SV("{{")); + check(SV("}"), SV("}}")); // *** Test argument ID *** - check.template operator()<"hello {0:} {1:}">(SV("hello false true"), false, true); - check.template operator()<"hello {1:} {0:}">(SV("hello true false"), false, true); + check(SV("hello false true"), SV("hello {0:} {1:}"), false, true); + check(SV("hello true false"), SV("hello {1:} {0:}"), false, true); // *** Test many arguments *** @@ -2727,8 +2717,29 @@ // fmtlib and libc++ use a similar approach, this approach can support 16 // elements (based on design choices both support less elements). This test // makes sure "the large number of formatting arguments" code path is tested. - check.template operator()<"{}{}{}{}{}{}{}{}{}{}\t{}{}{}{}{}{}{}{}{}{}">(SV("1234567890\t1234567890"), 1, 2, 3, 4, 5, - 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0); + check( + SV("1234567890\t1234567890"), + SV("{}{}{}{}{}{}{}{}{}{}\t{}{}{}{}{}{}{}{}{}{}"), + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0); // ** Test invalid format strings *** check_exception("The format string terminates at a '{'", SV("{")); @@ -2746,8 +2757,15 @@ // *** Test char format argument *** // The `char` to `wchar_t` formatting is tested separately. - check.template operator()<"hello {}{}{}{}{}{}{}">( - SV("hello 09azAZ!"), CharT('0'), CharT('9'), CharT('a'), CharT('z'), CharT('A'), CharT('Z'), CharT('!')); + check(SV("hello 09azAZ!"), + SV("hello {}{}{}{}{}{}{}"), + CharT('0'), + CharT('9'), + CharT('a'), + CharT('z'), + CharT('A'), + CharT('Z'), + CharT('!')); format_test_char(check, check_exception); format_test_char_as_integer(check, check_exception); @@ -2755,62 +2773,62 @@ { CharT buffer[] = {CharT('0'), CharT('9'), CharT('a'), CharT('z'), CharT('A'), CharT('Z'), CharT('!'), 0}; CharT* data = buffer; - check.template operator()<"hello {}">(SV("hello 09azAZ!"), data); + check(SV("hello 09azAZ!"), SV("hello {}"), data); } { CharT buffer[] = {CharT('0'), CharT('9'), CharT('a'), CharT('z'), CharT('A'), CharT('Z'), CharT('!'), 0}; const CharT* data = buffer; - check.template operator()<"hello {}">(SV("hello 09azAZ!"), data); + check(SV("hello 09azAZ!"), SV("hello {}"), data); } { std::basic_string data = STR("world"); - check.template operator()<"hello {}">(SV("hello world"), data); + check(SV("hello world"), SV("hello {}"), data); } { std::basic_string buffer = STR("world"); std::basic_string_view data = buffer; - check.template operator()<"hello {}">(SV("hello world"), data); + check(SV("hello world"), SV("hello {}"), data); } format_string_tests(check, check_exception); // *** Test Boolean format argument *** - check.template operator()<"hello {} {}">(SV("hello false true"), false, true); + check(SV("hello false true"), SV("hello {} {}"), false, true); format_test_bool(check, check_exception); format_test_bool_as_integer(check, check_exception); // *** Test signed integral format argument *** - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); #ifndef TEST_HAS_NO_INT128 - check.template operator()<"hello {}">(SV("hello 42"), static_cast<__int128_t>(42)); + check(SV("hello 42"), SV("hello {}"), static_cast<__int128_t>(42)); #endif format_test_signed_integer(check, check_exception); // ** Test unsigned integral format argument *** - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); #ifndef TEST_HAS_NO_INT128 - check.template operator()<"hello {}">(SV("hello 42"), static_cast<__uint128_t>(42)); + check(SV("hello 42"), SV("hello {}"), static_cast<__uint128_t>(42)); #endif format_test_unsigned_integer(check, check_exception); // *** Test floating point format argument *** - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); - check.template operator()<"hello {}">(SV("hello 42"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); format_test_floating_point(check, check_exception); // *** Test pointer formater argument *** - check.template operator()<"hello {}">(SV("hello 0x0"), nullptr); - check.template operator()<"hello {}">(SV("hello 0x42"), reinterpret_cast(0x42)); - check.template operator()<"hello {}">(SV("hello 0x42"), reinterpret_cast(0x42)); + check(SV("hello 0x0"), SV("hello {}"), nullptr); + check(SV("hello 0x42"), SV("hello {}"), reinterpret_cast(0x42)); + check(SV("hello 0x42"), SV("hello {}"), reinterpret_cast(0x42)); format_test_pointer(check, check_exception); // *** Test handle formatter argument *** @@ -2824,7 +2842,7 @@ template void format_tests_char_to_wchar_t(TestFunction check) { using CharT = wchar_t; - check.template operator()<"hello {}{}{}{}{}">(SV("hello 09azA"), '0', '9', 'a', 'z', 'A'); + check(SV("hello 09azA"), SV("hello {}{}{}{}{}"), '0', '9', 'a', 'z', 'A'); } #endif diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp @@ -31,36 +31,38 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - { - std::basic_string out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), std::locale(), fmt.template sv(), args...); - assert(it == out.end()); - assert(out == expected); - } - { - std::list out; - std::format_to(std::back_inserter(out), std::locale(), fmt.template sv(), args...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - std::vector out; - std::format_to(std::back_inserter(out), std::locale(), fmt.template sv(), args...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - assert(expected.size() < 4096 && "Update the size of the buffer."); - CharT out[4096]; - CharT* it = std::format_to(out, std::locale(), fmt.template sv(), args...); - assert(std::distance(out, it) == int(expected.size())); - // Convert to std::string since output contains '\0' for boolean tests. - assert(std::basic_string(out, it) == expected); - } -}; +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + { + std::basic_string out(expected.size(), CharT(' ')); + auto it = std::format_to(out.begin(), std::locale(), fmt, std::forward(args)...); + assert(it == out.end()); + assert(out == expected); + } + { + std::list out; + std::format_to(std::back_inserter(out), std::locale(), fmt, std::forward(args)...); + assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); + } + { + std::vector out; + std::format_to(std::back_inserter(out), std::locale(), fmt, std::forward(args)...); + assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); + } + { + assert(expected.size() < 4096 && "Update the size of the buffer."); + CharT out[4096]; + CharT* it = std::format_to(out, std::locale(), fmt, std::forward(args)...); + assert(std::distance(out, it) == int(expected.size())); + // Convert to std::string since output contains '\0' for boolean tests. + assert(std::basic_string(out, it) == expected); + } + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format_to become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format_to.locale.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp @@ -28,36 +28,38 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - { - std::basic_string out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), fmt.template sv(), args...); - assert(it == out.end()); - assert(out == expected); - } - { - std::list out; - std::format_to(std::back_inserter(out), fmt.template sv(), args...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - std::vector out; - std::format_to(std::back_inserter(out), fmt.template sv(), args...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - assert(expected.size() < 4096 && "Update the size of the buffer."); - CharT out[4096]; - CharT* it = std::format_to(out, fmt.template sv(), args...); - assert(std::distance(out, it) == int(expected.size())); - // Convert to std::string since output contains '\0' for boolean tests. - assert(std::basic_string(out, it) == expected); - } -}; +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + { + std::basic_string out(expected.size(), CharT(' ')); + auto it = std::format_to(out.begin(), fmt, std::forward(args)...); + assert(it == out.end()); + assert(out == expected); + } + { + std::list out; + std::format_to(std::back_inserter(out), fmt, std::forward(args)...); + assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); + } + { + std::vector out; + std::format_to(std::back_inserter(out), fmt, std::forward(args)...); + assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); + } + { + assert(expected.size() < 4096 && "Update the size of the buffer."); + CharT out[4096]; + CharT* it = std::format_to(out, fmt, std::forward(args)...); + assert(std::distance(out, it) == int(expected.size())); + // Convert to std::string since output contains '\0' for boolean tests. + assert(std::basic_string(out, it) == expected); + } + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp @@ -33,72 +33,74 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - { - std::list out; - std::format_to_n_result result = - std::format_to_n(std::back_inserter(out), 0, std::locale(), fmt.template sv(), args...); - // To avoid signedness warnings make sure formatted_size uses the same type - // as result.size. - using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(std::locale(), fmt.template sv(), args...); +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + { + std::list out; + std::format_to_n_result result = + std::format_to_n(std::back_inserter(out), 0, std::locale(), fmt, std::forward(args)...); + // To avoid signedness warnings make sure formatted_size uses the same type + // as result.size. + using diff_type = decltype(result.size); + diff_type formatted_size = std::formatted_size(std::locale(), fmt, std::forward(args)...); - assert(result.size == formatted_size); - assert(out.empty()); - } - { - std::vector out; - std::format_to_n_result result = - std::format_to_n(std::back_inserter(out), 5, std::locale(), fmt.template sv(), args...); - using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(std::locale(), fmt.template sv(), args...); - diff_type size = std::min(5, formatted_size); + assert(result.size == formatted_size); + assert(out.empty()); + } + { + std::vector out; + std::format_to_n_result result = + std::format_to_n(std::back_inserter(out), 5, std::locale(), fmt, std::forward(args)...); + using diff_type = decltype(result.size); + diff_type formatted_size = std::formatted_size(std::locale(), fmt, std::forward(args)...); + diff_type size = std::min(5, formatted_size); - assert(result.size == formatted_size); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.begin() + size)); - } - { - std::basic_string out; - std::format_to_n_result result = - std::format_to_n(std::back_inserter(out), 1000, std::locale(), fmt.template sv(), args...); - using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(std::locale(), fmt.template sv(), args...); - diff_type size = std::min(1000, formatted_size); + assert(result.size == formatted_size); + assert(std::equal(out.begin(), out.end(), expected.begin(), expected.begin() + size)); + } + { + std::basic_string out; + std::format_to_n_result result = + std::format_to_n(std::back_inserter(out), 1000, std::locale(), fmt, std::forward(args)...); + using diff_type = decltype(result.size); + diff_type formatted_size = std::formatted_size(std::locale(), fmt, std::forward(args)...); + diff_type size = std::min(1000, formatted_size); - assert(result.size == formatted_size); - assert(out == expected.substr(0, size)); - } - { - // Test the returned iterator. - std::basic_string out(10, CharT(' ')); - std::format_to_n_result result = - std::format_to_n(out.begin(), 10, std::locale(), fmt.template sv(), args...); - using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(std::locale(), fmt.template sv(), args...); - diff_type size = std::min(10, formatted_size); + assert(result.size == formatted_size); + assert(out == expected.substr(0, size)); + } + { + // Test the returned iterator. + std::basic_string out(10, CharT(' ')); + std::format_to_n_result result = + std::format_to_n(out.begin(), 10, std::locale(), fmt, std::forward(args)...); + using diff_type = decltype(result.size); + diff_type formatted_size = std::formatted_size(std::locale(), fmt, std::forward(args)...); + diff_type size = std::min(10, formatted_size); - assert(result.size == formatted_size); - assert(result.out == out.begin() + size); - assert(out.substr(0, size) == expected.substr(0, size)); - } - { - static_assert(std::is_signed_v>, - "If the difference type isn't negative the test will fail " - "due to using a large positive value."); - CharT buffer[1] = {CharT(0)}; - std::format_to_n_result result = std::format_to_n(buffer, -1, std::locale(), fmt.template sv(), args...); - using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(std::locale(), fmt.template sv(), args...); + assert(result.size == formatted_size); + assert(result.out == out.begin() + size); + assert(out.substr(0, size) == expected.substr(0, size)); + } + { + static_assert(std::is_signed_v>, + "If the difference type isn't negative the test will fail " + "due to using a large positive value."); + CharT buffer[1] = {CharT(0)}; + std::format_to_n_result result = std::format_to_n(buffer, -1, std::locale(), fmt, std::forward(args)...); + using diff_type = decltype(result.size); + diff_type formatted_size = std::formatted_size(std::locale(), fmt, std::forward(args)...); - assert(result.size == formatted_size); - assert(result.out == buffer); - assert(buffer[0] == CharT(0)); - } -}; + assert(result.size == formatted_size); + assert(result.out == buffer); + assert(buffer[0] == CharT(0)); + } + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format_to_n become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format_to_n.locale.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp @@ -30,25 +30,28 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { +auto test = []( + std::basic_string_view expected, + test_format_string fmt, + Args&&... args) constexpr { { std::list out; - std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 0, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 0, fmt, std::forward(args)...); // To avoid signedness warnings make sure formatted_size uses the same type // as result.size. using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); assert(result.size == formatted_size); assert(out.empty()); } { std::vector out; - std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 5, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 5, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); diff_type size = std::min(5, formatted_size); assert(result.size == formatted_size); @@ -56,9 +59,9 @@ } { std::basic_string out; - std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 1000, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 1000, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); diff_type size = std::min(1000, formatted_size); assert(result.size == formatted_size); @@ -67,9 +70,9 @@ { // Test the returned iterator. std::basic_string out(10, CharT(' ')); - std::format_to_n_result result = std::format_to_n(out.begin(), 10, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(out.begin(), 10, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); diff_type size = std::min(10, formatted_size); assert(result.size == formatted_size); @@ -81,9 +84,9 @@ "If the difference type isn't negative the test will fail " "due to using a large positive value."); CharT buffer[1] = {CharT(0)}; - std::format_to_n_result result = std::format_to_n(buffer, -1, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(buffer, -1, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); assert(result.size == formatted_size); assert(result.out == buffer); @@ -91,7 +94,7 @@ } }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::format_to_n become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in format_to_n.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp @@ -29,14 +29,16 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - size_t size = std::formatted_size(std::locale(), fmt.template sv(), args...); - assert(size == expected.size()); -}; +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + size_t size = std::formatted_size(std::locale(), fmt, std::forward(args)...); + assert(size == expected.size()); + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::formatted_siz3 become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in formatted_size.locale.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp b/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp @@ -26,14 +26,16 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - size_t size = std::formatted_size(fmt.template sv(), args...); - assert(size == expected.size()); -}; +auto test = + []( + std::basic_string_view expected, test_format_string fmt, Args&&... args) constexpr { + size_t size = std::formatted_size(fmt, std::forward(args)...); + assert(size == expected.size()); + }; -auto test_exception = [](std::string_view, std::basic_string_view, const Args&...) { +auto test_exception = [](std::string_view, std::basic_string_view, Args&&...) { // After P2216 most exceptions thrown by std::formatted_siz3 become ill-formed. // Therefore this tests does nothing. // A basic ill-formed test is done in formatted_size.verify.cpp diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp @@ -92,6 +92,7 @@ #include "platform_support.h" // locale name macros #include "format_tests.h" #include "string_literal.h" +#include "test_format_string.h" #define STR(S) MAKE_STRING(CharT, S) #define SV(S) MAKE_STRING_VIEW(CharT, S) @@ -121,43 +122,42 @@ }; #endif -template -void test(std::basic_string_view expected, const Args&... args) { +template +void test(std::basic_string_view expected, test_format_string fmt, Args&&... args) { // *** format *** { - std::basic_string out = std::format(fmt.template sv(), args...); + std::basic_string out = std::format(fmt, std::forward(args)...); if constexpr (std::same_as) if (out != expected) - std::cerr << "\nFormat string " << fmt.template sv() << "\nExpected output " << expected - << "\nActual output " << out << '\n'; + std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " + << out << '\n'; assert(out == expected); } // *** vformat *** { - std::basic_string out = - std::vformat(fmt.template sv(), std::make_format_args>(args...)); + std::basic_string out = std::vformat(fmt.get(), std::make_format_args>(args...)); assert(out == expected); } // *** format_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), fmt.template sv(), args...); + auto it = std::format_to(out.begin(), fmt, std::forward(args)...); assert(it == out.end()); assert(out == expected); } // *** vformat_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to(out.begin(), fmt.template sv(), std::make_format_args>(args...)); + auto it = std::vformat_to(out.begin(), fmt.get(), std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } // *** format_to_n *** { std::basic_string out; - std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 1000, fmt.template sv(), args...); + std::format_to_n_result result = std::format_to_n(std::back_inserter(out), 1000, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(fmt, std::forward(args)...); diff_type size = std::min(1000, formatted_size); assert(result.size == formatted_size); @@ -165,40 +165,39 @@ } // *** formatted_size *** { - size_t size = std::formatted_size(fmt.template sv(), args...); + size_t size = std::formatted_size(fmt, std::forward(args)...); assert(size == expected.size()); } } -template -void test(std::basic_string_view expected, std::locale loc, const Args&... args) { +template +void test( + std::basic_string_view expected, std::locale loc, test_format_string fmt, Args&&... args) { // *** format *** { - std::basic_string out = std::format(loc, fmt.template sv(), args...); + std::basic_string out = std::format(loc, fmt, std::forward(args)...); if constexpr (std::same_as) if (out != expected) - std::cerr << "\nFormat string " << fmt.template sv() << "\nExpected output " << expected - << "\nActual output " << out << '\n'; + std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " + << out << '\n'; assert(out == expected); } // *** vformat *** { - std::basic_string out = - std::vformat(loc, fmt.template sv(), std::make_format_args>(args...)); + std::basic_string out = std::vformat(loc, fmt.get(), std::make_format_args>(args...)); assert(out == expected); } // *** format_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), loc, fmt.template sv(), args...); + auto it = std::format_to(out.begin(), loc, fmt, std::forward(args)...); assert(it == out.end()); assert(out == expected); } // *** vformat_to *** { std::basic_string out(expected.size(), CharT(' ')); - auto it = - std::vformat_to(out.begin(), loc, fmt.template sv(), std::make_format_args>(args...)); + auto it = std::vformat_to(out.begin(), loc, fmt.get(), std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } @@ -206,9 +205,9 @@ { std::basic_string out; std::format_to_n_result result = - std::format_to_n(std::back_inserter(out), 1000, loc, fmt.template sv(), args...); + std::format_to_n(std::back_inserter(out), 1000, loc, fmt, std::forward(args)...); using diff_type = decltype(result.size); - diff_type formatted_size = std::formatted_size(loc, fmt.template sv(), args...); + diff_type formatted_size = std::formatted_size(loc, fmt, std::forward(args)...); diff_type size = std::min(1000, formatted_size); assert(result.size == formatted_size); @@ -216,7 +215,7 @@ } // *** formatted_size *** { - size_t size = std::formatted_size(loc, fmt.template sv(), args...); + size_t size = std::formatted_size(loc, fmt, std::forward(args)...); assert(size == expected.size()); } } @@ -246,29 +245,29 @@ std::locale::global(std::locale(LOCALE_en_US_UTF_8)); assert(std::locale().name() == LOCALE_en_US_UTF_8); - test<"{:L}">(SV("true"), true); - test<"{:L}">(SV("false"), false); + test(SV("true"), SV("{:L}"), true); + test(SV("false"), SV("{:L}"), false); - test<"{:L}">(SV("yes"), loc, true); - test<"{:L}">(SV("no"), loc, false); + test(SV("yes"), loc, SV("{:L}"), true); + test(SV("no"), loc, SV("{:L}"), false); std::locale::global(loc); - test<"{:L}">(SV("yes"), true); - test<"{:L}">(SV("no"), false); + test(SV("yes"), SV("{:L}"), true); + test(SV("no"), SV("{:L}"), false); - test<"{:L}">(SV("true"), std::locale(LOCALE_en_US_UTF_8), true); - test<"{:L}">(SV("false"), std::locale(LOCALE_en_US_UTF_8), false); + test(SV("true"), std::locale(LOCALE_en_US_UTF_8), SV("{:L}"), true); + test(SV("false"), std::locale(LOCALE_en_US_UTF_8), SV("{:L}"), false); #ifndef TEST_HAS_NO_UNICODE std::locale loc_unicode = std::locale(std::locale(), new numpunct_unicode()); - test<"{:L}">(SV("gültig"), loc_unicode, true); - test<"{:L}">(SV("ungültig"), loc_unicode, false); + test(SV("gültig"), loc_unicode, SV("{:L}"), true); + test(SV("ungültig"), loc_unicode, SV("{:L}"), false); - test<"{:9L}">(SV("gültig "), loc_unicode, true); - test<"{:!<9L}">(SV("gültig!!!"), loc_unicode, true); - test<"{:_^9L}">(SV("_gültig__"), loc_unicode, true); - test<"{:>9L}">(SV(" gültig"), loc_unicode, true); + test(SV("gültig "), loc_unicode, SV("{:9L}"), true); + test(SV("gültig!!!"), loc_unicode, SV("{:!<9L}"), true); + test(SV("_gültig__"), loc_unicode, SV("{:_^9L}"), true); + test(SV(" gültig"), loc_unicode, SV("{:>9L}"), true); #endif // TEST_HAS_NO_UNICODE } @@ -279,325 +278,325 @@ // *** Decimal *** std::locale::global(en_US); - test<"{:L}">(SV("0"), 0); - test<"{:L}">(SV("1"), 1); - test<"{:L}">(SV("10"), 10); - test<"{:L}">(SV("100"), 100); - test<"{:L}">(SV("1,000"), 1'000); - test<"{:L}">(SV("10,000"), 10'000); - test<"{:L}">(SV("100,000"), 100'000); - test<"{:L}">(SV("1,000,000"), 1'000'000); - test<"{:L}">(SV("10,000,000"), 10'000'000); - test<"{:L}">(SV("100,000,000"), 100'000'000); - test<"{:L}">(SV("1,000,000,000"), 1'000'000'000); - - test<"{:L}">(SV("-1"), -1); - test<"{:L}">(SV("-10"), -10); - test<"{:L}">(SV("-100"), -100); - test<"{:L}">(SV("-1,000"), -1'000); - test<"{:L}">(SV("-10,000"), -10'000); - test<"{:L}">(SV("-100,000"), -100'000); - test<"{:L}">(SV("-1,000,000"), -1'000'000); - test<"{:L}">(SV("-10,000,000"), -10'000'000); - test<"{:L}">(SV("-100,000,000"), -100'000'000); - test<"{:L}">(SV("-1,000,000,000"), -1'000'000'000); + test(SV("0"), SV("{:L}"), 0); + test(SV("1"), SV("{:L}"), 1); + test(SV("10"), SV("{:L}"), 10); + test(SV("100"), SV("{:L}"), 100); + test(SV("1,000"), SV("{:L}"), 1'000); + test(SV("10,000"), SV("{:L}"), 10'000); + test(SV("100,000"), SV("{:L}"), 100'000); + test(SV("1,000,000"), SV("{:L}"), 1'000'000); + test(SV("10,000,000"), SV("{:L}"), 10'000'000); + test(SV("100,000,000"), SV("{:L}"), 100'000'000); + test(SV("1,000,000,000"), SV("{:L}"), 1'000'000'000); + + test(SV("-1"), SV("{:L}"), -1); + test(SV("-10"), SV("{:L}"), -10); + test(SV("-100"), SV("{:L}"), -100); + test(SV("-1,000"), SV("{:L}"), -1'000); + test(SV("-10,000"), SV("{:L}"), -10'000); + test(SV("-100,000"), SV("{:L}"), -100'000); + test(SV("-1,000,000"), SV("{:L}"), -1'000'000); + test(SV("-10,000,000"), SV("{:L}"), -10'000'000); + test(SV("-100,000,000"), SV("{:L}"), -100'000'000); + test(SV("-1,000,000,000"), SV("{:L}"), -1'000'000'000); std::locale::global(loc); - test<"{:L}">(SV("0"), 0); - test<"{:L}">(SV("1"), 1); - test<"{:L}">(SV("1_0"), 10); - test<"{:L}">(SV("10_0"), 100); - test<"{:L}">(SV("1_00_0"), 1'000); - test<"{:L}">(SV("10_00_0"), 10'000); - test<"{:L}">(SV("100_00_0"), 100'000); - test<"{:L}">(SV("1_000_00_0"), 1'000'000); - test<"{:L}">(SV("10_000_00_0"), 10'000'000); - test<"{:L}">(SV("1_00_000_00_0"), 100'000'000); - test<"{:L}">(SV("1_0_00_000_00_0"), 1'000'000'000); - - test<"{:L}">(SV("-1"), -1); - test<"{:L}">(SV("-1_0"), -10); - test<"{:L}">(SV("-10_0"), -100); - test<"{:L}">(SV("-1_00_0"), -1'000); - test<"{:L}">(SV("-10_00_0"), -10'000); - test<"{:L}">(SV("-100_00_0"), -100'000); - test<"{:L}">(SV("-1_000_00_0"), -1'000'000); - test<"{:L}">(SV("-10_000_00_0"), -10'000'000); - test<"{:L}">(SV("-1_00_000_00_0"), -100'000'000); - test<"{:L}">(SV("-1_0_00_000_00_0"), -1'000'000'000); - - test<"{:L}">(SV("0"), en_US, 0); - test<"{:L}">(SV("1"), en_US, 1); - test<"{:L}">(SV("10"), en_US, 10); - test<"{:L}">(SV("100"), en_US, 100); - test<"{:L}">(SV("1,000"), en_US, 1'000); - test<"{:L}">(SV("10,000"), en_US, 10'000); - test<"{:L}">(SV("100,000"), en_US, 100'000); - test<"{:L}">(SV("1,000,000"), en_US, 1'000'000); - test<"{:L}">(SV("10,000,000"), en_US, 10'000'000); - test<"{:L}">(SV("100,000,000"), en_US, 100'000'000); - test<"{:L}">(SV("1,000,000,000"), en_US, 1'000'000'000); - - test<"{:L}">(SV("-1"), en_US, -1); - test<"{:L}">(SV("-10"), en_US, -10); - test<"{:L}">(SV("-100"), en_US, -100); - test<"{:L}">(SV("-1,000"), en_US, -1'000); - test<"{:L}">(SV("-10,000"), en_US, -10'000); - test<"{:L}">(SV("-100,000"), en_US, -100'000); - test<"{:L}">(SV("-1,000,000"), en_US, -1'000'000); - test<"{:L}">(SV("-10,000,000"), en_US, -10'000'000); - test<"{:L}">(SV("-100,000,000"), en_US, -100'000'000); - test<"{:L}">(SV("-1,000,000,000"), en_US, -1'000'000'000); + test(SV("0"), SV("{:L}"), 0); + test(SV("1"), SV("{:L}"), 1); + test(SV("1_0"), SV("{:L}"), 10); + test(SV("10_0"), SV("{:L}"), 100); + test(SV("1_00_0"), SV("{:L}"), 1'000); + test(SV("10_00_0"), SV("{:L}"), 10'000); + test(SV("100_00_0"), SV("{:L}"), 100'000); + test(SV("1_000_00_0"), SV("{:L}"), 1'000'000); + test(SV("10_000_00_0"), SV("{:L}"), 10'000'000); + test(SV("1_00_000_00_0"), SV("{:L}"), 100'000'000); + test(SV("1_0_00_000_00_0"), SV("{:L}"), 1'000'000'000); + + test(SV("-1"), SV("{:L}"), -1); + test(SV("-1_0"), SV("{:L}"), -10); + test(SV("-10_0"), SV("{:L}"), -100); + test(SV("-1_00_0"), SV("{:L}"), -1'000); + test(SV("-10_00_0"), SV("{:L}"), -10'000); + test(SV("-100_00_0"), SV("{:L}"), -100'000); + test(SV("-1_000_00_0"), SV("{:L}"), -1'000'000); + test(SV("-10_000_00_0"), SV("{:L}"), -10'000'000); + test(SV("-1_00_000_00_0"), SV("{:L}"), -100'000'000); + test(SV("-1_0_00_000_00_0"), SV("{:L}"), -1'000'000'000); + + test(SV("0"), en_US, SV("{:L}"), 0); + test(SV("1"), en_US, SV("{:L}"), 1); + test(SV("10"), en_US, SV("{:L}"), 10); + test(SV("100"), en_US, SV("{:L}"), 100); + test(SV("1,000"), en_US, SV("{:L}"), 1'000); + test(SV("10,000"), en_US, SV("{:L}"), 10'000); + test(SV("100,000"), en_US, SV("{:L}"), 100'000); + test(SV("1,000,000"), en_US, SV("{:L}"), 1'000'000); + test(SV("10,000,000"), en_US, SV("{:L}"), 10'000'000); + test(SV("100,000,000"), en_US, SV("{:L}"), 100'000'000); + test(SV("1,000,000,000"), en_US, SV("{:L}"), 1'000'000'000); + + test(SV("-1"), en_US, SV("{:L}"), -1); + test(SV("-10"), en_US, SV("{:L}"), -10); + test(SV("-100"), en_US, SV("{:L}"), -100); + test(SV("-1,000"), en_US, SV("{:L}"), -1'000); + test(SV("-10,000"), en_US, SV("{:L}"), -10'000); + test(SV("-100,000"), en_US, SV("{:L}"), -100'000); + test(SV("-1,000,000"), en_US, SV("{:L}"), -1'000'000); + test(SV("-10,000,000"), en_US, SV("{:L}"), -10'000'000); + test(SV("-100,000,000"), en_US, SV("{:L}"), -100'000'000); + test(SV("-1,000,000,000"), en_US, SV("{:L}"), -1'000'000'000); std::locale::global(en_US); - test<"{:L}">(SV("0"), loc, 0); - test<"{:L}">(SV("1"), loc, 1); - test<"{:L}">(SV("1_0"), loc, 10); - test<"{:L}">(SV("10_0"), loc, 100); - test<"{:L}">(SV("1_00_0"), loc, 1'000); - test<"{:L}">(SV("10_00_0"), loc, 10'000); - test<"{:L}">(SV("100_00_0"), loc, 100'000); - test<"{:L}">(SV("1_000_00_0"), loc, 1'000'000); - test<"{:L}">(SV("10_000_00_0"), loc, 10'000'000); - test<"{:L}">(SV("1_00_000_00_0"), loc, 100'000'000); - test<"{:L}">(SV("1_0_00_000_00_0"), loc, 1'000'000'000); - - test<"{:L}">(SV("-1"), loc, -1); - test<"{:L}">(SV("-1_0"), loc, -10); - test<"{:L}">(SV("-10_0"), loc, -100); - test<"{:L}">(SV("-1_00_0"), loc, -1'000); - test<"{:L}">(SV("-10_00_0"), loc, -10'000); - test<"{:L}">(SV("-100_00_0"), loc, -100'000); - test<"{:L}">(SV("-1_000_00_0"), loc, -1'000'000); - test<"{:L}">(SV("-10_000_00_0"), loc, -10'000'000); - test<"{:L}">(SV("-1_00_000_00_0"), loc, -100'000'000); - test<"{:L}">(SV("-1_0_00_000_00_0"), loc, -1'000'000'000); + test(SV("0"), loc, SV("{:L}"), 0); + test(SV("1"), loc, SV("{:L}"), 1); + test(SV("1_0"), loc, SV("{:L}"), 10); + test(SV("10_0"), loc, SV("{:L}"), 100); + test(SV("1_00_0"), loc, SV("{:L}"), 1'000); + test(SV("10_00_0"), loc, SV("{:L}"), 10'000); + test(SV("100_00_0"), loc, SV("{:L}"), 100'000); + test(SV("1_000_00_0"), loc, SV("{:L}"), 1'000'000); + test(SV("10_000_00_0"), loc, SV("{:L}"), 10'000'000); + test(SV("1_00_000_00_0"), loc, SV("{:L}"), 100'000'000); + test(SV("1_0_00_000_00_0"), loc, SV("{:L}"), 1'000'000'000); + + test(SV("-1"), loc, SV("{:L}"), -1); + test(SV("-1_0"), loc, SV("{:L}"), -10); + test(SV("-10_0"), loc, SV("{:L}"), -100); + test(SV("-1_00_0"), loc, SV("{:L}"), -1'000); + test(SV("-10_00_0"), loc, SV("{:L}"), -10'000); + test(SV("-100_00_0"), loc, SV("{:L}"), -100'000); + test(SV("-1_000_00_0"), loc, SV("{:L}"), -1'000'000); + test(SV("-10_000_00_0"), loc, SV("{:L}"), -10'000'000); + test(SV("-1_00_000_00_0"), loc, SV("{:L}"), -100'000'000); + test(SV("-1_0_00_000_00_0"), loc, SV("{:L}"), -1'000'000'000); // *** Binary *** std::locale::global(en_US); - test<"{:Lb}">(SV("0"), 0b0); - test<"{:Lb}">(SV("1"), 0b1); - test<"{:Lb}">(SV("1,000,000,000"), 0b1'000'000'000); + test(SV("0"), SV("{:Lb}"), 0b0); + test(SV("1"), SV("{:Lb}"), 0b1); + test(SV("1,000,000,000"), SV("{:Lb}"), 0b1'000'000'000); - test<"{:#Lb}">(SV("0b0"), 0b0); - test<"{:#Lb}">(SV("0b1"), 0b1); - test<"{:#Lb}">(SV("0b1,000,000,000"), 0b1'000'000'000); + test(SV("0b0"), SV("{:#Lb}"), 0b0); + test(SV("0b1"), SV("{:#Lb}"), 0b1); + test(SV("0b1,000,000,000"), SV("{:#Lb}"), 0b1'000'000'000); - test<"{:LB}">(SV("-1"), -0b1); - test<"{:LB}">(SV("-1,000,000,000"), -0b1'000'000'000); + test(SV("-1"), SV("{:LB}"), -0b1); + test(SV("-1,000,000,000"), SV("{:LB}"), -0b1'000'000'000); - test<"{:#LB}">(SV("-0B1"), -0b1); - test<"{:#LB}">(SV("-0B1,000,000,000"), -0b1'000'000'000); + test(SV("-0B1"), SV("{:#LB}"), -0b1); + test(SV("-0B1,000,000,000"), SV("{:#LB}"), -0b1'000'000'000); std::locale::global(loc); - test<"{:Lb}">(SV("0"), 0b0); - test<"{:Lb}">(SV("1"), 0b1); - test<"{:Lb}">(SV("1_0_00_000_00_0"), 0b1'000'000'000); + test(SV("0"), SV("{:Lb}"), 0b0); + test(SV("1"), SV("{:Lb}"), 0b1); + test(SV("1_0_00_000_00_0"), SV("{:Lb}"), 0b1'000'000'000); - test<"{:#Lb}">(SV("0b0"), 0b0); - test<"{:#Lb}">(SV("0b1"), 0b1); - test<"{:#Lb}">(SV("0b1_0_00_000_00_0"), 0b1'000'000'000); + test(SV("0b0"), SV("{:#Lb}"), 0b0); + test(SV("0b1"), SV("{:#Lb}"), 0b1); + test(SV("0b1_0_00_000_00_0"), SV("{:#Lb}"), 0b1'000'000'000); - test<"{:LB}">(SV("-1"), -0b1); - test<"{:LB}">(SV("-1_0_00_000_00_0"), -0b1'000'000'000); + test(SV("-1"), SV("{:LB}"), -0b1); + test(SV("-1_0_00_000_00_0"), SV("{:LB}"), -0b1'000'000'000); - test<"{:#LB}">(SV("-0B1"), -0b1); - test<"{:#LB}">(SV("-0B1_0_00_000_00_0"), -0b1'000'000'000); + test(SV("-0B1"), SV("{:#LB}"), -0b1); + test(SV("-0B1_0_00_000_00_0"), SV("{:#LB}"), -0b1'000'000'000); - test<"{:Lb}">(SV("0"), en_US, 0b0); - test<"{:Lb}">(SV("1"), en_US, 0b1); - test<"{:Lb}">(SV("1,000,000,000"), en_US, 0b1'000'000'000); + test(SV("0"), en_US, SV("{:Lb}"), 0b0); + test(SV("1"), en_US, SV("{:Lb}"), 0b1); + test(SV("1,000,000,000"), en_US, SV("{:Lb}"), 0b1'000'000'000); - test<"{:#Lb}">(SV("0b0"), en_US, 0b0); - test<"{:#Lb}">(SV("0b1"), en_US, 0b1); - test<"{:#Lb}">(SV("0b1,000,000,000"), en_US, 0b1'000'000'000); + test(SV("0b0"), en_US, SV("{:#Lb}"), 0b0); + test(SV("0b1"), en_US, SV("{:#Lb}"), 0b1); + test(SV("0b1,000,000,000"), en_US, SV("{:#Lb}"), 0b1'000'000'000); - test<"{:LB}">(SV("-1"), en_US, -0b1); - test<"{:LB}">(SV("-1,000,000,000"), en_US, -0b1'000'000'000); + test(SV("-1"), en_US, SV("{:LB}"), -0b1); + test(SV("-1,000,000,000"), en_US, SV("{:LB}"), -0b1'000'000'000); - test<"{:#LB}">(SV("-0B1"), en_US, -0b1); - test<"{:#LB}">(SV("-0B1,000,000,000"), en_US, -0b1'000'000'000); + test(SV("-0B1"), en_US, SV("{:#LB}"), -0b1); + test(SV("-0B1,000,000,000"), en_US, SV("{:#LB}"), -0b1'000'000'000); std::locale::global(en_US); - test<"{:Lb}">(SV("0"), loc, 0b0); - test<"{:Lb}">(SV("1"), loc, 0b1); - test<"{:Lb}">(SV("1_0_00_000_00_0"), loc, 0b1'000'000'000); + test(SV("0"), loc, SV("{:Lb}"), 0b0); + test(SV("1"), loc, SV("{:Lb}"), 0b1); + test(SV("1_0_00_000_00_0"), loc, SV("{:Lb}"), 0b1'000'000'000); - test<"{:#Lb}">(SV("0b0"), loc, 0b0); - test<"{:#Lb}">(SV("0b1"), loc, 0b1); - test<"{:#Lb}">(SV("0b1_0_00_000_00_0"), loc, 0b1'000'000'000); + test(SV("0b0"), loc, SV("{:#Lb}"), 0b0); + test(SV("0b1"), loc, SV("{:#Lb}"), 0b1); + test(SV("0b1_0_00_000_00_0"), loc, SV("{:#Lb}"), 0b1'000'000'000); - test<"{:LB}">(SV("-1"), loc, -0b1); - test<"{:LB}">(SV("-1_0_00_000_00_0"), loc, -0b1'000'000'000); + test(SV("-1"), loc, SV("{:LB}"), -0b1); + test(SV("-1_0_00_000_00_0"), loc, SV("{:LB}"), -0b1'000'000'000); - test<"{:#LB}">(SV("-0B1"), loc, -0b1); - test<"{:#LB}">(SV("-0B1_0_00_000_00_0"), loc, -0b1'000'000'000); + test(SV("-0B1"), loc, SV("{:#LB}"), -0b1); + test(SV("-0B1_0_00_000_00_0"), loc, SV("{:#LB}"), -0b1'000'000'000); // *** Octal *** std::locale::global(en_US); - test<"{:Lo}">(SV("0"), 00); - test<"{:Lo}">(SV("1"), 01); - test<"{:Lo}">(SV("1,000,000,000"), 01'000'000'000); + test(SV("0"), SV("{:Lo}"), 00); + test(SV("1"), SV("{:Lo}"), 01); + test(SV("1,000,000,000"), SV("{:Lo}"), 01'000'000'000); - test<"{:#Lo}">(SV("0"), 00); - test<"{:#Lo}">(SV("01"), 01); - test<"{:#Lo}">(SV("01,000,000,000"), 01'000'000'000); + test(SV("0"), SV("{:#Lo}"), 00); + test(SV("01"), SV("{:#Lo}"), 01); + test(SV("01,000,000,000"), SV("{:#Lo}"), 01'000'000'000); - test<"{:Lo}">(SV("-1"), -01); - test<"{:Lo}">(SV("-1,000,000,000"), -01'000'000'000); + test(SV("-1"), SV("{:Lo}"), -01); + test(SV("-1,000,000,000"), SV("{:Lo}"), -01'000'000'000); - test<"{:#Lo}">(SV("-01"), -01); - test<"{:#Lo}">(SV("-01,000,000,000"), -01'000'000'000); + test(SV("-01"), SV("{:#Lo}"), -01); + test(SV("-01,000,000,000"), SV("{:#Lo}"), -01'000'000'000); std::locale::global(loc); - test<"{:Lo}">(SV("0"), 00); - test<"{:Lo}">(SV("1"), 01); - test<"{:Lo}">(SV("1_0_00_000_00_0"), 01'000'000'000); + test(SV("0"), SV("{:Lo}"), 00); + test(SV("1"), SV("{:Lo}"), 01); + test(SV("1_0_00_000_00_0"), SV("{:Lo}"), 01'000'000'000); - test<"{:#Lo}">(SV("0"), 00); - test<"{:#Lo}">(SV("01"), 01); - test<"{:#Lo}">(SV("01_0_00_000_00_0"), 01'000'000'000); + test(SV("0"), SV("{:#Lo}"), 00); + test(SV("01"), SV("{:#Lo}"), 01); + test(SV("01_0_00_000_00_0"), SV("{:#Lo}"), 01'000'000'000); - test<"{:Lo}">(SV("-1"), -01); - test<"{:Lo}">(SV("-1_0_00_000_00_0"), -01'000'000'000); + test(SV("-1"), SV("{:Lo}"), -01); + test(SV("-1_0_00_000_00_0"), SV("{:Lo}"), -01'000'000'000); - test<"{:#Lo}">(SV("-01"), -01); - test<"{:#Lo}">(SV("-01_0_00_000_00_0"), -01'000'000'000); + test(SV("-01"), SV("{:#Lo}"), -01); + test(SV("-01_0_00_000_00_0"), SV("{:#Lo}"), -01'000'000'000); - test<"{:Lo}">(SV("0"), en_US, 00); - test<"{:Lo}">(SV("1"), en_US, 01); - test<"{:Lo}">(SV("1,000,000,000"), en_US, 01'000'000'000); + test(SV("0"), en_US, SV("{:Lo}"), 00); + test(SV("1"), en_US, SV("{:Lo}"), 01); + test(SV("1,000,000,000"), en_US, SV("{:Lo}"), 01'000'000'000); - test<"{:#Lo}">(SV("0"), en_US, 00); - test<"{:#Lo}">(SV("01"), en_US, 01); - test<"{:#Lo}">(SV("01,000,000,000"), en_US, 01'000'000'000); + test(SV("0"), en_US, SV("{:#Lo}"), 00); + test(SV("01"), en_US, SV("{:#Lo}"), 01); + test(SV("01,000,000,000"), en_US, SV("{:#Lo}"), 01'000'000'000); - test<"{:Lo}">(SV("-1"), en_US, -01); - test<"{:Lo}">(SV("-1,000,000,000"), en_US, -01'000'000'000); + test(SV("-1"), en_US, SV("{:Lo}"), -01); + test(SV("-1,000,000,000"), en_US, SV("{:Lo}"), -01'000'000'000); - test<"{:#Lo}">(SV("-01"), en_US, -01); - test<"{:#Lo}">(SV("-01,000,000,000"), en_US, -01'000'000'000); + test(SV("-01"), en_US, SV("{:#Lo}"), -01); + test(SV("-01,000,000,000"), en_US, SV("{:#Lo}"), -01'000'000'000); std::locale::global(en_US); - test<"{:Lo}">(SV("0"), loc, 00); - test<"{:Lo}">(SV("1"), loc, 01); - test<"{:Lo}">(SV("1_0_00_000_00_0"), loc, 01'000'000'000); + test(SV("0"), loc, SV("{:Lo}"), 00); + test(SV("1"), loc, SV("{:Lo}"), 01); + test(SV("1_0_00_000_00_0"), loc, SV("{:Lo}"), 01'000'000'000); - test<"{:#Lo}">(SV("0"), loc, 00); - test<"{:#Lo}">(SV("01"), loc, 01); - test<"{:#Lo}">(SV("01_0_00_000_00_0"), loc, 01'000'000'000); + test(SV("0"), loc, SV("{:#Lo}"), 00); + test(SV("01"), loc, SV("{:#Lo}"), 01); + test(SV("01_0_00_000_00_0"), loc, SV("{:#Lo}"), 01'000'000'000); - test<"{:Lo}">(SV("-1"), loc, -01); - test<"{:Lo}">(SV("-1_0_00_000_00_0"), loc, -01'000'000'000); + test(SV("-1"), loc, SV("{:Lo}"), -01); + test(SV("-1_0_00_000_00_0"), loc, SV("{:Lo}"), -01'000'000'000); - test<"{:#Lo}">(SV("-01"), loc, -01); - test<"{:#Lo}">(SV("-01_0_00_000_00_0"), loc, -01'000'000'000); + test(SV("-01"), loc, SV("{:#Lo}"), -01); + test(SV("-01_0_00_000_00_0"), loc, SV("{:#Lo}"), -01'000'000'000); // *** Hexadecimal *** std::locale::global(en_US); - test<"{:Lx}">(SV("0"), 0x0); - test<"{:Lx}">(SV("1"), 0x1); - test<"{:Lx}">(SV("1,000,000,000"), 0x1'000'000'000); + test(SV("0"), SV("{:Lx}"), 0x0); + test(SV("1"), SV("{:Lx}"), 0x1); + test(SV("1,000,000,000"), SV("{:Lx}"), 0x1'000'000'000); - test<"{:#Lx}">(SV("0x0"), 0x0); - test<"{:#Lx}">(SV("0x1"), 0x1); - test<"{:#Lx}">(SV("0x1,000,000,000"), 0x1'000'000'000); + test(SV("0x0"), SV("{:#Lx}"), 0x0); + test(SV("0x1"), SV("{:#Lx}"), 0x1); + test(SV("0x1,000,000,000"), SV("{:#Lx}"), 0x1'000'000'000); - test<"{:LX}">(SV("-1"), -0x1); - test<"{:LX}">(SV("-1,000,000,000"), -0x1'000'000'000); + test(SV("-1"), SV("{:LX}"), -0x1); + test(SV("-1,000,000,000"), SV("{:LX}"), -0x1'000'000'000); - test<"{:#LX}">(SV("-0X1"), -0x1); - test<"{:#LX}">(SV("-0X1,000,000,000"), -0x1'000'000'000); + test(SV("-0X1"), SV("{:#LX}"), -0x1); + test(SV("-0X1,000,000,000"), SV("{:#LX}"), -0x1'000'000'000); std::locale::global(loc); - test<"{:Lx}">(SV("0"), 0x0); - test<"{:Lx}">(SV("1"), 0x1); - test<"{:Lx}">(SV("1_0_00_000_00_0"), 0x1'000'000'000); + test(SV("0"), SV("{:Lx}"), 0x0); + test(SV("1"), SV("{:Lx}"), 0x1); + test(SV("1_0_00_000_00_0"), SV("{:Lx}"), 0x1'000'000'000); - test<"{:#Lx}">(SV("0x0"), 0x0); - test<"{:#Lx}">(SV("0x1"), 0x1); - test<"{:#Lx}">(SV("0x1_0_00_000_00_0"), 0x1'000'000'000); + test(SV("0x0"), SV("{:#Lx}"), 0x0); + test(SV("0x1"), SV("{:#Lx}"), 0x1); + test(SV("0x1_0_00_000_00_0"), SV("{:#Lx}"), 0x1'000'000'000); - test<"{:LX}">(SV("-1"), -0x1); - test<"{:LX}">(SV("-1_0_00_000_00_0"), -0x1'000'000'000); + test(SV("-1"), SV("{:LX}"), -0x1); + test(SV("-1_0_00_000_00_0"), SV("{:LX}"), -0x1'000'000'000); - test<"{:#LX}">(SV("-0X1"), -0x1); - test<"{:#LX}">(SV("-0X1_0_00_000_00_0"), -0x1'000'000'000); + test(SV("-0X1"), SV("{:#LX}"), -0x1); + test(SV("-0X1_0_00_000_00_0"), SV("{:#LX}"), -0x1'000'000'000); - test<"{:Lx}">(SV("0"), en_US, 0x0); - test<"{:Lx}">(SV("1"), en_US, 0x1); - test<"{:Lx}">(SV("1,000,000,000"), en_US, 0x1'000'000'000); + test(SV("0"), en_US, SV("{:Lx}"), 0x0); + test(SV("1"), en_US, SV("{:Lx}"), 0x1); + test(SV("1,000,000,000"), en_US, SV("{:Lx}"), 0x1'000'000'000); - test<"{:#Lx}">(SV("0x0"), en_US, 0x0); - test<"{:#Lx}">(SV("0x1"), en_US, 0x1); - test<"{:#Lx}">(SV("0x1,000,000,000"), en_US, 0x1'000'000'000); + test(SV("0x0"), en_US, SV("{:#Lx}"), 0x0); + test(SV("0x1"), en_US, SV("{:#Lx}"), 0x1); + test(SV("0x1,000,000,000"), en_US, SV("{:#Lx}"), 0x1'000'000'000); - test<"{:LX}">(SV("-1"), en_US, -0x1); - test<"{:LX}">(SV("-1,000,000,000"), en_US, -0x1'000'000'000); + test(SV("-1"), en_US, SV("{:LX}"), -0x1); + test(SV("-1,000,000,000"), en_US, SV("{:LX}"), -0x1'000'000'000); - test<"{:#LX}">(SV("-0X1"), en_US, -0x1); - test<"{:#LX}">(SV("-0X1,000,000,000"), en_US, -0x1'000'000'000); + test(SV("-0X1"), en_US, SV("{:#LX}"), -0x1); + test(SV("-0X1,000,000,000"), en_US, SV("{:#LX}"), -0x1'000'000'000); std::locale::global(en_US); - test<"{:Lx}">(SV("0"), loc, 0x0); - test<"{:Lx}">(SV("1"), loc, 0x1); - test<"{:Lx}">(SV("1_0_00_000_00_0"), loc, 0x1'000'000'000); + test(SV("0"), loc, SV("{:Lx}"), 0x0); + test(SV("1"), loc, SV("{:Lx}"), 0x1); + test(SV("1_0_00_000_00_0"), loc, SV("{:Lx}"), 0x1'000'000'000); - test<"{:#Lx}">(SV("0x0"), loc, 0x0); - test<"{:#Lx}">(SV("0x1"), loc, 0x1); - test<"{:#Lx}">(SV("0x1_0_00_000_00_0"), loc, 0x1'000'000'000); + test(SV("0x0"), loc, SV("{:#Lx}"), 0x0); + test(SV("0x1"), loc, SV("{:#Lx}"), 0x1); + test(SV("0x1_0_00_000_00_0"), loc, SV("{:#Lx}"), 0x1'000'000'000); - test<"{:LX}">(SV("-1"), loc, -0x1); - test<"{:LX}">(SV("-1_0_00_000_00_0"), loc, -0x1'000'000'000); + test(SV("-1"), loc, SV("{:LX}"), -0x1); + test(SV("-1_0_00_000_00_0"), loc, SV("{:LX}"), -0x1'000'000'000); - test<"{:#LX}">(SV("-0X1"), loc, -0x1); - test<"{:#LX}">(SV("-0X1_0_00_000_00_0"), loc, -0x1'000'000'000); + test(SV("-0X1"), loc, SV("{:#LX}"), -0x1); + test(SV("-0X1_0_00_000_00_0"), loc, SV("{:#LX}"), -0x1'000'000'000); // *** align-fill & width *** - test<"{:L}">(SV("4_2"), loc, 42); + test(SV("4_2"), loc, SV("{:L}"), 42); - test<"{:6L}">(SV(" 4_2"), loc, 42); - test<"{:<6L}">(SV("4_2 "), loc, 42); - test<"{:^6L}">(SV(" 4_2 "), loc, 42); - test<"{:>6L}">(SV(" 4_2"), loc, 42); + test(SV(" 4_2"), loc, SV("{:6L}"), 42); + test(SV("4_2 "), loc, SV("{:<6L}"), 42); + test(SV(" 4_2 "), loc, SV("{:^6L}"), 42); + test(SV(" 4_2"), loc, SV("{:>6L}"), 42); - test<"{:*<6L}">(SV("4_2***"), loc, 42); - test<"{:*^6L}">(SV("*4_2**"), loc, 42); - test<"{:*>6L}">(SV("***4_2"), loc, 42); + test(SV("4_2***"), loc, SV("{:*<6L}"), 42); + test(SV("*4_2**"), loc, SV("{:*^6L}"), 42); + test(SV("***4_2"), loc, SV("{:*>6L}"), 42); - test<"{:*<8Lx}">(SV("4_a*****"), loc, 0x4a); - test<"{:*^8Lx}">(SV("**4_a***"), loc, 0x4a); - test<"{:*>8Lx}">(SV("*****4_a"), loc, 0x4a); + test(SV("4_a*****"), loc, SV("{:*<8Lx}"), 0x4a); + test(SV("**4_a***"), loc, SV("{:*^8Lx}"), 0x4a); + test(SV("*****4_a"), loc, SV("{:*>8Lx}"), 0x4a); - test<"{:*<#8Lx}">(SV("0x4_a***"), loc, 0x4a); - test<"{:*^#8Lx}">(SV("*0x4_a**"), loc, 0x4a); - test<"{:*>#8Lx}">(SV("***0x4_a"), loc, 0x4a); + test(SV("0x4_a***"), loc, SV("{:*<#8Lx}"), 0x4a); + test(SV("*0x4_a**"), loc, SV("{:*^#8Lx}"), 0x4a); + test(SV("***0x4_a"), loc, SV("{:*>#8Lx}"), 0x4a); - test<"{:*<8LX}">(SV("4_A*****"), loc, 0x4a); - test<"{:*^8LX}">(SV("**4_A***"), loc, 0x4a); - test<"{:*>8LX}">(SV("*****4_A"), loc, 0x4a); + test(SV("4_A*****"), loc, SV("{:*<8LX}"), 0x4a); + test(SV("**4_A***"), loc, SV("{:*^8LX}"), 0x4a); + test(SV("*****4_A"), loc, SV("{:*>8LX}"), 0x4a); - test<"{:*<#8LX}">(SV("0X4_A***"), loc, 0x4a); - test<"{:*^#8LX}">(SV("*0X4_A**"), loc, 0x4a); - test<"{:*>#8LX}">(SV("***0X4_A"), loc, 0x4a); + test(SV("0X4_A***"), loc, SV("{:*<#8LX}"), 0x4a); + test(SV("*0X4_A**"), loc, SV("{:*^#8LX}"), 0x4a); + test(SV("***0X4_A"), loc, SV("{:*>#8LX}"), 0x4a); // Test whether zero padding is ignored - test<"{:<06L}">(SV("4_2 "), loc, 42); - test<"{:^06L}">(SV(" 4_2 "), loc, 42); - test<"{:>06L}">(SV(" 4_2"), loc, 42); + test(SV("4_2 "), loc, SV("{:<06L}"), 42); + test(SV(" 4_2 "), loc, SV("{:^06L}"), 42); + test(SV(" 4_2"), loc, SV("{:>06L}"), 42); // *** zero-padding & width *** - test<"{:6L}">(SV(" 4_2"), loc, 42); - test<"{:06L}">(SV("0004_2"), loc, 42); - test<"{:06L}">(SV("-004_2"), loc, -42); + test(SV(" 4_2"), loc, SV("{:6L}"), 42); + test(SV("0004_2"), loc, SV("{:06L}"), 42); + test(SV("-004_2"), loc, SV("{:06L}"), -42); - test<"{:08Lx}">(SV("000004_a"), loc, 0x4a); - test<"{:#08Lx}">(SV("0x0004_a"), loc, 0x4a); - test<"{:#08LX}">(SV("0X0004_A"), loc, 0x4a); + test(SV("000004_a"), loc, SV("{:08Lx}"), 0x4a); + test(SV("0x0004_a"), loc, SV("{:#08Lx}"), 0x4a); + test(SV("0X0004_A"), loc, SV("{:#08LX}"), 0x4a); - test<"{:08Lx}">(SV("-00004_a"), loc, -0x4a); - test<"{:#08Lx}">(SV("-0x004_a"), loc, -0x4a); - test<"{:#08LX}">(SV("-0X004_A"), loc, -0x4a); + test(SV("-00004_a"), loc, SV("{:08Lx}"), -0x4a); + test(SV("-0x004_a"), loc, SV("{:#08Lx}"), -0x4a); + test(SV("-0X004_A"), loc, SV("{:#08LX}"), -0x4a); } template @@ -607,83 +606,83 @@ // *** Basic *** std::locale::global(en_US); - test<"{:La}">(SV("1.23456p-3"), F(0x1.23456p-3)); - test<"{:La}">(SV("1.23456p-2"), F(0x1.23456p-2)); - test<"{:La}">(SV("1.23456p-1"), F(0x1.23456p-1)); - test<"{:La}">(SV("1.23456p+0"), F(0x1.23456p0)); - test<"{:La}">(SV("1.23456p+1"), F(0x1.23456p+1)); - test<"{:La}">(SV("1.23456p+2"), F(0x1.23456p+2)); - test<"{:La}">(SV("1.23456p+3"), F(0x1.23456p+3)); - test<"{:La}">(SV("1.23456p+20"), F(0x1.23456p+20)); + test(SV("1.23456p-3"), SV("{:La}"), F(0x1.23456p-3)); + test(SV("1.23456p-2"), SV("{:La}"), F(0x1.23456p-2)); + test(SV("1.23456p-1"), SV("{:La}"), F(0x1.23456p-1)); + test(SV("1.23456p+0"), SV("{:La}"), F(0x1.23456p0)); + test(SV("1.23456p+1"), SV("{:La}"), F(0x1.23456p+1)); + test(SV("1.23456p+2"), SV("{:La}"), F(0x1.23456p+2)); + test(SV("1.23456p+3"), SV("{:La}"), F(0x1.23456p+3)); + test(SV("1.23456p+20"), SV("{:La}"), F(0x1.23456p+20)); std::locale::global(loc); - test<"{:La}">(SV("1#23456p-3"), F(0x1.23456p-3)); - test<"{:La}">(SV("1#23456p-2"), F(0x1.23456p-2)); - test<"{:La}">(SV("1#23456p-1"), F(0x1.23456p-1)); - test<"{:La}">(SV("1#23456p+0"), F(0x1.23456p0)); - test<"{:La}">(SV("1#23456p+1"), F(0x1.23456p+1)); - test<"{:La}">(SV("1#23456p+2"), F(0x1.23456p+2)); - test<"{:La}">(SV("1#23456p+3"), F(0x1.23456p+3)); - test<"{:La}">(SV("1#23456p+20"), F(0x1.23456p+20)); - - test<"{:La}">(SV("1.23456p-3"), en_US, F(0x1.23456p-3)); - test<"{:La}">(SV("1.23456p-2"), en_US, F(0x1.23456p-2)); - test<"{:La}">(SV("1.23456p-1"), en_US, F(0x1.23456p-1)); - test<"{:La}">(SV("1.23456p+0"), en_US, F(0x1.23456p0)); - test<"{:La}">(SV("1.23456p+1"), en_US, F(0x1.23456p+1)); - test<"{:La}">(SV("1.23456p+2"), en_US, F(0x1.23456p+2)); - test<"{:La}">(SV("1.23456p+3"), en_US, F(0x1.23456p+3)); - test<"{:La}">(SV("1.23456p+20"), en_US, F(0x1.23456p+20)); + test(SV("1#23456p-3"), SV("{:La}"), F(0x1.23456p-3)); + test(SV("1#23456p-2"), SV("{:La}"), F(0x1.23456p-2)); + test(SV("1#23456p-1"), SV("{:La}"), F(0x1.23456p-1)); + test(SV("1#23456p+0"), SV("{:La}"), F(0x1.23456p0)); + test(SV("1#23456p+1"), SV("{:La}"), F(0x1.23456p+1)); + test(SV("1#23456p+2"), SV("{:La}"), F(0x1.23456p+2)); + test(SV("1#23456p+3"), SV("{:La}"), F(0x1.23456p+3)); + test(SV("1#23456p+20"), SV("{:La}"), F(0x1.23456p+20)); + + test(SV("1.23456p-3"), en_US, SV("{:La}"), F(0x1.23456p-3)); + test(SV("1.23456p-2"), en_US, SV("{:La}"), F(0x1.23456p-2)); + test(SV("1.23456p-1"), en_US, SV("{:La}"), F(0x1.23456p-1)); + test(SV("1.23456p+0"), en_US, SV("{:La}"), F(0x1.23456p0)); + test(SV("1.23456p+1"), en_US, SV("{:La}"), F(0x1.23456p+1)); + test(SV("1.23456p+2"), en_US, SV("{:La}"), F(0x1.23456p+2)); + test(SV("1.23456p+3"), en_US, SV("{:La}"), F(0x1.23456p+3)); + test(SV("1.23456p+20"), en_US, SV("{:La}"), F(0x1.23456p+20)); std::locale::global(en_US); - test<"{:La}">(SV("1#23456p-3"), loc, F(0x1.23456p-3)); - test<"{:La}">(SV("1#23456p-2"), loc, F(0x1.23456p-2)); - test<"{:La}">(SV("1#23456p-1"), loc, F(0x1.23456p-1)); - test<"{:La}">(SV("1#23456p+0"), loc, F(0x1.23456p0)); - test<"{:La}">(SV("1#23456p+1"), loc, F(0x1.23456p+1)); - test<"{:La}">(SV("1#23456p+2"), loc, F(0x1.23456p+2)); - test<"{:La}">(SV("1#23456p+3"), loc, F(0x1.23456p+3)); - test<"{:La}">(SV("1#23456p+20"), loc, F(0x1.23456p+20)); + test(SV("1#23456p-3"), loc, SV("{:La}"), F(0x1.23456p-3)); + test(SV("1#23456p-2"), loc, SV("{:La}"), F(0x1.23456p-2)); + test(SV("1#23456p-1"), loc, SV("{:La}"), F(0x1.23456p-1)); + test(SV("1#23456p+0"), loc, SV("{:La}"), F(0x1.23456p0)); + test(SV("1#23456p+1"), loc, SV("{:La}"), F(0x1.23456p+1)); + test(SV("1#23456p+2"), loc, SV("{:La}"), F(0x1.23456p+2)); + test(SV("1#23456p+3"), loc, SV("{:La}"), F(0x1.23456p+3)); + test(SV("1#23456p+20"), loc, SV("{:La}"), F(0x1.23456p+20)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<13La}">(SV("1.23456p+3$$$"), F(0x1.23456p3)); - test<"{:$>13La}">(SV("$$$1.23456p+3"), F(0x1.23456p3)); - test<"{:$^13La}">(SV("$1.23456p+3$$"), F(0x1.23456p3)); - test<"{:013La}">(SV("0001.23456p+3"), F(0x1.23456p3)); - test<"{:$<14La}">(SV("-1.23456p+3$$$"), F(-0x1.23456p3)); - test<"{:$>14La}">(SV("$$$-1.23456p+3"), F(-0x1.23456p3)); - test<"{:$^14La}">(SV("$-1.23456p+3$$"), F(-0x1.23456p3)); - test<"{:014La}">(SV("-0001.23456p+3"), F(-0x1.23456p3)); + test(SV("1.23456p+3$$$"), SV("{:$<13La}"), F(0x1.23456p3)); + test(SV("$$$1.23456p+3"), SV("{:$>13La}"), F(0x1.23456p3)); + test(SV("$1.23456p+3$$"), SV("{:$^13La}"), F(0x1.23456p3)); + test(SV("0001.23456p+3"), SV("{:013La}"), F(0x1.23456p3)); + test(SV("-1.23456p+3$$$"), SV("{:$<14La}"), F(-0x1.23456p3)); + test(SV("$$$-1.23456p+3"), SV("{:$>14La}"), F(-0x1.23456p3)); + test(SV("$-1.23456p+3$$"), SV("{:$^14La}"), F(-0x1.23456p3)); + test(SV("-0001.23456p+3"), SV("{:014La}"), F(-0x1.23456p3)); std::locale::global(loc); - test<"{:$<13La}">(SV("1#23456p+3$$$"), F(0x1.23456p3)); - test<"{:$>13La}">(SV("$$$1#23456p+3"), F(0x1.23456p3)); - test<"{:$^13La}">(SV("$1#23456p+3$$"), F(0x1.23456p3)); - test<"{:013La}">(SV("0001#23456p+3"), F(0x1.23456p3)); - test<"{:$<14La}">(SV("-1#23456p+3$$$"), F(-0x1.23456p3)); - test<"{:$>14La}">(SV("$$$-1#23456p+3"), F(-0x1.23456p3)); - test<"{:$^14La}">(SV("$-1#23456p+3$$"), F(-0x1.23456p3)); - test<"{:014La}">(SV("-0001#23456p+3"), F(-0x1.23456p3)); - - test<"{:$<13La}">(SV("1.23456p+3$$$"), en_US, F(0x1.23456p3)); - test<"{:$>13La}">(SV("$$$1.23456p+3"), en_US, F(0x1.23456p3)); - test<"{:$^13La}">(SV("$1.23456p+3$$"), en_US, F(0x1.23456p3)); - test<"{:013La}">(SV("0001.23456p+3"), en_US, F(0x1.23456p3)); - test<"{:$<14La}">(SV("-1.23456p+3$$$"), en_US, F(-0x1.23456p3)); - test<"{:$>14La}">(SV("$$$-1.23456p+3"), en_US, F(-0x1.23456p3)); - test<"{:$^14La}">(SV("$-1.23456p+3$$"), en_US, F(-0x1.23456p3)); - test<"{:014La}">(SV("-0001.23456p+3"), en_US, F(-0x1.23456p3)); + test(SV("1#23456p+3$$$"), SV("{:$<13La}"), F(0x1.23456p3)); + test(SV("$$$1#23456p+3"), SV("{:$>13La}"), F(0x1.23456p3)); + test(SV("$1#23456p+3$$"), SV("{:$^13La}"), F(0x1.23456p3)); + test(SV("0001#23456p+3"), SV("{:013La}"), F(0x1.23456p3)); + test(SV("-1#23456p+3$$$"), SV("{:$<14La}"), F(-0x1.23456p3)); + test(SV("$$$-1#23456p+3"), SV("{:$>14La}"), F(-0x1.23456p3)); + test(SV("$-1#23456p+3$$"), SV("{:$^14La}"), F(-0x1.23456p3)); + test(SV("-0001#23456p+3"), SV("{:014La}"), F(-0x1.23456p3)); + + test(SV("1.23456p+3$$$"), en_US, SV("{:$<13La}"), F(0x1.23456p3)); + test(SV("$$$1.23456p+3"), en_US, SV("{:$>13La}"), F(0x1.23456p3)); + test(SV("$1.23456p+3$$"), en_US, SV("{:$^13La}"), F(0x1.23456p3)); + test(SV("0001.23456p+3"), en_US, SV("{:013La}"), F(0x1.23456p3)); + test(SV("-1.23456p+3$$$"), en_US, SV("{:$<14La}"), F(-0x1.23456p3)); + test(SV("$$$-1.23456p+3"), en_US, SV("{:$>14La}"), F(-0x1.23456p3)); + test(SV("$-1.23456p+3$$"), en_US, SV("{:$^14La}"), F(-0x1.23456p3)); + test(SV("-0001.23456p+3"), en_US, SV("{:014La}"), F(-0x1.23456p3)); std::locale::global(en_US); - test<"{:$<13La}">(SV("1#23456p+3$$$"), loc, F(0x1.23456p3)); - test<"{:$>13La}">(SV("$$$1#23456p+3"), loc, F(0x1.23456p3)); - test<"{:$^13La}">(SV("$1#23456p+3$$"), loc, F(0x1.23456p3)); - test<"{:013La}">(SV("0001#23456p+3"), loc, F(0x1.23456p3)); - test<"{:$<14La}">(SV("-1#23456p+3$$$"), loc, F(-0x1.23456p3)); - test<"{:$>14La}">(SV("$$$-1#23456p+3"), loc, F(-0x1.23456p3)); - test<"{:$^14La}">(SV("$-1#23456p+3$$"), loc, F(-0x1.23456p3)); - test<"{:014La}">(SV("-0001#23456p+3"), loc, F(-0x1.23456p3)); + test(SV("1#23456p+3$$$"), loc, SV("{:$<13La}"), F(0x1.23456p3)); + test(SV("$$$1#23456p+3"), loc, SV("{:$>13La}"), F(0x1.23456p3)); + test(SV("$1#23456p+3$$"), loc, SV("{:$^13La}"), F(0x1.23456p3)); + test(SV("0001#23456p+3"), loc, SV("{:013La}"), F(0x1.23456p3)); + test(SV("-1#23456p+3$$$"), loc, SV("{:$<14La}"), F(-0x1.23456p3)); + test(SV("$$$-1#23456p+3"), loc, SV("{:$>14La}"), F(-0x1.23456p3)); + test(SV("$-1#23456p+3$$"), loc, SV("{:$^14La}"), F(-0x1.23456p3)); + test(SV("-0001#23456p+3"), loc, SV("{:014La}"), F(-0x1.23456p3)); } template @@ -693,83 +692,83 @@ // *** Basic *** std::locale::global(en_US); - test<"{:LA}">(SV("1.23456P-3"), F(0x1.23456p-3)); - test<"{:LA}">(SV("1.23456P-2"), F(0x1.23456p-2)); - test<"{:LA}">(SV("1.23456P-1"), F(0x1.23456p-1)); - test<"{:LA}">(SV("1.23456P+0"), F(0x1.23456p0)); - test<"{:LA}">(SV("1.23456P+1"), F(0x1.23456p+1)); - test<"{:LA}">(SV("1.23456P+2"), F(0x1.23456p+2)); - test<"{:LA}">(SV("1.23456P+3"), F(0x1.23456p+3)); - test<"{:LA}">(SV("1.23456P+20"), F(0x1.23456p+20)); + test(SV("1.23456P-3"), SV("{:LA}"), F(0x1.23456p-3)); + test(SV("1.23456P-2"), SV("{:LA}"), F(0x1.23456p-2)); + test(SV("1.23456P-1"), SV("{:LA}"), F(0x1.23456p-1)); + test(SV("1.23456P+0"), SV("{:LA}"), F(0x1.23456p0)); + test(SV("1.23456P+1"), SV("{:LA}"), F(0x1.23456p+1)); + test(SV("1.23456P+2"), SV("{:LA}"), F(0x1.23456p+2)); + test(SV("1.23456P+3"), SV("{:LA}"), F(0x1.23456p+3)); + test(SV("1.23456P+20"), SV("{:LA}"), F(0x1.23456p+20)); std::locale::global(loc); - test<"{:LA}">(SV("1#23456P-3"), F(0x1.23456p-3)); - test<"{:LA}">(SV("1#23456P-2"), F(0x1.23456p-2)); - test<"{:LA}">(SV("1#23456P-1"), F(0x1.23456p-1)); - test<"{:LA}">(SV("1#23456P+0"), F(0x1.23456p0)); - test<"{:LA}">(SV("1#23456P+1"), F(0x1.23456p+1)); - test<"{:LA}">(SV("1#23456P+2"), F(0x1.23456p+2)); - test<"{:LA}">(SV("1#23456P+3"), F(0x1.23456p+3)); - test<"{:LA}">(SV("1#23456P+20"), F(0x1.23456p+20)); - - test<"{:LA}">(SV("1.23456P-3"), en_US, F(0x1.23456p-3)); - test<"{:LA}">(SV("1.23456P-2"), en_US, F(0x1.23456p-2)); - test<"{:LA}">(SV("1.23456P-1"), en_US, F(0x1.23456p-1)); - test<"{:LA}">(SV("1.23456P+0"), en_US, F(0x1.23456p0)); - test<"{:LA}">(SV("1.23456P+1"), en_US, F(0x1.23456p+1)); - test<"{:LA}">(SV("1.23456P+2"), en_US, F(0x1.23456p+2)); - test<"{:LA}">(SV("1.23456P+3"), en_US, F(0x1.23456p+3)); - test<"{:LA}">(SV("1.23456P+20"), en_US, F(0x1.23456p+20)); + test(SV("1#23456P-3"), SV("{:LA}"), F(0x1.23456p-3)); + test(SV("1#23456P-2"), SV("{:LA}"), F(0x1.23456p-2)); + test(SV("1#23456P-1"), SV("{:LA}"), F(0x1.23456p-1)); + test(SV("1#23456P+0"), SV("{:LA}"), F(0x1.23456p0)); + test(SV("1#23456P+1"), SV("{:LA}"), F(0x1.23456p+1)); + test(SV("1#23456P+2"), SV("{:LA}"), F(0x1.23456p+2)); + test(SV("1#23456P+3"), SV("{:LA}"), F(0x1.23456p+3)); + test(SV("1#23456P+20"), SV("{:LA}"), F(0x1.23456p+20)); + + test(SV("1.23456P-3"), en_US, SV("{:LA}"), F(0x1.23456p-3)); + test(SV("1.23456P-2"), en_US, SV("{:LA}"), F(0x1.23456p-2)); + test(SV("1.23456P-1"), en_US, SV("{:LA}"), F(0x1.23456p-1)); + test(SV("1.23456P+0"), en_US, SV("{:LA}"), F(0x1.23456p0)); + test(SV("1.23456P+1"), en_US, SV("{:LA}"), F(0x1.23456p+1)); + test(SV("1.23456P+2"), en_US, SV("{:LA}"), F(0x1.23456p+2)); + test(SV("1.23456P+3"), en_US, SV("{:LA}"), F(0x1.23456p+3)); + test(SV("1.23456P+20"), en_US, SV("{:LA}"), F(0x1.23456p+20)); std::locale::global(en_US); - test<"{:LA}">(SV("1#23456P-3"), loc, F(0x1.23456p-3)); - test<"{:LA}">(SV("1#23456P-2"), loc, F(0x1.23456p-2)); - test<"{:LA}">(SV("1#23456P-1"), loc, F(0x1.23456p-1)); - test<"{:LA}">(SV("1#23456P+0"), loc, F(0x1.23456p0)); - test<"{:LA}">(SV("1#23456P+1"), loc, F(0x1.23456p+1)); - test<"{:LA}">(SV("1#23456P+2"), loc, F(0x1.23456p+2)); - test<"{:LA}">(SV("1#23456P+3"), loc, F(0x1.23456p+3)); - test<"{:LA}">(SV("1#23456P+20"), loc, F(0x1.23456p+20)); + test(SV("1#23456P-3"), loc, SV("{:LA}"), F(0x1.23456p-3)); + test(SV("1#23456P-2"), loc, SV("{:LA}"), F(0x1.23456p-2)); + test(SV("1#23456P-1"), loc, SV("{:LA}"), F(0x1.23456p-1)); + test(SV("1#23456P+0"), loc, SV("{:LA}"), F(0x1.23456p0)); + test(SV("1#23456P+1"), loc, SV("{:LA}"), F(0x1.23456p+1)); + test(SV("1#23456P+2"), loc, SV("{:LA}"), F(0x1.23456p+2)); + test(SV("1#23456P+3"), loc, SV("{:LA}"), F(0x1.23456p+3)); + test(SV("1#23456P+20"), loc, SV("{:LA}"), F(0x1.23456p+20)); // *** Fill, align, zero Padding *** std::locale::global(en_US); - test<"{:$<13LA}">(SV("1.23456P+3$$$"), F(0x1.23456p3)); - test<"{:$>13LA}">(SV("$$$1.23456P+3"), F(0x1.23456p3)); - test<"{:$^13LA}">(SV("$1.23456P+3$$"), F(0x1.23456p3)); - test<"{:013LA}">(SV("0001.23456P+3"), F(0x1.23456p3)); - test<"{:$<14LA}">(SV("-1.23456P+3$$$"), F(-0x1.23456p3)); - test<"{:$>14LA}">(SV("$$$-1.23456P+3"), F(-0x1.23456p3)); - test<"{:$^14LA}">(SV("$-1.23456P+3$$"), F(-0x1.23456p3)); - test<"{:014LA}">(SV("-0001.23456P+3"), F(-0x1.23456p3)); + test(SV("1.23456P+3$$$"), SV("{:$<13LA}"), F(0x1.23456p3)); + test(SV("$$$1.23456P+3"), SV("{:$>13LA}"), F(0x1.23456p3)); + test(SV("$1.23456P+3$$"), SV("{:$^13LA}"), F(0x1.23456p3)); + test(SV("0001.23456P+3"), SV("{:013LA}"), F(0x1.23456p3)); + test(SV("-1.23456P+3$$$"), SV("{:$<14LA}"), F(-0x1.23456p3)); + test(SV("$$$-1.23456P+3"), SV("{:$>14LA}"), F(-0x1.23456p3)); + test(SV("$-1.23456P+3$$"), SV("{:$^14LA}"), F(-0x1.23456p3)); + test(SV("-0001.23456P+3"), SV("{:014LA}"), F(-0x1.23456p3)); std::locale::global(loc); - test<"{:$<13LA}">(SV("1#23456P+3$$$"), F(0x1.23456p3)); - test<"{:$>13LA}">(SV("$$$1#23456P+3"), F(0x1.23456p3)); - test<"{:$^13LA}">(SV("$1#23456P+3$$"), F(0x1.23456p3)); - test<"{:013LA}">(SV("0001#23456P+3"), F(0x1.23456p3)); - test<"{:$<14LA}">(SV("-1#23456P+3$$$"), F(-0x1.23456p3)); - test<"{:$>14LA}">(SV("$$$-1#23456P+3"), F(-0x1.23456p3)); - test<"{:$^14LA}">(SV("$-1#23456P+3$$"), F(-0x1.23456p3)); - test<"{:014LA}">(SV("-0001#23456P+3"), F(-0x1.23456p3)); - - test<"{:$<13LA}">(SV("1.23456P+3$$$"), en_US, F(0x1.23456p3)); - test<"{:$>13LA}">(SV("$$$1.23456P+3"), en_US, F(0x1.23456p3)); - test<"{:$^13LA}">(SV("$1.23456P+3$$"), en_US, F(0x1.23456p3)); - test<"{:013LA}">(SV("0001.23456P+3"), en_US, F(0x1.23456p3)); - test<"{:$<14LA}">(SV("-1.23456P+3$$$"), en_US, F(-0x1.23456p3)); - test<"{:$>14LA}">(SV("$$$-1.23456P+3"), en_US, F(-0x1.23456p3)); - test<"{:$^14LA}">(SV("$-1.23456P+3$$"), en_US, F(-0x1.23456p3)); - test<"{:014LA}">(SV("-0001.23456P+3"), en_US, F(-0x1.23456p3)); + test(SV("1#23456P+3$$$"), SV("{:$<13LA}"), F(0x1.23456p3)); + test(SV("$$$1#23456P+3"), SV("{:$>13LA}"), F(0x1.23456p3)); + test(SV("$1#23456P+3$$"), SV("{:$^13LA}"), F(0x1.23456p3)); + test(SV("0001#23456P+3"), SV("{:013LA}"), F(0x1.23456p3)); + test(SV("-1#23456P+3$$$"), SV("{:$<14LA}"), F(-0x1.23456p3)); + test(SV("$$$-1#23456P+3"), SV("{:$>14LA}"), F(-0x1.23456p3)); + test(SV("$-1#23456P+3$$"), SV("{:$^14LA}"), F(-0x1.23456p3)); + test(SV("-0001#23456P+3"), SV("{:014LA}"), F(-0x1.23456p3)); + + test(SV("1.23456P+3$$$"), en_US, SV("{:$<13LA}"), F(0x1.23456p3)); + test(SV("$$$1.23456P+3"), en_US, SV("{:$>13LA}"), F(0x1.23456p3)); + test(SV("$1.23456P+3$$"), en_US, SV("{:$^13LA}"), F(0x1.23456p3)); + test(SV("0001.23456P+3"), en_US, SV("{:013LA}"), F(0x1.23456p3)); + test(SV("-1.23456P+3$$$"), en_US, SV("{:$<14LA}"), F(-0x1.23456p3)); + test(SV("$$$-1.23456P+3"), en_US, SV("{:$>14LA}"), F(-0x1.23456p3)); + test(SV("$-1.23456P+3$$"), en_US, SV("{:$^14LA}"), F(-0x1.23456p3)); + test(SV("-0001.23456P+3"), en_US, SV("{:014LA}"), F(-0x1.23456p3)); std::locale::global(en_US); - test<"{:$<13LA}">(SV("1#23456P+3$$$"), loc, F(0x1.23456p3)); - test<"{:$>13LA}">(SV("$$$1#23456P+3"), loc, F(0x1.23456p3)); - test<"{:$^13LA}">(SV("$1#23456P+3$$"), loc, F(0x1.23456p3)); - test<"{:013LA}">(SV("0001#23456P+3"), loc, F(0x1.23456p3)); - test<"{:$<14LA}">(SV("-1#23456P+3$$$"), loc, F(-0x1.23456p3)); - test<"{:$>14LA}">(SV("$$$-1#23456P+3"), loc, F(-0x1.23456p3)); - test<"{:$^14LA}">(SV("$-1#23456P+3$$"), loc, F(-0x1.23456p3)); - test<"{:014LA}">(SV("-0001#23456P+3"), loc, F(-0x1.23456p3)); + test(SV("1#23456P+3$$$"), loc, SV("{:$<13LA}"), F(0x1.23456p3)); + test(SV("$$$1#23456P+3"), loc, SV("{:$>13LA}"), F(0x1.23456p3)); + test(SV("$1#23456P+3$$"), loc, SV("{:$^13LA}"), F(0x1.23456p3)); + test(SV("0001#23456P+3"), loc, SV("{:013LA}"), F(0x1.23456p3)); + test(SV("-1#23456P+3$$$"), loc, SV("{:$<14LA}"), F(-0x1.23456p3)); + test(SV("$$$-1#23456P+3"), loc, SV("{:$>14LA}"), F(-0x1.23456p3)); + test(SV("$-1#23456P+3$$"), loc, SV("{:$^14LA}"), F(-0x1.23456p3)); + test(SV("-0001#23456P+3"), loc, SV("{:014LA}"), F(-0x1.23456p3)); } template @@ -779,83 +778,83 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6La}">(SV("1.234560p-3"), F(0x1.23456p-3)); - test<"{:.6La}">(SV("1.234560p-2"), F(0x1.23456p-2)); - test<"{:.6La}">(SV("1.234560p-1"), F(0x1.23456p-1)); - test<"{:.6La}">(SV("1.234560p+0"), F(0x1.23456p0)); - test<"{:.6La}">(SV("1.234560p+1"), F(0x1.23456p+1)); - test<"{:.6La}">(SV("1.234560p+2"), F(0x1.23456p+2)); - test<"{:.6La}">(SV("1.234560p+3"), F(0x1.23456p+3)); - test<"{:.6La}">(SV("1.234560p+20"), F(0x1.23456p+20)); + test(SV("1.234560p-3"), SV("{:.6La}"), F(0x1.23456p-3)); + test(SV("1.234560p-2"), SV("{:.6La}"), F(0x1.23456p-2)); + test(SV("1.234560p-1"), SV("{:.6La}"), F(0x1.23456p-1)); + test(SV("1.234560p+0"), SV("{:.6La}"), F(0x1.23456p0)); + test(SV("1.234560p+1"), SV("{:.6La}"), F(0x1.23456p+1)); + test(SV("1.234560p+2"), SV("{:.6La}"), F(0x1.23456p+2)); + test(SV("1.234560p+3"), SV("{:.6La}"), F(0x1.23456p+3)); + test(SV("1.234560p+20"), SV("{:.6La}"), F(0x1.23456p+20)); std::locale::global(loc); - test<"{:.6La}">(SV("1#234560p-3"), F(0x1.23456p-3)); - test<"{:.6La}">(SV("1#234560p-2"), F(0x1.23456p-2)); - test<"{:.6La}">(SV("1#234560p-1"), F(0x1.23456p-1)); - test<"{:.6La}">(SV("1#234560p+0"), F(0x1.23456p0)); - test<"{:.6La}">(SV("1#234560p+1"), F(0x1.23456p+1)); - test<"{:.6La}">(SV("1#234560p+2"), F(0x1.23456p+2)); - test<"{:.6La}">(SV("1#234560p+3"), F(0x1.23456p+3)); - test<"{:.6La}">(SV("1#234560p+20"), F(0x1.23456p+20)); - - test<"{:.6La}">(SV("1.234560p-3"), en_US, F(0x1.23456p-3)); - test<"{:.6La}">(SV("1.234560p-2"), en_US, F(0x1.23456p-2)); - test<"{:.6La}">(SV("1.234560p-1"), en_US, F(0x1.23456p-1)); - test<"{:.6La}">(SV("1.234560p+0"), en_US, F(0x1.23456p0)); - test<"{:.6La}">(SV("1.234560p+1"), en_US, F(0x1.23456p+1)); - test<"{:.6La}">(SV("1.234560p+2"), en_US, F(0x1.23456p+2)); - test<"{:.6La}">(SV("1.234560p+3"), en_US, F(0x1.23456p+3)); - test<"{:.6La}">(SV("1.234560p+20"), en_US, F(0x1.23456p+20)); + test(SV("1#234560p-3"), SV("{:.6La}"), F(0x1.23456p-3)); + test(SV("1#234560p-2"), SV("{:.6La}"), F(0x1.23456p-2)); + test(SV("1#234560p-1"), SV("{:.6La}"), F(0x1.23456p-1)); + test(SV("1#234560p+0"), SV("{:.6La}"), F(0x1.23456p0)); + test(SV("1#234560p+1"), SV("{:.6La}"), F(0x1.23456p+1)); + test(SV("1#234560p+2"), SV("{:.6La}"), F(0x1.23456p+2)); + test(SV("1#234560p+3"), SV("{:.6La}"), F(0x1.23456p+3)); + test(SV("1#234560p+20"), SV("{:.6La}"), F(0x1.23456p+20)); + + test(SV("1.234560p-3"), en_US, SV("{:.6La}"), F(0x1.23456p-3)); + test(SV("1.234560p-2"), en_US, SV("{:.6La}"), F(0x1.23456p-2)); + test(SV("1.234560p-1"), en_US, SV("{:.6La}"), F(0x1.23456p-1)); + test(SV("1.234560p+0"), en_US, SV("{:.6La}"), F(0x1.23456p0)); + test(SV("1.234560p+1"), en_US, SV("{:.6La}"), F(0x1.23456p+1)); + test(SV("1.234560p+2"), en_US, SV("{:.6La}"), F(0x1.23456p+2)); + test(SV("1.234560p+3"), en_US, SV("{:.6La}"), F(0x1.23456p+3)); + test(SV("1.234560p+20"), en_US, SV("{:.6La}"), F(0x1.23456p+20)); std::locale::global(en_US); - test<"{:.6La}">(SV("1#234560p-3"), loc, F(0x1.23456p-3)); - test<"{:.6La}">(SV("1#234560p-2"), loc, F(0x1.23456p-2)); - test<"{:.6La}">(SV("1#234560p-1"), loc, F(0x1.23456p-1)); - test<"{:.6La}">(SV("1#234560p+0"), loc, F(0x1.23456p0)); - test<"{:.6La}">(SV("1#234560p+1"), loc, F(0x1.23456p+1)); - test<"{:.6La}">(SV("1#234560p+2"), loc, F(0x1.23456p+2)); - test<"{:.6La}">(SV("1#234560p+3"), loc, F(0x1.23456p+3)); - test<"{:.6La}">(SV("1#234560p+20"), loc, F(0x1.23456p+20)); + test(SV("1#234560p-3"), loc, SV("{:.6La}"), F(0x1.23456p-3)); + test(SV("1#234560p-2"), loc, SV("{:.6La}"), F(0x1.23456p-2)); + test(SV("1#234560p-1"), loc, SV("{:.6La}"), F(0x1.23456p-1)); + test(SV("1#234560p+0"), loc, SV("{:.6La}"), F(0x1.23456p0)); + test(SV("1#234560p+1"), loc, SV("{:.6La}"), F(0x1.23456p+1)); + test(SV("1#234560p+2"), loc, SV("{:.6La}"), F(0x1.23456p+2)); + test(SV("1#234560p+3"), loc, SV("{:.6La}"), F(0x1.23456p+3)); + test(SV("1#234560p+20"), loc, SV("{:.6La}"), F(0x1.23456p+20)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<14.6La}">(SV("1.234560p+3$$$"), F(0x1.23456p3)); - test<"{:$>14.6La}">(SV("$$$1.234560p+3"), F(0x1.23456p3)); - test<"{:$^14.6La}">(SV("$1.234560p+3$$"), F(0x1.23456p3)); - test<"{:014.6La}">(SV("0001.234560p+3"), F(0x1.23456p3)); - test<"{:$<15.6La}">(SV("-1.234560p+3$$$"), F(-0x1.23456p3)); - test<"{:$>15.6La}">(SV("$$$-1.234560p+3"), F(-0x1.23456p3)); - test<"{:$^15.6La}">(SV("$-1.234560p+3$$"), F(-0x1.23456p3)); - test<"{:015.6La}">(SV("-0001.234560p+3"), F(-0x1.23456p3)); + test(SV("1.234560p+3$$$"), SV("{:$<14.6La}"), F(0x1.23456p3)); + test(SV("$$$1.234560p+3"), SV("{:$>14.6La}"), F(0x1.23456p3)); + test(SV("$1.234560p+3$$"), SV("{:$^14.6La}"), F(0x1.23456p3)); + test(SV("0001.234560p+3"), SV("{:014.6La}"), F(0x1.23456p3)); + test(SV("-1.234560p+3$$$"), SV("{:$<15.6La}"), F(-0x1.23456p3)); + test(SV("$$$-1.234560p+3"), SV("{:$>15.6La}"), F(-0x1.23456p3)); + test(SV("$-1.234560p+3$$"), SV("{:$^15.6La}"), F(-0x1.23456p3)); + test(SV("-0001.234560p+3"), SV("{:015.6La}"), F(-0x1.23456p3)); std::locale::global(loc); - test<"{:$<14.6La}">(SV("1#234560p+3$$$"), F(0x1.23456p3)); - test<"{:$>14.6La}">(SV("$$$1#234560p+3"), F(0x1.23456p3)); - test<"{:$^14.6La}">(SV("$1#234560p+3$$"), F(0x1.23456p3)); - test<"{:014.6La}">(SV("0001#234560p+3"), F(0x1.23456p3)); - test<"{:$<15.6La}">(SV("-1#234560p+3$$$"), F(-0x1.23456p3)); - test<"{:$>15.6La}">(SV("$$$-1#234560p+3"), F(-0x1.23456p3)); - test<"{:$^15.6La}">(SV("$-1#234560p+3$$"), F(-0x1.23456p3)); - test<"{:015.6La}">(SV("-0001#234560p+3"), F(-0x1.23456p3)); - - test<"{:$<14.6La}">(SV("1.234560p+3$$$"), en_US, F(0x1.23456p3)); - test<"{:$>14.6La}">(SV("$$$1.234560p+3"), en_US, F(0x1.23456p3)); - test<"{:$^14.6La}">(SV("$1.234560p+3$$"), en_US, F(0x1.23456p3)); - test<"{:014.6La}">(SV("0001.234560p+3"), en_US, F(0x1.23456p3)); - test<"{:$<15.6La}">(SV("-1.234560p+3$$$"), en_US, F(-0x1.23456p3)); - test<"{:$>15.6La}">(SV("$$$-1.234560p+3"), en_US, F(-0x1.23456p3)); - test<"{:$^15.6La}">(SV("$-1.234560p+3$$"), en_US, F(-0x1.23456p3)); - test<"{:015.6La}">(SV("-0001.234560p+3"), en_US, F(-0x1.23456p3)); + test(SV("1#234560p+3$$$"), SV("{:$<14.6La}"), F(0x1.23456p3)); + test(SV("$$$1#234560p+3"), SV("{:$>14.6La}"), F(0x1.23456p3)); + test(SV("$1#234560p+3$$"), SV("{:$^14.6La}"), F(0x1.23456p3)); + test(SV("0001#234560p+3"), SV("{:014.6La}"), F(0x1.23456p3)); + test(SV("-1#234560p+3$$$"), SV("{:$<15.6La}"), F(-0x1.23456p3)); + test(SV("$$$-1#234560p+3"), SV("{:$>15.6La}"), F(-0x1.23456p3)); + test(SV("$-1#234560p+3$$"), SV("{:$^15.6La}"), F(-0x1.23456p3)); + test(SV("-0001#234560p+3"), SV("{:015.6La}"), F(-0x1.23456p3)); + + test(SV("1.234560p+3$$$"), en_US, SV("{:$<14.6La}"), F(0x1.23456p3)); + test(SV("$$$1.234560p+3"), en_US, SV("{:$>14.6La}"), F(0x1.23456p3)); + test(SV("$1.234560p+3$$"), en_US, SV("{:$^14.6La}"), F(0x1.23456p3)); + test(SV("0001.234560p+3"), en_US, SV("{:014.6La}"), F(0x1.23456p3)); + test(SV("-1.234560p+3$$$"), en_US, SV("{:$<15.6La}"), F(-0x1.23456p3)); + test(SV("$$$-1.234560p+3"), en_US, SV("{:$>15.6La}"), F(-0x1.23456p3)); + test(SV("$-1.234560p+3$$"), en_US, SV("{:$^15.6La}"), F(-0x1.23456p3)); + test(SV("-0001.234560p+3"), en_US, SV("{:015.6La}"), F(-0x1.23456p3)); std::locale::global(en_US); - test<"{:$<14.6La}">(SV("1#234560p+3$$$"), loc, F(0x1.23456p3)); - test<"{:$>14.6La}">(SV("$$$1#234560p+3"), loc, F(0x1.23456p3)); - test<"{:$^14.6La}">(SV("$1#234560p+3$$"), loc, F(0x1.23456p3)); - test<"{:014.6La}">(SV("0001#234560p+3"), loc, F(0x1.23456p3)); - test<"{:$<15.6La}">(SV("-1#234560p+3$$$"), loc, F(-0x1.23456p3)); - test<"{:$>15.6La}">(SV("$$$-1#234560p+3"), loc, F(-0x1.23456p3)); - test<"{:$^15.6La}">(SV("$-1#234560p+3$$"), loc, F(-0x1.23456p3)); - test<"{:015.6La}">(SV("-0001#234560p+3"), loc, F(-0x1.23456p3)); + test(SV("1#234560p+3$$$"), loc, SV("{:$<14.6La}"), F(0x1.23456p3)); + test(SV("$$$1#234560p+3"), loc, SV("{:$>14.6La}"), F(0x1.23456p3)); + test(SV("$1#234560p+3$$"), loc, SV("{:$^14.6La}"), F(0x1.23456p3)); + test(SV("0001#234560p+3"), loc, SV("{:014.6La}"), F(0x1.23456p3)); + test(SV("-1#234560p+3$$$"), loc, SV("{:$<15.6La}"), F(-0x1.23456p3)); + test(SV("$$$-1#234560p+3"), loc, SV("{:$>15.6La}"), F(-0x1.23456p3)); + test(SV("$-1#234560p+3$$"), loc, SV("{:$^15.6La}"), F(-0x1.23456p3)); + test(SV("-0001#234560p+3"), loc, SV("{:015.6La}"), F(-0x1.23456p3)); } template @@ -865,83 +864,83 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6LA}">(SV("1.234560P-3"), F(0x1.23456p-3)); - test<"{:.6LA}">(SV("1.234560P-2"), F(0x1.23456p-2)); - test<"{:.6LA}">(SV("1.234560P-1"), F(0x1.23456p-1)); - test<"{:.6LA}">(SV("1.234560P+0"), F(0x1.23456p0)); - test<"{:.6LA}">(SV("1.234560P+1"), F(0x1.23456p+1)); - test<"{:.6LA}">(SV("1.234560P+2"), F(0x1.23456p+2)); - test<"{:.6LA}">(SV("1.234560P+3"), F(0x1.23456p+3)); - test<"{:.6LA}">(SV("1.234560P+20"), F(0x1.23456p+20)); + test(SV("1.234560P-3"), SV("{:.6LA}"), F(0x1.23456p-3)); + test(SV("1.234560P-2"), SV("{:.6LA}"), F(0x1.23456p-2)); + test(SV("1.234560P-1"), SV("{:.6LA}"), F(0x1.23456p-1)); + test(SV("1.234560P+0"), SV("{:.6LA}"), F(0x1.23456p0)); + test(SV("1.234560P+1"), SV("{:.6LA}"), F(0x1.23456p+1)); + test(SV("1.234560P+2"), SV("{:.6LA}"), F(0x1.23456p+2)); + test(SV("1.234560P+3"), SV("{:.6LA}"), F(0x1.23456p+3)); + test(SV("1.234560P+20"), SV("{:.6LA}"), F(0x1.23456p+20)); std::locale::global(loc); - test<"{:.6LA}">(SV("1#234560P-3"), F(0x1.23456p-3)); - test<"{:.6LA}">(SV("1#234560P-2"), F(0x1.23456p-2)); - test<"{:.6LA}">(SV("1#234560P-1"), F(0x1.23456p-1)); - test<"{:.6LA}">(SV("1#234560P+0"), F(0x1.23456p0)); - test<"{:.6LA}">(SV("1#234560P+1"), F(0x1.23456p+1)); - test<"{:.6LA}">(SV("1#234560P+2"), F(0x1.23456p+2)); - test<"{:.6LA}">(SV("1#234560P+3"), F(0x1.23456p+3)); - test<"{:.6LA}">(SV("1#234560P+20"), F(0x1.23456p+20)); - - test<"{:.6LA}">(SV("1.234560P-3"), en_US, F(0x1.23456p-3)); - test<"{:.6LA}">(SV("1.234560P-2"), en_US, F(0x1.23456p-2)); - test<"{:.6LA}">(SV("1.234560P-1"), en_US, F(0x1.23456p-1)); - test<"{:.6LA}">(SV("1.234560P+0"), en_US, F(0x1.23456p0)); - test<"{:.6LA}">(SV("1.234560P+1"), en_US, F(0x1.23456p+1)); - test<"{:.6LA}">(SV("1.234560P+2"), en_US, F(0x1.23456p+2)); - test<"{:.6LA}">(SV("1.234560P+3"), en_US, F(0x1.23456p+3)); - test<"{:.6LA}">(SV("1.234560P+20"), en_US, F(0x1.23456p+20)); + test(SV("1#234560P-3"), SV("{:.6LA}"), F(0x1.23456p-3)); + test(SV("1#234560P-2"), SV("{:.6LA}"), F(0x1.23456p-2)); + test(SV("1#234560P-1"), SV("{:.6LA}"), F(0x1.23456p-1)); + test(SV("1#234560P+0"), SV("{:.6LA}"), F(0x1.23456p0)); + test(SV("1#234560P+1"), SV("{:.6LA}"), F(0x1.23456p+1)); + test(SV("1#234560P+2"), SV("{:.6LA}"), F(0x1.23456p+2)); + test(SV("1#234560P+3"), SV("{:.6LA}"), F(0x1.23456p+3)); + test(SV("1#234560P+20"), SV("{:.6LA}"), F(0x1.23456p+20)); + + test(SV("1.234560P-3"), en_US, SV("{:.6LA}"), F(0x1.23456p-3)); + test(SV("1.234560P-2"), en_US, SV("{:.6LA}"), F(0x1.23456p-2)); + test(SV("1.234560P-1"), en_US, SV("{:.6LA}"), F(0x1.23456p-1)); + test(SV("1.234560P+0"), en_US, SV("{:.6LA}"), F(0x1.23456p0)); + test(SV("1.234560P+1"), en_US, SV("{:.6LA}"), F(0x1.23456p+1)); + test(SV("1.234560P+2"), en_US, SV("{:.6LA}"), F(0x1.23456p+2)); + test(SV("1.234560P+3"), en_US, SV("{:.6LA}"), F(0x1.23456p+3)); + test(SV("1.234560P+20"), en_US, SV("{:.6LA}"), F(0x1.23456p+20)); std::locale::global(en_US); - test<"{:.6LA}">(SV("1#234560P-3"), loc, F(0x1.23456p-3)); - test<"{:.6LA}">(SV("1#234560P-2"), loc, F(0x1.23456p-2)); - test<"{:.6LA}">(SV("1#234560P-1"), loc, F(0x1.23456p-1)); - test<"{:.6LA}">(SV("1#234560P+0"), loc, F(0x1.23456p0)); - test<"{:.6LA}">(SV("1#234560P+1"), loc, F(0x1.23456p+1)); - test<"{:.6LA}">(SV("1#234560P+2"), loc, F(0x1.23456p+2)); - test<"{:.6LA}">(SV("1#234560P+3"), loc, F(0x1.23456p+3)); - test<"{:.6LA}">(SV("1#234560P+20"), loc, F(0x1.23456p+20)); + test(SV("1#234560P-3"), loc, SV("{:.6LA}"), F(0x1.23456p-3)); + test(SV("1#234560P-2"), loc, SV("{:.6LA}"), F(0x1.23456p-2)); + test(SV("1#234560P-1"), loc, SV("{:.6LA}"), F(0x1.23456p-1)); + test(SV("1#234560P+0"), loc, SV("{:.6LA}"), F(0x1.23456p0)); + test(SV("1#234560P+1"), loc, SV("{:.6LA}"), F(0x1.23456p+1)); + test(SV("1#234560P+2"), loc, SV("{:.6LA}"), F(0x1.23456p+2)); + test(SV("1#234560P+3"), loc, SV("{:.6LA}"), F(0x1.23456p+3)); + test(SV("1#234560P+20"), loc, SV("{:.6LA}"), F(0x1.23456p+20)); // *** Fill, align, zero Padding *** std::locale::global(en_US); - test<"{:$<14.6LA}">(SV("1.234560P+3$$$"), F(0x1.23456p3)); - test<"{:$>14.6LA}">(SV("$$$1.234560P+3"), F(0x1.23456p3)); - test<"{:$^14.6LA}">(SV("$1.234560P+3$$"), F(0x1.23456p3)); - test<"{:014.6LA}">(SV("0001.234560P+3"), F(0x1.23456p3)); - test<"{:$<15.6LA}">(SV("-1.234560P+3$$$"), F(-0x1.23456p3)); - test<"{:$>15.6LA}">(SV("$$$-1.234560P+3"), F(-0x1.23456p3)); - test<"{:$^15.6LA}">(SV("$-1.234560P+3$$"), F(-0x1.23456p3)); - test<"{:015.6LA}">(SV("-0001.234560P+3"), F(-0x1.23456p3)); + test(SV("1.234560P+3$$$"), SV("{:$<14.6LA}"), F(0x1.23456p3)); + test(SV("$$$1.234560P+3"), SV("{:$>14.6LA}"), F(0x1.23456p3)); + test(SV("$1.234560P+3$$"), SV("{:$^14.6LA}"), F(0x1.23456p3)); + test(SV("0001.234560P+3"), SV("{:014.6LA}"), F(0x1.23456p3)); + test(SV("-1.234560P+3$$$"), SV("{:$<15.6LA}"), F(-0x1.23456p3)); + test(SV("$$$-1.234560P+3"), SV("{:$>15.6LA}"), F(-0x1.23456p3)); + test(SV("$-1.234560P+3$$"), SV("{:$^15.6LA}"), F(-0x1.23456p3)); + test(SV("-0001.234560P+3"), SV("{:015.6LA}"), F(-0x1.23456p3)); std::locale::global(loc); - test<"{:$<14.6LA}">(SV("1#234560P+3$$$"), F(0x1.23456p3)); - test<"{:$>14.6LA}">(SV("$$$1#234560P+3"), F(0x1.23456p3)); - test<"{:$^14.6LA}">(SV("$1#234560P+3$$"), F(0x1.23456p3)); - test<"{:014.6LA}">(SV("0001#234560P+3"), F(0x1.23456p3)); - test<"{:$<15.6LA}">(SV("-1#234560P+3$$$"), F(-0x1.23456p3)); - test<"{:$>15.6LA}">(SV("$$$-1#234560P+3"), F(-0x1.23456p3)); - test<"{:$^15.6LA}">(SV("$-1#234560P+3$$"), F(-0x1.23456p3)); - test<"{:015.6LA}">(SV("-0001#234560P+3"), F(-0x1.23456p3)); - - test<"{:$<14.6LA}">(SV("1.234560P+3$$$"), en_US, F(0x1.23456p3)); - test<"{:$>14.6LA}">(SV("$$$1.234560P+3"), en_US, F(0x1.23456p3)); - test<"{:$^14.6LA}">(SV("$1.234560P+3$$"), en_US, F(0x1.23456p3)); - test<"{:014.6LA}">(SV("0001.234560P+3"), en_US, F(0x1.23456p3)); - test<"{:$<15.6LA}">(SV("-1.234560P+3$$$"), en_US, F(-0x1.23456p3)); - test<"{:$>15.6LA}">(SV("$$$-1.234560P+3"), en_US, F(-0x1.23456p3)); - test<"{:$^15.6LA}">(SV("$-1.234560P+3$$"), en_US, F(-0x1.23456p3)); - test<"{:015.6LA}">(SV("-0001.234560P+3"), en_US, F(-0x1.23456p3)); + test(SV("1#234560P+3$$$"), SV("{:$<14.6LA}"), F(0x1.23456p3)); + test(SV("$$$1#234560P+3"), SV("{:$>14.6LA}"), F(0x1.23456p3)); + test(SV("$1#234560P+3$$"), SV("{:$^14.6LA}"), F(0x1.23456p3)); + test(SV("0001#234560P+3"), SV("{:014.6LA}"), F(0x1.23456p3)); + test(SV("-1#234560P+3$$$"), SV("{:$<15.6LA}"), F(-0x1.23456p3)); + test(SV("$$$-1#234560P+3"), SV("{:$>15.6LA}"), F(-0x1.23456p3)); + test(SV("$-1#234560P+3$$"), SV("{:$^15.6LA}"), F(-0x1.23456p3)); + test(SV("-0001#234560P+3"), SV("{:015.6LA}"), F(-0x1.23456p3)); + + test(SV("1.234560P+3$$$"), en_US, SV("{:$<14.6LA}"), F(0x1.23456p3)); + test(SV("$$$1.234560P+3"), en_US, SV("{:$>14.6LA}"), F(0x1.23456p3)); + test(SV("$1.234560P+3$$"), en_US, SV("{:$^14.6LA}"), F(0x1.23456p3)); + test(SV("0001.234560P+3"), en_US, SV("{:014.6LA}"), F(0x1.23456p3)); + test(SV("-1.234560P+3$$$"), en_US, SV("{:$<15.6LA}"), F(-0x1.23456p3)); + test(SV("$$$-1.234560P+3"), en_US, SV("{:$>15.6LA}"), F(-0x1.23456p3)); + test(SV("$-1.234560P+3$$"), en_US, SV("{:$^15.6LA}"), F(-0x1.23456p3)); + test(SV("-0001.234560P+3"), en_US, SV("{:015.6LA}"), F(-0x1.23456p3)); std::locale::global(en_US); - test<"{:$<14.6LA}">(SV("1#234560P+3$$$"), loc, F(0x1.23456p3)); - test<"{:$>14.6LA}">(SV("$$$1#234560P+3"), loc, F(0x1.23456p3)); - test<"{:$^14.6LA}">(SV("$1#234560P+3$$"), loc, F(0x1.23456p3)); - test<"{:014.6LA}">(SV("0001#234560P+3"), loc, F(0x1.23456p3)); - test<"{:$<15.6LA}">(SV("-1#234560P+3$$$"), loc, F(-0x1.23456p3)); - test<"{:$>15.6LA}">(SV("$$$-1#234560P+3"), loc, F(-0x1.23456p3)); - test<"{:$^15.6LA}">(SV("$-1#234560P+3$$"), loc, F(-0x1.23456p3)); - test<"{:015.6LA}">(SV("-0001#234560P+3"), loc, F(-0x1.23456p3)); + test(SV("1#234560P+3$$$"), loc, SV("{:$<14.6LA}"), F(0x1.23456p3)); + test(SV("$$$1#234560P+3"), loc, SV("{:$>14.6LA}"), F(0x1.23456p3)); + test(SV("$1#234560P+3$$"), loc, SV("{:$^14.6LA}"), F(0x1.23456p3)); + test(SV("0001#234560P+3"), loc, SV("{:014.6LA}"), F(0x1.23456p3)); + test(SV("-1#234560P+3$$$"), loc, SV("{:$<15.6LA}"), F(-0x1.23456p3)); + test(SV("$$$-1#234560P+3"), loc, SV("{:$>15.6LA}"), F(-0x1.23456p3)); + test(SV("$-1#234560P+3$$"), loc, SV("{:$^15.6LA}"), F(-0x1.23456p3)); + test(SV("-0001#234560P+3"), loc, SV("{:015.6LA}"), F(-0x1.23456p3)); } template @@ -951,115 +950,115 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6Le}">(SV("1.234567e-03"), F(1.234567e-3)); - test<"{:.6Le}">(SV("1.234567e-02"), F(1.234567e-2)); - test<"{:.6Le}">(SV("1.234567e-01"), F(1.234567e-1)); - test<"{:.6Le}">(SV("1.234567e+00"), F(1.234567e0)); - test<"{:.6Le}">(SV("1.234567e+01"), F(1.234567e1)); - test<"{:.6Le}">(SV("1.234567e+02"), F(1.234567e2)); - test<"{:.6Le}">(SV("1.234567e+03"), F(1.234567e3)); - test<"{:.6Le}">(SV("1.234567e+20"), F(1.234567e20)); - test<"{:.6Le}">(SV("-1.234567e-03"), F(-1.234567e-3)); - test<"{:.6Le}">(SV("-1.234567e-02"), F(-1.234567e-2)); - test<"{:.6Le}">(SV("-1.234567e-01"), F(-1.234567e-1)); - test<"{:.6Le}">(SV("-1.234567e+00"), F(-1.234567e0)); - test<"{:.6Le}">(SV("-1.234567e+01"), F(-1.234567e1)); - test<"{:.6Le}">(SV("-1.234567e+02"), F(-1.234567e2)); - test<"{:.6Le}">(SV("-1.234567e+03"), F(-1.234567e3)); - test<"{:.6Le}">(SV("-1.234567e+20"), F(-1.234567e20)); + test(SV("1.234567e-03"), SV("{:.6Le}"), F(1.234567e-3)); + test(SV("1.234567e-02"), SV("{:.6Le}"), F(1.234567e-2)); + test(SV("1.234567e-01"), SV("{:.6Le}"), F(1.234567e-1)); + test(SV("1.234567e+00"), SV("{:.6Le}"), F(1.234567e0)); + test(SV("1.234567e+01"), SV("{:.6Le}"), F(1.234567e1)); + test(SV("1.234567e+02"), SV("{:.6Le}"), F(1.234567e2)); + test(SV("1.234567e+03"), SV("{:.6Le}"), F(1.234567e3)); + test(SV("1.234567e+20"), SV("{:.6Le}"), F(1.234567e20)); + test(SV("-1.234567e-03"), SV("{:.6Le}"), F(-1.234567e-3)); + test(SV("-1.234567e-02"), SV("{:.6Le}"), F(-1.234567e-2)); + test(SV("-1.234567e-01"), SV("{:.6Le}"), F(-1.234567e-1)); + test(SV("-1.234567e+00"), SV("{:.6Le}"), F(-1.234567e0)); + test(SV("-1.234567e+01"), SV("{:.6Le}"), F(-1.234567e1)); + test(SV("-1.234567e+02"), SV("{:.6Le}"), F(-1.234567e2)); + test(SV("-1.234567e+03"), SV("{:.6Le}"), F(-1.234567e3)); + test(SV("-1.234567e+20"), SV("{:.6Le}"), F(-1.234567e20)); std::locale::global(loc); - test<"{:.6Le}">(SV("1#234567e-03"), F(1.234567e-3)); - test<"{:.6Le}">(SV("1#234567e-02"), F(1.234567e-2)); - test<"{:.6Le}">(SV("1#234567e-01"), F(1.234567e-1)); - test<"{:.6Le}">(SV("1#234567e+00"), F(1.234567e0)); - test<"{:.6Le}">(SV("1#234567e+01"), F(1.234567e1)); - test<"{:.6Le}">(SV("1#234567e+02"), F(1.234567e2)); - test<"{:.6Le}">(SV("1#234567e+03"), F(1.234567e3)); - test<"{:.6Le}">(SV("1#234567e+20"), F(1.234567e20)); - test<"{:.6Le}">(SV("-1#234567e-03"), F(-1.234567e-3)); - test<"{:.6Le}">(SV("-1#234567e-02"), F(-1.234567e-2)); - test<"{:.6Le}">(SV("-1#234567e-01"), F(-1.234567e-1)); - test<"{:.6Le}">(SV("-1#234567e+00"), F(-1.234567e0)); - test<"{:.6Le}">(SV("-1#234567e+01"), F(-1.234567e1)); - test<"{:.6Le}">(SV("-1#234567e+02"), F(-1.234567e2)); - test<"{:.6Le}">(SV("-1#234567e+03"), F(-1.234567e3)); - test<"{:.6Le}">(SV("-1#234567e+20"), F(-1.234567e20)); - - test<"{:.6Le}">(SV("1.234567e-03"), en_US, F(1.234567e-3)); - test<"{:.6Le}">(SV("1.234567e-02"), en_US, F(1.234567e-2)); - test<"{:.6Le}">(SV("1.234567e-01"), en_US, F(1.234567e-1)); - test<"{:.6Le}">(SV("1.234567e+00"), en_US, F(1.234567e0)); - test<"{:.6Le}">(SV("1.234567e+01"), en_US, F(1.234567e1)); - test<"{:.6Le}">(SV("1.234567e+02"), en_US, F(1.234567e2)); - test<"{:.6Le}">(SV("1.234567e+03"), en_US, F(1.234567e3)); - test<"{:.6Le}">(SV("1.234567e+20"), en_US, F(1.234567e20)); - test<"{:.6Le}">(SV("-1.234567e-03"), en_US, F(-1.234567e-3)); - test<"{:.6Le}">(SV("-1.234567e-02"), en_US, F(-1.234567e-2)); - test<"{:.6Le}">(SV("-1.234567e-01"), en_US, F(-1.234567e-1)); - test<"{:.6Le}">(SV("-1.234567e+00"), en_US, F(-1.234567e0)); - test<"{:.6Le}">(SV("-1.234567e+01"), en_US, F(-1.234567e1)); - test<"{:.6Le}">(SV("-1.234567e+02"), en_US, F(-1.234567e2)); - test<"{:.6Le}">(SV("-1.234567e+03"), en_US, F(-1.234567e3)); - test<"{:.6Le}">(SV("-1.234567e+20"), en_US, F(-1.234567e20)); + test(SV("1#234567e-03"), SV("{:.6Le}"), F(1.234567e-3)); + test(SV("1#234567e-02"), SV("{:.6Le}"), F(1.234567e-2)); + test(SV("1#234567e-01"), SV("{:.6Le}"), F(1.234567e-1)); + test(SV("1#234567e+00"), SV("{:.6Le}"), F(1.234567e0)); + test(SV("1#234567e+01"), SV("{:.6Le}"), F(1.234567e1)); + test(SV("1#234567e+02"), SV("{:.6Le}"), F(1.234567e2)); + test(SV("1#234567e+03"), SV("{:.6Le}"), F(1.234567e3)); + test(SV("1#234567e+20"), SV("{:.6Le}"), F(1.234567e20)); + test(SV("-1#234567e-03"), SV("{:.6Le}"), F(-1.234567e-3)); + test(SV("-1#234567e-02"), SV("{:.6Le}"), F(-1.234567e-2)); + test(SV("-1#234567e-01"), SV("{:.6Le}"), F(-1.234567e-1)); + test(SV("-1#234567e+00"), SV("{:.6Le}"), F(-1.234567e0)); + test(SV("-1#234567e+01"), SV("{:.6Le}"), F(-1.234567e1)); + test(SV("-1#234567e+02"), SV("{:.6Le}"), F(-1.234567e2)); + test(SV("-1#234567e+03"), SV("{:.6Le}"), F(-1.234567e3)); + test(SV("-1#234567e+20"), SV("{:.6Le}"), F(-1.234567e20)); + + test(SV("1.234567e-03"), en_US, SV("{:.6Le}"), F(1.234567e-3)); + test(SV("1.234567e-02"), en_US, SV("{:.6Le}"), F(1.234567e-2)); + test(SV("1.234567e-01"), en_US, SV("{:.6Le}"), F(1.234567e-1)); + test(SV("1.234567e+00"), en_US, SV("{:.6Le}"), F(1.234567e0)); + test(SV("1.234567e+01"), en_US, SV("{:.6Le}"), F(1.234567e1)); + test(SV("1.234567e+02"), en_US, SV("{:.6Le}"), F(1.234567e2)); + test(SV("1.234567e+03"), en_US, SV("{:.6Le}"), F(1.234567e3)); + test(SV("1.234567e+20"), en_US, SV("{:.6Le}"), F(1.234567e20)); + test(SV("-1.234567e-03"), en_US, SV("{:.6Le}"), F(-1.234567e-3)); + test(SV("-1.234567e-02"), en_US, SV("{:.6Le}"), F(-1.234567e-2)); + test(SV("-1.234567e-01"), en_US, SV("{:.6Le}"), F(-1.234567e-1)); + test(SV("-1.234567e+00"), en_US, SV("{:.6Le}"), F(-1.234567e0)); + test(SV("-1.234567e+01"), en_US, SV("{:.6Le}"), F(-1.234567e1)); + test(SV("-1.234567e+02"), en_US, SV("{:.6Le}"), F(-1.234567e2)); + test(SV("-1.234567e+03"), en_US, SV("{:.6Le}"), F(-1.234567e3)); + test(SV("-1.234567e+20"), en_US, SV("{:.6Le}"), F(-1.234567e20)); std::locale::global(en_US); - test<"{:.6Le}">(SV("1#234567e-03"), loc, F(1.234567e-3)); - test<"{:.6Le}">(SV("1#234567e-02"), loc, F(1.234567e-2)); - test<"{:.6Le}">(SV("1#234567e-01"), loc, F(1.234567e-1)); - test<"{:.6Le}">(SV("1#234567e+00"), loc, F(1.234567e0)); - test<"{:.6Le}">(SV("1#234567e+01"), loc, F(1.234567e1)); - test<"{:.6Le}">(SV("1#234567e+02"), loc, F(1.234567e2)); - test<"{:.6Le}">(SV("1#234567e+03"), loc, F(1.234567e3)); - test<"{:.6Le}">(SV("1#234567e+20"), loc, F(1.234567e20)); - test<"{:.6Le}">(SV("-1#234567e-03"), loc, F(-1.234567e-3)); - test<"{:.6Le}">(SV("-1#234567e-02"), loc, F(-1.234567e-2)); - test<"{:.6Le}">(SV("-1#234567e-01"), loc, F(-1.234567e-1)); - test<"{:.6Le}">(SV("-1#234567e+00"), loc, F(-1.234567e0)); - test<"{:.6Le}">(SV("-1#234567e+01"), loc, F(-1.234567e1)); - test<"{:.6Le}">(SV("-1#234567e+02"), loc, F(-1.234567e2)); - test<"{:.6Le}">(SV("-1#234567e+03"), loc, F(-1.234567e3)); - test<"{:.6Le}">(SV("-1#234567e+20"), loc, F(-1.234567e20)); + test(SV("1#234567e-03"), loc, SV("{:.6Le}"), F(1.234567e-3)); + test(SV("1#234567e-02"), loc, SV("{:.6Le}"), F(1.234567e-2)); + test(SV("1#234567e-01"), loc, SV("{:.6Le}"), F(1.234567e-1)); + test(SV("1#234567e+00"), loc, SV("{:.6Le}"), F(1.234567e0)); + test(SV("1#234567e+01"), loc, SV("{:.6Le}"), F(1.234567e1)); + test(SV("1#234567e+02"), loc, SV("{:.6Le}"), F(1.234567e2)); + test(SV("1#234567e+03"), loc, SV("{:.6Le}"), F(1.234567e3)); + test(SV("1#234567e+20"), loc, SV("{:.6Le}"), F(1.234567e20)); + test(SV("-1#234567e-03"), loc, SV("{:.6Le}"), F(-1.234567e-3)); + test(SV("-1#234567e-02"), loc, SV("{:.6Le}"), F(-1.234567e-2)); + test(SV("-1#234567e-01"), loc, SV("{:.6Le}"), F(-1.234567e-1)); + test(SV("-1#234567e+00"), loc, SV("{:.6Le}"), F(-1.234567e0)); + test(SV("-1#234567e+01"), loc, SV("{:.6Le}"), F(-1.234567e1)); + test(SV("-1#234567e+02"), loc, SV("{:.6Le}"), F(-1.234567e2)); + test(SV("-1#234567e+03"), loc, SV("{:.6Le}"), F(-1.234567e3)); + test(SV("-1#234567e+20"), loc, SV("{:.6Le}"), F(-1.234567e20)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<15.6Le}">(SV("1.234567e+03$$$"), F(1.234567e3)); - test<"{:$>15.6Le}">(SV("$$$1.234567e+03"), F(1.234567e3)); - test<"{:$^15.6Le}">(SV("$1.234567e+03$$"), F(1.234567e3)); - test<"{:015.6Le}">(SV("0001.234567e+03"), F(1.234567e3)); - test<"{:$<16.6Le}">(SV("-1.234567e+03$$$"), F(-1.234567e3)); - test<"{:$>16.6Le}">(SV("$$$-1.234567e+03"), F(-1.234567e3)); - test<"{:$^16.6Le}">(SV("$-1.234567e+03$$"), F(-1.234567e3)); - test<"{:016.6Le}">(SV("-0001.234567e+03"), F(-1.234567e3)); + test(SV("1.234567e+03$$$"), SV("{:$<15.6Le}"), F(1.234567e3)); + test(SV("$$$1.234567e+03"), SV("{:$>15.6Le}"), F(1.234567e3)); + test(SV("$1.234567e+03$$"), SV("{:$^15.6Le}"), F(1.234567e3)); + test(SV("0001.234567e+03"), SV("{:015.6Le}"), F(1.234567e3)); + test(SV("-1.234567e+03$$$"), SV("{:$<16.6Le}"), F(-1.234567e3)); + test(SV("$$$-1.234567e+03"), SV("{:$>16.6Le}"), F(-1.234567e3)); + test(SV("$-1.234567e+03$$"), SV("{:$^16.6Le}"), F(-1.234567e3)); + test(SV("-0001.234567e+03"), SV("{:016.6Le}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<15.6Le}">(SV("1#234567e+03$$$"), F(1.234567e3)); - test<"{:$>15.6Le}">(SV("$$$1#234567e+03"), F(1.234567e3)); - test<"{:$^15.6Le}">(SV("$1#234567e+03$$"), F(1.234567e3)); - test<"{:015.6Le}">(SV("0001#234567e+03"), F(1.234567e3)); - test<"{:$<16.6Le}">(SV("-1#234567e+03$$$"), F(-1.234567e3)); - test<"{:$>16.6Le}">(SV("$$$-1#234567e+03"), F(-1.234567e3)); - test<"{:$^16.6Le}">(SV("$-1#234567e+03$$"), F(-1.234567e3)); - test<"{:016.6Le}">(SV("-0001#234567e+03"), F(-1.234567e3)); - - test<"{:$<15.6Le}">(SV("1.234567e+03$$$"), en_US, F(1.234567e3)); - test<"{:$>15.6Le}">(SV("$$$1.234567e+03"), en_US, F(1.234567e3)); - test<"{:$^15.6Le}">(SV("$1.234567e+03$$"), en_US, F(1.234567e3)); - test<"{:015.6Le}">(SV("0001.234567e+03"), en_US, F(1.234567e3)); - test<"{:$<16.6Le}">(SV("-1.234567e+03$$$"), en_US, F(-1.234567e3)); - test<"{:$>16.6Le}">(SV("$$$-1.234567e+03"), en_US, F(-1.234567e3)); - test<"{:$^16.6Le}">(SV("$-1.234567e+03$$"), en_US, F(-1.234567e3)); - test<"{:016.6Le}">(SV("-0001.234567e+03"), en_US, F(-1.234567e3)); + test(SV("1#234567e+03$$$"), SV("{:$<15.6Le}"), F(1.234567e3)); + test(SV("$$$1#234567e+03"), SV("{:$>15.6Le}"), F(1.234567e3)); + test(SV("$1#234567e+03$$"), SV("{:$^15.6Le}"), F(1.234567e3)); + test(SV("0001#234567e+03"), SV("{:015.6Le}"), F(1.234567e3)); + test(SV("-1#234567e+03$$$"), SV("{:$<16.6Le}"), F(-1.234567e3)); + test(SV("$$$-1#234567e+03"), SV("{:$>16.6Le}"), F(-1.234567e3)); + test(SV("$-1#234567e+03$$"), SV("{:$^16.6Le}"), F(-1.234567e3)); + test(SV("-0001#234567e+03"), SV("{:016.6Le}"), F(-1.234567e3)); + + test(SV("1.234567e+03$$$"), en_US, SV("{:$<15.6Le}"), F(1.234567e3)); + test(SV("$$$1.234567e+03"), en_US, SV("{:$>15.6Le}"), F(1.234567e3)); + test(SV("$1.234567e+03$$"), en_US, SV("{:$^15.6Le}"), F(1.234567e3)); + test(SV("0001.234567e+03"), en_US, SV("{:015.6Le}"), F(1.234567e3)); + test(SV("-1.234567e+03$$$"), en_US, SV("{:$<16.6Le}"), F(-1.234567e3)); + test(SV("$$$-1.234567e+03"), en_US, SV("{:$>16.6Le}"), F(-1.234567e3)); + test(SV("$-1.234567e+03$$"), en_US, SV("{:$^16.6Le}"), F(-1.234567e3)); + test(SV("-0001.234567e+03"), en_US, SV("{:016.6Le}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<15.6Le}">(SV("1#234567e+03$$$"), loc, F(1.234567e3)); - test<"{:$>15.6Le}">(SV("$$$1#234567e+03"), loc, F(1.234567e3)); - test<"{:$^15.6Le}">(SV("$1#234567e+03$$"), loc, F(1.234567e3)); - test<"{:015.6Le}">(SV("0001#234567e+03"), loc, F(1.234567e3)); - test<"{:$<16.6Le}">(SV("-1#234567e+03$$$"), loc, F(-1.234567e3)); - test<"{:$>16.6Le}">(SV("$$$-1#234567e+03"), loc, F(-1.234567e3)); - test<"{:$^16.6Le}">(SV("$-1#234567e+03$$"), loc, F(-1.234567e3)); - test<"{:016.6Le}">(SV("-0001#234567e+03"), loc, F(-1.234567e3)); + test(SV("1#234567e+03$$$"), loc, SV("{:$<15.6Le}"), F(1.234567e3)); + test(SV("$$$1#234567e+03"), loc, SV("{:$>15.6Le}"), F(1.234567e3)); + test(SV("$1#234567e+03$$"), loc, SV("{:$^15.6Le}"), F(1.234567e3)); + test(SV("0001#234567e+03"), loc, SV("{:015.6Le}"), F(1.234567e3)); + test(SV("-1#234567e+03$$$"), loc, SV("{:$<16.6Le}"), F(-1.234567e3)); + test(SV("$$$-1#234567e+03"), loc, SV("{:$>16.6Le}"), F(-1.234567e3)); + test(SV("$-1#234567e+03$$"), loc, SV("{:$^16.6Le}"), F(-1.234567e3)); + test(SV("-0001#234567e+03"), loc, SV("{:016.6Le}"), F(-1.234567e3)); } template @@ -1069,115 +1068,115 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6LE}">(SV("1.234567E-03"), F(1.234567e-3)); - test<"{:.6LE}">(SV("1.234567E-02"), F(1.234567e-2)); - test<"{:.6LE}">(SV("1.234567E-01"), F(1.234567e-1)); - test<"{:.6LE}">(SV("1.234567E+00"), F(1.234567e0)); - test<"{:.6LE}">(SV("1.234567E+01"), F(1.234567e1)); - test<"{:.6LE}">(SV("1.234567E+02"), F(1.234567e2)); - test<"{:.6LE}">(SV("1.234567E+03"), F(1.234567e3)); - test<"{:.6LE}">(SV("1.234567E+20"), F(1.234567e20)); - test<"{:.6LE}">(SV("-1.234567E-03"), F(-1.234567e-3)); - test<"{:.6LE}">(SV("-1.234567E-02"), F(-1.234567e-2)); - test<"{:.6LE}">(SV("-1.234567E-01"), F(-1.234567e-1)); - test<"{:.6LE}">(SV("-1.234567E+00"), F(-1.234567e0)); - test<"{:.6LE}">(SV("-1.234567E+01"), F(-1.234567e1)); - test<"{:.6LE}">(SV("-1.234567E+02"), F(-1.234567e2)); - test<"{:.6LE}">(SV("-1.234567E+03"), F(-1.234567e3)); - test<"{:.6LE}">(SV("-1.234567E+20"), F(-1.234567e20)); + test(SV("1.234567E-03"), SV("{:.6LE}"), F(1.234567e-3)); + test(SV("1.234567E-02"), SV("{:.6LE}"), F(1.234567e-2)); + test(SV("1.234567E-01"), SV("{:.6LE}"), F(1.234567e-1)); + test(SV("1.234567E+00"), SV("{:.6LE}"), F(1.234567e0)); + test(SV("1.234567E+01"), SV("{:.6LE}"), F(1.234567e1)); + test(SV("1.234567E+02"), SV("{:.6LE}"), F(1.234567e2)); + test(SV("1.234567E+03"), SV("{:.6LE}"), F(1.234567e3)); + test(SV("1.234567E+20"), SV("{:.6LE}"), F(1.234567e20)); + test(SV("-1.234567E-03"), SV("{:.6LE}"), F(-1.234567e-3)); + test(SV("-1.234567E-02"), SV("{:.6LE}"), F(-1.234567e-2)); + test(SV("-1.234567E-01"), SV("{:.6LE}"), F(-1.234567e-1)); + test(SV("-1.234567E+00"), SV("{:.6LE}"), F(-1.234567e0)); + test(SV("-1.234567E+01"), SV("{:.6LE}"), F(-1.234567e1)); + test(SV("-1.234567E+02"), SV("{:.6LE}"), F(-1.234567e2)); + test(SV("-1.234567E+03"), SV("{:.6LE}"), F(-1.234567e3)); + test(SV("-1.234567E+20"), SV("{:.6LE}"), F(-1.234567e20)); std::locale::global(loc); - test<"{:.6LE}">(SV("1#234567E-03"), F(1.234567e-3)); - test<"{:.6LE}">(SV("1#234567E-02"), F(1.234567e-2)); - test<"{:.6LE}">(SV("1#234567E-01"), F(1.234567e-1)); - test<"{:.6LE}">(SV("1#234567E+00"), F(1.234567e0)); - test<"{:.6LE}">(SV("1#234567E+01"), F(1.234567e1)); - test<"{:.6LE}">(SV("1#234567E+02"), F(1.234567e2)); - test<"{:.6LE}">(SV("1#234567E+03"), F(1.234567e3)); - test<"{:.6LE}">(SV("1#234567E+20"), F(1.234567e20)); - test<"{:.6LE}">(SV("-1#234567E-03"), F(-1.234567e-3)); - test<"{:.6LE}">(SV("-1#234567E-02"), F(-1.234567e-2)); - test<"{:.6LE}">(SV("-1#234567E-01"), F(-1.234567e-1)); - test<"{:.6LE}">(SV("-1#234567E+00"), F(-1.234567e0)); - test<"{:.6LE}">(SV("-1#234567E+01"), F(-1.234567e1)); - test<"{:.6LE}">(SV("-1#234567E+02"), F(-1.234567e2)); - test<"{:.6LE}">(SV("-1#234567E+03"), F(-1.234567e3)); - test<"{:.6LE}">(SV("-1#234567E+20"), F(-1.234567e20)); - - test<"{:.6LE}">(SV("1.234567E-03"), en_US, F(1.234567e-3)); - test<"{:.6LE}">(SV("1.234567E-02"), en_US, F(1.234567e-2)); - test<"{:.6LE}">(SV("1.234567E-01"), en_US, F(1.234567e-1)); - test<"{:.6LE}">(SV("1.234567E+00"), en_US, F(1.234567e0)); - test<"{:.6LE}">(SV("1.234567E+01"), en_US, F(1.234567e1)); - test<"{:.6LE}">(SV("1.234567E+02"), en_US, F(1.234567e2)); - test<"{:.6LE}">(SV("1.234567E+03"), en_US, F(1.234567e3)); - test<"{:.6LE}">(SV("1.234567E+20"), en_US, F(1.234567e20)); - test<"{:.6LE}">(SV("-1.234567E-03"), en_US, F(-1.234567e-3)); - test<"{:.6LE}">(SV("-1.234567E-02"), en_US, F(-1.234567e-2)); - test<"{:.6LE}">(SV("-1.234567E-01"), en_US, F(-1.234567e-1)); - test<"{:.6LE}">(SV("-1.234567E+00"), en_US, F(-1.234567e0)); - test<"{:.6LE}">(SV("-1.234567E+01"), en_US, F(-1.234567e1)); - test<"{:.6LE}">(SV("-1.234567E+02"), en_US, F(-1.234567e2)); - test<"{:.6LE}">(SV("-1.234567E+03"), en_US, F(-1.234567e3)); - test<"{:.6LE}">(SV("-1.234567E+20"), en_US, F(-1.234567e20)); + test(SV("1#234567E-03"), SV("{:.6LE}"), F(1.234567e-3)); + test(SV("1#234567E-02"), SV("{:.6LE}"), F(1.234567e-2)); + test(SV("1#234567E-01"), SV("{:.6LE}"), F(1.234567e-1)); + test(SV("1#234567E+00"), SV("{:.6LE}"), F(1.234567e0)); + test(SV("1#234567E+01"), SV("{:.6LE}"), F(1.234567e1)); + test(SV("1#234567E+02"), SV("{:.6LE}"), F(1.234567e2)); + test(SV("1#234567E+03"), SV("{:.6LE}"), F(1.234567e3)); + test(SV("1#234567E+20"), SV("{:.6LE}"), F(1.234567e20)); + test(SV("-1#234567E-03"), SV("{:.6LE}"), F(-1.234567e-3)); + test(SV("-1#234567E-02"), SV("{:.6LE}"), F(-1.234567e-2)); + test(SV("-1#234567E-01"), SV("{:.6LE}"), F(-1.234567e-1)); + test(SV("-1#234567E+00"), SV("{:.6LE}"), F(-1.234567e0)); + test(SV("-1#234567E+01"), SV("{:.6LE}"), F(-1.234567e1)); + test(SV("-1#234567E+02"), SV("{:.6LE}"), F(-1.234567e2)); + test(SV("-1#234567E+03"), SV("{:.6LE}"), F(-1.234567e3)); + test(SV("-1#234567E+20"), SV("{:.6LE}"), F(-1.234567e20)); + + test(SV("1.234567E-03"), en_US, SV("{:.6LE}"), F(1.234567e-3)); + test(SV("1.234567E-02"), en_US, SV("{:.6LE}"), F(1.234567e-2)); + test(SV("1.234567E-01"), en_US, SV("{:.6LE}"), F(1.234567e-1)); + test(SV("1.234567E+00"), en_US, SV("{:.6LE}"), F(1.234567e0)); + test(SV("1.234567E+01"), en_US, SV("{:.6LE}"), F(1.234567e1)); + test(SV("1.234567E+02"), en_US, SV("{:.6LE}"), F(1.234567e2)); + test(SV("1.234567E+03"), en_US, SV("{:.6LE}"), F(1.234567e3)); + test(SV("1.234567E+20"), en_US, SV("{:.6LE}"), F(1.234567e20)); + test(SV("-1.234567E-03"), en_US, SV("{:.6LE}"), F(-1.234567e-3)); + test(SV("-1.234567E-02"), en_US, SV("{:.6LE}"), F(-1.234567e-2)); + test(SV("-1.234567E-01"), en_US, SV("{:.6LE}"), F(-1.234567e-1)); + test(SV("-1.234567E+00"), en_US, SV("{:.6LE}"), F(-1.234567e0)); + test(SV("-1.234567E+01"), en_US, SV("{:.6LE}"), F(-1.234567e1)); + test(SV("-1.234567E+02"), en_US, SV("{:.6LE}"), F(-1.234567e2)); + test(SV("-1.234567E+03"), en_US, SV("{:.6LE}"), F(-1.234567e3)); + test(SV("-1.234567E+20"), en_US, SV("{:.6LE}"), F(-1.234567e20)); std::locale::global(en_US); - test<"{:.6LE}">(SV("1#234567E-03"), loc, F(1.234567e-3)); - test<"{:.6LE}">(SV("1#234567E-02"), loc, F(1.234567e-2)); - test<"{:.6LE}">(SV("1#234567E-01"), loc, F(1.234567e-1)); - test<"{:.6LE}">(SV("1#234567E+00"), loc, F(1.234567e0)); - test<"{:.6LE}">(SV("1#234567E+01"), loc, F(1.234567e1)); - test<"{:.6LE}">(SV("1#234567E+02"), loc, F(1.234567e2)); - test<"{:.6LE}">(SV("1#234567E+03"), loc, F(1.234567e3)); - test<"{:.6LE}">(SV("1#234567E+20"), loc, F(1.234567e20)); - test<"{:.6LE}">(SV("-1#234567E-03"), loc, F(-1.234567e-3)); - test<"{:.6LE}">(SV("-1#234567E-02"), loc, F(-1.234567e-2)); - test<"{:.6LE}">(SV("-1#234567E-01"), loc, F(-1.234567e-1)); - test<"{:.6LE}">(SV("-1#234567E+00"), loc, F(-1.234567e0)); - test<"{:.6LE}">(SV("-1#234567E+01"), loc, F(-1.234567e1)); - test<"{:.6LE}">(SV("-1#234567E+02"), loc, F(-1.234567e2)); - test<"{:.6LE}">(SV("-1#234567E+03"), loc, F(-1.234567e3)); - test<"{:.6LE}">(SV("-1#234567E+20"), loc, F(-1.234567e20)); + test(SV("1#234567E-03"), loc, SV("{:.6LE}"), F(1.234567e-3)); + test(SV("1#234567E-02"), loc, SV("{:.6LE}"), F(1.234567e-2)); + test(SV("1#234567E-01"), loc, SV("{:.6LE}"), F(1.234567e-1)); + test(SV("1#234567E+00"), loc, SV("{:.6LE}"), F(1.234567e0)); + test(SV("1#234567E+01"), loc, SV("{:.6LE}"), F(1.234567e1)); + test(SV("1#234567E+02"), loc, SV("{:.6LE}"), F(1.234567e2)); + test(SV("1#234567E+03"), loc, SV("{:.6LE}"), F(1.234567e3)); + test(SV("1#234567E+20"), loc, SV("{:.6LE}"), F(1.234567e20)); + test(SV("-1#234567E-03"), loc, SV("{:.6LE}"), F(-1.234567e-3)); + test(SV("-1#234567E-02"), loc, SV("{:.6LE}"), F(-1.234567e-2)); + test(SV("-1#234567E-01"), loc, SV("{:.6LE}"), F(-1.234567e-1)); + test(SV("-1#234567E+00"), loc, SV("{:.6LE}"), F(-1.234567e0)); + test(SV("-1#234567E+01"), loc, SV("{:.6LE}"), F(-1.234567e1)); + test(SV("-1#234567E+02"), loc, SV("{:.6LE}"), F(-1.234567e2)); + test(SV("-1#234567E+03"), loc, SV("{:.6LE}"), F(-1.234567e3)); + test(SV("-1#234567E+20"), loc, SV("{:.6LE}"), F(-1.234567e20)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<15.6LE}">(SV("1.234567E+03$$$"), F(1.234567e3)); - test<"{:$>15.6LE}">(SV("$$$1.234567E+03"), F(1.234567e3)); - test<"{:$^15.6LE}">(SV("$1.234567E+03$$"), F(1.234567e3)); - test<"{:015.6LE}">(SV("0001.234567E+03"), F(1.234567e3)); - test<"{:$<16.6LE}">(SV("-1.234567E+03$$$"), F(-1.234567e3)); - test<"{:$>16.6LE}">(SV("$$$-1.234567E+03"), F(-1.234567e3)); - test<"{:$^16.6LE}">(SV("$-1.234567E+03$$"), F(-1.234567e3)); - test<"{:016.6LE}">(SV("-0001.234567E+03"), F(-1.234567e3)); + test(SV("1.234567E+03$$$"), SV("{:$<15.6LE}"), F(1.234567e3)); + test(SV("$$$1.234567E+03"), SV("{:$>15.6LE}"), F(1.234567e3)); + test(SV("$1.234567E+03$$"), SV("{:$^15.6LE}"), F(1.234567e3)); + test(SV("0001.234567E+03"), SV("{:015.6LE}"), F(1.234567e3)); + test(SV("-1.234567E+03$$$"), SV("{:$<16.6LE}"), F(-1.234567e3)); + test(SV("$$$-1.234567E+03"), SV("{:$>16.6LE}"), F(-1.234567e3)); + test(SV("$-1.234567E+03$$"), SV("{:$^16.6LE}"), F(-1.234567e3)); + test(SV("-0001.234567E+03"), SV("{:016.6LE}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<15.6LE}">(SV("1#234567E+03$$$"), F(1.234567e3)); - test<"{:$>15.6LE}">(SV("$$$1#234567E+03"), F(1.234567e3)); - test<"{:$^15.6LE}">(SV("$1#234567E+03$$"), F(1.234567e3)); - test<"{:015.6LE}">(SV("0001#234567E+03"), F(1.234567e3)); - test<"{:$<16.6LE}">(SV("-1#234567E+03$$$"), F(-1.234567e3)); - test<"{:$>16.6LE}">(SV("$$$-1#234567E+03"), F(-1.234567e3)); - test<"{:$^16.6LE}">(SV("$-1#234567E+03$$"), F(-1.234567e3)); - test<"{:016.6LE}">(SV("-0001#234567E+03"), F(-1.234567e3)); - - test<"{:$<15.6LE}">(SV("1.234567E+03$$$"), en_US, F(1.234567e3)); - test<"{:$>15.6LE}">(SV("$$$1.234567E+03"), en_US, F(1.234567e3)); - test<"{:$^15.6LE}">(SV("$1.234567E+03$$"), en_US, F(1.234567e3)); - test<"{:015.6LE}">(SV("0001.234567E+03"), en_US, F(1.234567e3)); - test<"{:$<16.6LE}">(SV("-1.234567E+03$$$"), en_US, F(-1.234567e3)); - test<"{:$>16.6LE}">(SV("$$$-1.234567E+03"), en_US, F(-1.234567e3)); - test<"{:$^16.6LE}">(SV("$-1.234567E+03$$"), en_US, F(-1.234567e3)); - test<"{:016.6LE}">(SV("-0001.234567E+03"), en_US, F(-1.234567e3)); + test(SV("1#234567E+03$$$"), SV("{:$<15.6LE}"), F(1.234567e3)); + test(SV("$$$1#234567E+03"), SV("{:$>15.6LE}"), F(1.234567e3)); + test(SV("$1#234567E+03$$"), SV("{:$^15.6LE}"), F(1.234567e3)); + test(SV("0001#234567E+03"), SV("{:015.6LE}"), F(1.234567e3)); + test(SV("-1#234567E+03$$$"), SV("{:$<16.6LE}"), F(-1.234567e3)); + test(SV("$$$-1#234567E+03"), SV("{:$>16.6LE}"), F(-1.234567e3)); + test(SV("$-1#234567E+03$$"), SV("{:$^16.6LE}"), F(-1.234567e3)); + test(SV("-0001#234567E+03"), SV("{:016.6LE}"), F(-1.234567e3)); + + test(SV("1.234567E+03$$$"), en_US, SV("{:$<15.6LE}"), F(1.234567e3)); + test(SV("$$$1.234567E+03"), en_US, SV("{:$>15.6LE}"), F(1.234567e3)); + test(SV("$1.234567E+03$$"), en_US, SV("{:$^15.6LE}"), F(1.234567e3)); + test(SV("0001.234567E+03"), en_US, SV("{:015.6LE}"), F(1.234567e3)); + test(SV("-1.234567E+03$$$"), en_US, SV("{:$<16.6LE}"), F(-1.234567e3)); + test(SV("$$$-1.234567E+03"), en_US, SV("{:$>16.6LE}"), F(-1.234567e3)); + test(SV("$-1.234567E+03$$"), en_US, SV("{:$^16.6LE}"), F(-1.234567e3)); + test(SV("-0001.234567E+03"), en_US, SV("{:016.6LE}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<15.6LE}">(SV("1#234567E+03$$$"), loc, F(1.234567e3)); - test<"{:$>15.6LE}">(SV("$$$1#234567E+03"), loc, F(1.234567e3)); - test<"{:$^15.6LE}">(SV("$1#234567E+03$$"), loc, F(1.234567e3)); - test<"{:015.6LE}">(SV("0001#234567E+03"), loc, F(1.234567e3)); - test<"{:$<16.6LE}">(SV("-1#234567E+03$$$"), loc, F(-1.234567e3)); - test<"{:$>16.6LE}">(SV("$$$-1#234567E+03"), loc, F(-1.234567e3)); - test<"{:$^16.6LE}">(SV("$-1#234567E+03$$"), loc, F(-1.234567e3)); - test<"{:016.6LE}">(SV("-0001#234567E+03"), loc, F(-1.234567e3)); + test(SV("1#234567E+03$$$"), loc, SV("{:$<15.6LE}"), F(1.234567e3)); + test(SV("$$$1#234567E+03"), loc, SV("{:$>15.6LE}"), F(1.234567e3)); + test(SV("$1#234567E+03$$"), loc, SV("{:$^15.6LE}"), F(1.234567e3)); + test(SV("0001#234567E+03"), loc, SV("{:015.6LE}"), F(1.234567e3)); + test(SV("-1#234567E+03$$$"), loc, SV("{:$<16.6LE}"), F(-1.234567e3)); + test(SV("$$$-1#234567E+03"), loc, SV("{:$>16.6LE}"), F(-1.234567e3)); + test(SV("$-1#234567E+03$$"), loc, SV("{:$^16.6LE}"), F(-1.234567e3)); + test(SV("-0001#234567E+03"), loc, SV("{:016.6LE}"), F(-1.234567e3)); } template @@ -1187,188 +1186,188 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6Lf}">(SV("0.000001"), F(1.234567e-6)); - test<"{:.6Lf}">(SV("0.000012"), F(1.234567e-5)); - test<"{:.6Lf}">(SV("0.000123"), F(1.234567e-4)); - test<"{:.6Lf}">(SV("0.001235"), F(1.234567e-3)); - test<"{:.6Lf}">(SV("0.012346"), F(1.234567e-2)); - test<"{:.6Lf}">(SV("0.123457"), F(1.234567e-1)); - test<"{:.6Lf}">(SV("1.234567"), F(1.234567e0)); - test<"{:.6Lf}">(SV("12.345670"), F(1.234567e1)); + test(SV("0.000001"), SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0.000012"), SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0.000123"), SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0.001235"), SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0.012346"), SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0.123457"), SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1.234567"), SV("{:.6Lf}"), F(1.234567e0)); + test(SV("12.345670"), SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("123.456700"), F(1.234567e2)); - test<"{:.6Lf}">(SV("1,234.567000"), F(1.234567e3)); - test<"{:.6Lf}">(SV("12,345.670000"), F(1.234567e4)); - test<"{:.6Lf}">(SV("123,456.700000"), F(1.234567e5)); - test<"{:.6Lf}">(SV("1,234,567.000000"), F(1.234567e6)); - test<"{:.6Lf}">(SV("12,345,670.000000"), F(1.234567e7)); - test<"{:.6Lf}">(SV("123,456,700,000,000,000,000.000000"), F(1.234567e20)); + test(SV("123.456700"), SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1,234.567000"), SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12,345.670000"), SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123,456.700000"), SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1,234,567.000000"), SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12,345,670.000000"), SV("{:.6Lf}"), F(1.234567e7)); + test(SV("123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0.000001"), F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0.000012"), F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0.000123"), F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0.001235"), F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0.012346"), F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0.123457"), F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1.234567"), F(-1.234567e0)); - test<"{:.6Lf}">(SV("-12.345670"), F(-1.234567e1)); + test(SV("-0.000001"), SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0.000012"), SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0.000123"), SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0.001235"), SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0.012346"), SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0.123457"), SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1.234567"), SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-12.345670"), SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-123.456700"), F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1,234.567000"), F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12,345.670000"), F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123,456.700000"), F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1,234,567.000000"), F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12,345,670.000000"), F(-1.234567e7)); - test<"{:.6Lf}">(SV("-123,456,700,000,000,000,000.000000"), F(-1.234567e20)); + test(SV("-123.456700"), SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1,234.567000"), SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12,345.670000"), SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123,456.700000"), SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1,234,567.000000"), SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12,345,670.000000"), SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(-1.234567e20)); } std::locale::global(loc); - test<"{:.6Lf}">(SV("0#000001"), F(1.234567e-6)); - test<"{:.6Lf}">(SV("0#000012"), F(1.234567e-5)); - test<"{:.6Lf}">(SV("0#000123"), F(1.234567e-4)); - test<"{:.6Lf}">(SV("0#001235"), F(1.234567e-3)); - test<"{:.6Lf}">(SV("0#012346"), F(1.234567e-2)); - test<"{:.6Lf}">(SV("0#123457"), F(1.234567e-1)); - test<"{:.6Lf}">(SV("1#234567"), F(1.234567e0)); - test<"{:.6Lf}">(SV("1_2#345670"), F(1.234567e1)); + test(SV("0#000001"), SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0#000012"), SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0#000123"), SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0#001235"), SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0#012346"), SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0#123457"), SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1#234567"), SV("{:.6Lf}"), F(1.234567e0)); + test(SV("1_2#345670"), SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("12_3#456700"), F(1.234567e2)); - test<"{:.6Lf}">(SV("1_23_4#567000"), F(1.234567e3)); - test<"{:.6Lf}">(SV("12_34_5#670000"), F(1.234567e4)); - test<"{:.6Lf}">(SV("123_45_6#700000"), F(1.234567e5)); - test<"{:.6Lf}">(SV("1_234_56_7#000000"), F(1.234567e6)); - test<"{:.6Lf}">(SV("12_345_67_0#000000"), F(1.234567e7)); - test<"{:.6Lf}">(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), F(1.234567e20)); + test(SV("12_3#456700"), SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1_23_4#567000"), SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12_34_5#670000"), SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123_45_6#700000"), SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1_234_56_7#000000"), SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12_345_67_0#000000"), SV("{:.6Lf}"), F(1.234567e7)); + test(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0#000001"), F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0#000012"), F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0#000123"), F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0#001235"), F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0#012346"), F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0#123457"), F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1#234567"), F(-1.234567e0)); - test<"{:.6Lf}">(SV("-1_2#345670"), F(-1.234567e1)); + test(SV("-0#000001"), SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0#000012"), SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0#000123"), SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0#001235"), SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0#012346"), SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0#123457"), SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1#234567"), SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-1_2#345670"), SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-12_3#456700"), F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1_23_4#567000"), F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12_34_5#670000"), F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123_45_6#700000"), F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1_234_56_7#000000"), F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12_345_67_0#000000"), F(-1.234567e7)); - test<"{:.6Lf}">(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), F(-1.234567e20)); + test(SV("-12_3#456700"), SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1_23_4#567000"), SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12_34_5#670000"), SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123_45_6#700000"), SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1_234_56_7#000000"), SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12_345_67_0#000000"), SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), SV("{:.6Lf}"), F(-1.234567e20)); } - test<"{:.6Lf}">(SV("0.000001"), en_US, F(1.234567e-6)); - test<"{:.6Lf}">(SV("0.000012"), en_US, F(1.234567e-5)); - test<"{:.6Lf}">(SV("0.000123"), en_US, F(1.234567e-4)); - test<"{:.6Lf}">(SV("0.001235"), en_US, F(1.234567e-3)); - test<"{:.6Lf}">(SV("0.012346"), en_US, F(1.234567e-2)); - test<"{:.6Lf}">(SV("0.123457"), en_US, F(1.234567e-1)); - test<"{:.6Lf}">(SV("1.234567"), en_US, F(1.234567e0)); - test<"{:.6Lf}">(SV("12.345670"), en_US, F(1.234567e1)); + test(SV("0.000001"), en_US, SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0.000012"), en_US, SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0.000123"), en_US, SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0.001235"), en_US, SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0.012346"), en_US, SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0.123457"), en_US, SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1.234567"), en_US, SV("{:.6Lf}"), F(1.234567e0)); + test(SV("12.345670"), en_US, SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("123.456700"), en_US, F(1.234567e2)); - test<"{:.6Lf}">(SV("1,234.567000"), en_US, F(1.234567e3)); - test<"{:.6Lf}">(SV("12,345.670000"), en_US, F(1.234567e4)); - test<"{:.6Lf}">(SV("123,456.700000"), en_US, F(1.234567e5)); - test<"{:.6Lf}">(SV("1,234,567.000000"), en_US, F(1.234567e6)); - test<"{:.6Lf}">(SV("12,345,670.000000"), en_US, F(1.234567e7)); - test<"{:.6Lf}">(SV("123,456,700,000,000,000,000.000000"), en_US, F(1.234567e20)); + test(SV("123.456700"), en_US, SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1,234.567000"), en_US, SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12,345.670000"), en_US, SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123,456.700000"), en_US, SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1,234,567.000000"), en_US, SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12,345,670.000000"), en_US, SV("{:.6Lf}"), F(1.234567e7)); + test(SV("123,456,700,000,000,000,000.000000"), en_US, SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0.000001"), en_US, F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0.000012"), en_US, F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0.000123"), en_US, F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0.001235"), en_US, F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0.012346"), en_US, F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0.123457"), en_US, F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1.234567"), en_US, F(-1.234567e0)); - test<"{:.6Lf}">(SV("-12.345670"), en_US, F(-1.234567e1)); + test(SV("-0.000001"), en_US, SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0.000012"), en_US, SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0.000123"), en_US, SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0.001235"), en_US, SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0.012346"), en_US, SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0.123457"), en_US, SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1.234567"), en_US, SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-12.345670"), en_US, SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-123.456700"), en_US, F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1,234.567000"), en_US, F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12,345.670000"), en_US, F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123,456.700000"), en_US, F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1,234,567.000000"), en_US, F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12,345,670.000000"), en_US, F(-1.234567e7)); - test<"{:.6Lf}">(SV("-123,456,700,000,000,000,000.000000"), en_US, F(-1.234567e20)); + test(SV("-123.456700"), en_US, SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1,234.567000"), en_US, SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12,345.670000"), en_US, SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123,456.700000"), en_US, SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1,234,567.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12,345,670.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-123,456,700,000,000,000,000.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e20)); } std::locale::global(en_US); - test<"{:.6Lf}">(SV("0#000001"), loc, F(1.234567e-6)); - test<"{:.6Lf}">(SV("0#000012"), loc, F(1.234567e-5)); - test<"{:.6Lf}">(SV("0#000123"), loc, F(1.234567e-4)); - test<"{:.6Lf}">(SV("0#001235"), loc, F(1.234567e-3)); - test<"{:.6Lf}">(SV("0#012346"), loc, F(1.234567e-2)); - test<"{:.6Lf}">(SV("0#123457"), loc, F(1.234567e-1)); - test<"{:.6Lf}">(SV("1#234567"), loc, F(1.234567e0)); - test<"{:.6Lf}">(SV("1_2#345670"), loc, F(1.234567e1)); + test(SV("0#000001"), loc, SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0#000012"), loc, SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0#000123"), loc, SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0#001235"), loc, SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0#012346"), loc, SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0#123457"), loc, SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1#234567"), loc, SV("{:.6Lf}"), F(1.234567e0)); + test(SV("1_2#345670"), loc, SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("12_3#456700"), loc, F(1.234567e2)); - test<"{:.6Lf}">(SV("1_23_4#567000"), loc, F(1.234567e3)); - test<"{:.6Lf}">(SV("12_34_5#670000"), loc, F(1.234567e4)); - test<"{:.6Lf}">(SV("123_45_6#700000"), loc, F(1.234567e5)); - test<"{:.6Lf}">(SV("1_234_56_7#000000"), loc, F(1.234567e6)); - test<"{:.6Lf}">(SV("12_345_67_0#000000"), loc, F(1.234567e7)); - test<"{:.6Lf}">(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, F(1.234567e20)); + test(SV("12_3#456700"), loc, SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1_23_4#567000"), loc, SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12_34_5#670000"), loc, SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123_45_6#700000"), loc, SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1_234_56_7#000000"), loc, SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12_345_67_0#000000"), loc, SV("{:.6Lf}"), F(1.234567e7)); + test(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0#000001"), loc, F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0#000012"), loc, F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0#000123"), loc, F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0#001235"), loc, F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0#012346"), loc, F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0#123457"), loc, F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1#234567"), loc, F(-1.234567e0)); - test<"{:.6Lf}">(SV("-1_2#345670"), loc, F(-1.234567e1)); + test(SV("-0#000001"), loc, SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0#000012"), loc, SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0#000123"), loc, SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0#001235"), loc, SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0#012346"), loc, SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0#123457"), loc, SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1#234567"), loc, SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-1_2#345670"), loc, SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-12_3#456700"), loc, F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1_23_4#567000"), loc, F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12_34_5#670000"), loc, F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123_45_6#700000"), loc, F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1_234_56_7#000000"), loc, F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12_345_67_0#000000"), loc, F(-1.234567e7)); - test<"{:.6Lf}">(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, F(-1.234567e20)); + test(SV("-12_3#456700"), loc, SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1_23_4#567000"), loc, SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12_34_5#670000"), loc, SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123_45_6#700000"), loc, SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1_234_56_7#000000"), loc, SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12_345_67_0#000000"), loc, SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, SV("{:.6Lf}"), F(-1.234567e20)); } // *** Fill, align, zero padding *** if constexpr (sizeof(F) > sizeof(float)) { std::locale::global(en_US); - test<"{:$<15.6Lf}">(SV("1,234.567000$$$"), F(1.234567e3)); - test<"{:$>15.6Lf}">(SV("$$$1,234.567000"), F(1.234567e3)); - test<"{:$^15.6Lf}">(SV("$1,234.567000$$"), F(1.234567e3)); - test<"{:015.6Lf}">(SV("0001,234.567000"), F(1.234567e3)); - test<"{:$<16.6Lf}">(SV("-1,234.567000$$$"), F(-1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$-1,234.567000"), F(-1.234567e3)); - test<"{:$^16.6Lf}">(SV("$-1,234.567000$$"), F(-1.234567e3)); - test<"{:016.6Lf}">(SV("-0001,234.567000"), F(-1.234567e3)); + test(SV("1,234.567000$$$"), SV("{:$<15.6Lf}"), F(1.234567e3)); + test(SV("$$$1,234.567000"), SV("{:$>15.6Lf}"), F(1.234567e3)); + test(SV("$1,234.567000$$"), SV("{:$^15.6Lf}"), F(1.234567e3)); + test(SV("0001,234.567000"), SV("{:015.6Lf}"), F(1.234567e3)); + test(SV("-1,234.567000$$$"), SV("{:$<16.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1,234.567000"), SV("{:$>16.6Lf}"), F(-1.234567e3)); + test(SV("$-1,234.567000$$"), SV("{:$^16.6Lf}"), F(-1.234567e3)); + test(SV("-0001,234.567000"), SV("{:016.6Lf}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<16.6Lf}">(SV("1_23_4#567000$$$"), F(1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$1_23_4#567000"), F(1.234567e3)); - test<"{:$^16.6Lf}">(SV("$1_23_4#567000$$"), F(1.234567e3)); - test<"{:016.6Lf}">(SV("0001_23_4#567000"), F(1.234567e3)); - test<"{:$<17.6Lf}">(SV("-1_23_4#567000$$$"), F(-1.234567e3)); - test<"{:$>17.6Lf}">(SV("$$$-1_23_4#567000"), F(-1.234567e3)); - test<"{:$^17.6Lf}">(SV("$-1_23_4#567000$$"), F(-1.234567e3)); - test<"{:017.6Lf}">(SV("-0001_23_4#567000"), F(-1.234567e3)); - - test<"{:$<15.6Lf}">(SV("1,234.567000$$$"), en_US, F(1.234567e3)); - test<"{:$>15.6Lf}">(SV("$$$1,234.567000"), en_US, F(1.234567e3)); - test<"{:$^15.6Lf}">(SV("$1,234.567000$$"), en_US, F(1.234567e3)); - test<"{:015.6Lf}">(SV("0001,234.567000"), en_US, F(1.234567e3)); - test<"{:$<16.6Lf}">(SV("-1,234.567000$$$"), en_US, F(-1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$-1,234.567000"), en_US, F(-1.234567e3)); - test<"{:$^16.6Lf}">(SV("$-1,234.567000$$"), en_US, F(-1.234567e3)); - test<"{:016.6Lf}">(SV("-0001,234.567000"), en_US, F(-1.234567e3)); + test(SV("1_23_4#567000$$$"), SV("{:$<16.6Lf}"), F(1.234567e3)); + test(SV("$$$1_23_4#567000"), SV("{:$>16.6Lf}"), F(1.234567e3)); + test(SV("$1_23_4#567000$$"), SV("{:$^16.6Lf}"), F(1.234567e3)); + test(SV("0001_23_4#567000"), SV("{:016.6Lf}"), F(1.234567e3)); + test(SV("-1_23_4#567000$$$"), SV("{:$<17.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567000"), SV("{:$>17.6Lf}"), F(-1.234567e3)); + test(SV("$-1_23_4#567000$$"), SV("{:$^17.6Lf}"), F(-1.234567e3)); + test(SV("-0001_23_4#567000"), SV("{:017.6Lf}"), F(-1.234567e3)); + + test(SV("1,234.567000$$$"), en_US, SV("{:$<15.6Lf}"), F(1.234567e3)); + test(SV("$$$1,234.567000"), en_US, SV("{:$>15.6Lf}"), F(1.234567e3)); + test(SV("$1,234.567000$$"), en_US, SV("{:$^15.6Lf}"), F(1.234567e3)); + test(SV("0001,234.567000"), en_US, SV("{:015.6Lf}"), F(1.234567e3)); + test(SV("-1,234.567000$$$"), en_US, SV("{:$<16.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1,234.567000"), en_US, SV("{:$>16.6Lf}"), F(-1.234567e3)); + test(SV("$-1,234.567000$$"), en_US, SV("{:$^16.6Lf}"), F(-1.234567e3)); + test(SV("-0001,234.567000"), en_US, SV("{:016.6Lf}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<16.6Lf}">(SV("1_23_4#567000$$$"), loc, F(1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$1_23_4#567000"), loc, F(1.234567e3)); - test<"{:$^16.6Lf}">(SV("$1_23_4#567000$$"), loc, F(1.234567e3)); - test<"{:016.6Lf}">(SV("0001_23_4#567000"), loc, F(1.234567e3)); - test<"{:$<17.6Lf}">(SV("-1_23_4#567000$$$"), loc, F(-1.234567e3)); - test<"{:$>17.6Lf}">(SV("$$$-1_23_4#567000"), loc, F(-1.234567e3)); - test<"{:$^17.6Lf}">(SV("$-1_23_4#567000$$"), loc, F(-1.234567e3)); - test<"{:017.6Lf}">(SV("-0001_23_4#567000"), loc, F(-1.234567e3)); + test(SV("1_23_4#567000$$$"), loc, SV("{:$<16.6Lf}"), F(1.234567e3)); + test(SV("$$$1_23_4#567000"), loc, SV("{:$>16.6Lf}"), F(1.234567e3)); + test(SV("$1_23_4#567000$$"), loc, SV("{:$^16.6Lf}"), F(1.234567e3)); + test(SV("0001_23_4#567000"), loc, SV("{:016.6Lf}"), F(1.234567e3)); + test(SV("-1_23_4#567000$$$"), loc, SV("{:$<17.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567000"), loc, SV("{:$>17.6Lf}"), F(-1.234567e3)); + test(SV("$-1_23_4#567000$$"), loc, SV("{:$^17.6Lf}"), F(-1.234567e3)); + test(SV("-0001_23_4#567000"), loc, SV("{:017.6Lf}"), F(-1.234567e3)); } } @@ -1379,188 +1378,188 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6Lf}">(SV("0.000001"), F(1.234567e-6)); - test<"{:.6Lf}">(SV("0.000012"), F(1.234567e-5)); - test<"{:.6Lf}">(SV("0.000123"), F(1.234567e-4)); - test<"{:.6Lf}">(SV("0.001235"), F(1.234567e-3)); - test<"{:.6Lf}">(SV("0.012346"), F(1.234567e-2)); - test<"{:.6Lf}">(SV("0.123457"), F(1.234567e-1)); - test<"{:.6Lf}">(SV("1.234567"), F(1.234567e0)); - test<"{:.6Lf}">(SV("12.345670"), F(1.234567e1)); + test(SV("0.000001"), SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0.000012"), SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0.000123"), SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0.001235"), SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0.012346"), SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0.123457"), SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1.234567"), SV("{:.6Lf}"), F(1.234567e0)); + test(SV("12.345670"), SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("123.456700"), F(1.234567e2)); - test<"{:.6Lf}">(SV("1,234.567000"), F(1.234567e3)); - test<"{:.6Lf}">(SV("12,345.670000"), F(1.234567e4)); - test<"{:.6Lf}">(SV("123,456.700000"), F(1.234567e5)); - test<"{:.6Lf}">(SV("1,234,567.000000"), F(1.234567e6)); - test<"{:.6Lf}">(SV("12,345,670.000000"), F(1.234567e7)); - test<"{:.6Lf}">(SV("123,456,700,000,000,000,000.000000"), F(1.234567e20)); + test(SV("123.456700"), SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1,234.567000"), SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12,345.670000"), SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123,456.700000"), SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1,234,567.000000"), SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12,345,670.000000"), SV("{:.6Lf}"), F(1.234567e7)); + test(SV("123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0.000001"), F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0.000012"), F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0.000123"), F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0.001235"), F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0.012346"), F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0.123457"), F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1.234567"), F(-1.234567e0)); - test<"{:.6Lf}">(SV("-12.345670"), F(-1.234567e1)); + test(SV("-0.000001"), SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0.000012"), SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0.000123"), SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0.001235"), SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0.012346"), SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0.123457"), SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1.234567"), SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-12.345670"), SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-123.456700"), F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1,234.567000"), F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12,345.670000"), F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123,456.700000"), F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1,234,567.000000"), F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12,345,670.000000"), F(-1.234567e7)); - test<"{:.6Lf}">(SV("-123,456,700,000,000,000,000.000000"), F(-1.234567e20)); + test(SV("-123.456700"), SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1,234.567000"), SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12,345.670000"), SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123,456.700000"), SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1,234,567.000000"), SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12,345,670.000000"), SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(-1.234567e20)); } std::locale::global(loc); - test<"{:.6Lf}">(SV("0#000001"), F(1.234567e-6)); - test<"{:.6Lf}">(SV("0#000012"), F(1.234567e-5)); - test<"{:.6Lf}">(SV("0#000123"), F(1.234567e-4)); - test<"{:.6Lf}">(SV("0#001235"), F(1.234567e-3)); - test<"{:.6Lf}">(SV("0#012346"), F(1.234567e-2)); - test<"{:.6Lf}">(SV("0#123457"), F(1.234567e-1)); - test<"{:.6Lf}">(SV("1#234567"), F(1.234567e0)); - test<"{:.6Lf}">(SV("1_2#345670"), F(1.234567e1)); + test(SV("0#000001"), SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0#000012"), SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0#000123"), SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0#001235"), SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0#012346"), SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0#123457"), SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1#234567"), SV("{:.6Lf}"), F(1.234567e0)); + test(SV("1_2#345670"), SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("12_3#456700"), F(1.234567e2)); - test<"{:.6Lf}">(SV("1_23_4#567000"), F(1.234567e3)); - test<"{:.6Lf}">(SV("12_34_5#670000"), F(1.234567e4)); - test<"{:.6Lf}">(SV("123_45_6#700000"), F(1.234567e5)); - test<"{:.6Lf}">(SV("1_234_56_7#000000"), F(1.234567e6)); - test<"{:.6Lf}">(SV("12_345_67_0#000000"), F(1.234567e7)); - test<"{:.6Lf}">(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), F(1.234567e20)); + test(SV("12_3#456700"), SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1_23_4#567000"), SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12_34_5#670000"), SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123_45_6#700000"), SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1_234_56_7#000000"), SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12_345_67_0#000000"), SV("{:.6Lf}"), F(1.234567e7)); + test(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0#000001"), F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0#000012"), F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0#000123"), F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0#001235"), F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0#012346"), F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0#123457"), F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1#234567"), F(-1.234567e0)); - test<"{:.6Lf}">(SV("-1_2#345670"), F(-1.234567e1)); + test(SV("-0#000001"), SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0#000012"), SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0#000123"), SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0#001235"), SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0#012346"), SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0#123457"), SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1#234567"), SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-1_2#345670"), SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-12_3#456700"), F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1_23_4#567000"), F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12_34_5#670000"), F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123_45_6#700000"), F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1_234_56_7#000000"), F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12_345_67_0#000000"), F(-1.234567e7)); - test<"{:.6Lf}">(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), F(-1.234567e20)); + test(SV("-12_3#456700"), SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1_23_4#567000"), SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12_34_5#670000"), SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123_45_6#700000"), SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1_234_56_7#000000"), SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12_345_67_0#000000"), SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), SV("{:.6Lf}"), F(-1.234567e20)); } - test<"{:.6Lf}">(SV("0.000001"), en_US, F(1.234567e-6)); - test<"{:.6Lf}">(SV("0.000012"), en_US, F(1.234567e-5)); - test<"{:.6Lf}">(SV("0.000123"), en_US, F(1.234567e-4)); - test<"{:.6Lf}">(SV("0.001235"), en_US, F(1.234567e-3)); - test<"{:.6Lf}">(SV("0.012346"), en_US, F(1.234567e-2)); - test<"{:.6Lf}">(SV("0.123457"), en_US, F(1.234567e-1)); - test<"{:.6Lf}">(SV("1.234567"), en_US, F(1.234567e0)); - test<"{:.6Lf}">(SV("12.345670"), en_US, F(1.234567e1)); + test(SV("0.000001"), en_US, SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0.000012"), en_US, SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0.000123"), en_US, SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0.001235"), en_US, SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0.012346"), en_US, SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0.123457"), en_US, SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1.234567"), en_US, SV("{:.6Lf}"), F(1.234567e0)); + test(SV("12.345670"), en_US, SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("123.456700"), en_US, F(1.234567e2)); - test<"{:.6Lf}">(SV("1,234.567000"), en_US, F(1.234567e3)); - test<"{:.6Lf}">(SV("12,345.670000"), en_US, F(1.234567e4)); - test<"{:.6Lf}">(SV("123,456.700000"), en_US, F(1.234567e5)); - test<"{:.6Lf}">(SV("1,234,567.000000"), en_US, F(1.234567e6)); - test<"{:.6Lf}">(SV("12,345,670.000000"), en_US, F(1.234567e7)); - test<"{:.6Lf}">(SV("123,456,700,000,000,000,000.000000"), en_US, F(1.234567e20)); + test(SV("123.456700"), en_US, SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1,234.567000"), en_US, SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12,345.670000"), en_US, SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123,456.700000"), en_US, SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1,234,567.000000"), en_US, SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12,345,670.000000"), en_US, SV("{:.6Lf}"), F(1.234567e7)); + test(SV("123,456,700,000,000,000,000.000000"), en_US, SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0.000001"), en_US, F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0.000012"), en_US, F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0.000123"), en_US, F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0.001235"), en_US, F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0.012346"), en_US, F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0.123457"), en_US, F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1.234567"), en_US, F(-1.234567e0)); - test<"{:.6Lf}">(SV("-12.345670"), en_US, F(-1.234567e1)); + test(SV("-0.000001"), en_US, SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0.000012"), en_US, SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0.000123"), en_US, SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0.001235"), en_US, SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0.012346"), en_US, SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0.123457"), en_US, SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1.234567"), en_US, SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-12.345670"), en_US, SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-123.456700"), en_US, F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1,234.567000"), en_US, F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12,345.670000"), en_US, F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123,456.700000"), en_US, F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1,234,567.000000"), en_US, F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12,345,670.000000"), en_US, F(-1.234567e7)); - test<"{:.6Lf}">(SV("-123,456,700,000,000,000,000.000000"), en_US, F(-1.234567e20)); + test(SV("-123.456700"), en_US, SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1,234.567000"), en_US, SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12,345.670000"), en_US, SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123,456.700000"), en_US, SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1,234,567.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12,345,670.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-123,456,700,000,000,000,000.000000"), en_US, SV("{:.6Lf}"), F(-1.234567e20)); } std::locale::global(en_US); - test<"{:.6Lf}">(SV("0#000001"), loc, F(1.234567e-6)); - test<"{:.6Lf}">(SV("0#000012"), loc, F(1.234567e-5)); - test<"{:.6Lf}">(SV("0#000123"), loc, F(1.234567e-4)); - test<"{:.6Lf}">(SV("0#001235"), loc, F(1.234567e-3)); - test<"{:.6Lf}">(SV("0#012346"), loc, F(1.234567e-2)); - test<"{:.6Lf}">(SV("0#123457"), loc, F(1.234567e-1)); - test<"{:.6Lf}">(SV("1#234567"), loc, F(1.234567e0)); - test<"{:.6Lf}">(SV("1_2#345670"), loc, F(1.234567e1)); + test(SV("0#000001"), loc, SV("{:.6Lf}"), F(1.234567e-6)); + test(SV("0#000012"), loc, SV("{:.6Lf}"), F(1.234567e-5)); + test(SV("0#000123"), loc, SV("{:.6Lf}"), F(1.234567e-4)); + test(SV("0#001235"), loc, SV("{:.6Lf}"), F(1.234567e-3)); + test(SV("0#012346"), loc, SV("{:.6Lf}"), F(1.234567e-2)); + test(SV("0#123457"), loc, SV("{:.6Lf}"), F(1.234567e-1)); + test(SV("1#234567"), loc, SV("{:.6Lf}"), F(1.234567e0)); + test(SV("1_2#345670"), loc, SV("{:.6Lf}"), F(1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("12_3#456700"), loc, F(1.234567e2)); - test<"{:.6Lf}">(SV("1_23_4#567000"), loc, F(1.234567e3)); - test<"{:.6Lf}">(SV("12_34_5#670000"), loc, F(1.234567e4)); - test<"{:.6Lf}">(SV("123_45_6#700000"), loc, F(1.234567e5)); - test<"{:.6Lf}">(SV("1_234_56_7#000000"), loc, F(1.234567e6)); - test<"{:.6Lf}">(SV("12_345_67_0#000000"), loc, F(1.234567e7)); - test<"{:.6Lf}">(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, F(1.234567e20)); + test(SV("12_3#456700"), loc, SV("{:.6Lf}"), F(1.234567e2)); + test(SV("1_23_4#567000"), loc, SV("{:.6Lf}"), F(1.234567e3)); + test(SV("12_34_5#670000"), loc, SV("{:.6Lf}"), F(1.234567e4)); + test(SV("123_45_6#700000"), loc, SV("{:.6Lf}"), F(1.234567e5)); + test(SV("1_234_56_7#000000"), loc, SV("{:.6Lf}"), F(1.234567e6)); + test(SV("12_345_67_0#000000"), loc, SV("{:.6Lf}"), F(1.234567e7)); + test(SV("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, SV("{:.6Lf}"), F(1.234567e20)); } - test<"{:.6Lf}">(SV("-0#000001"), loc, F(-1.234567e-6)); - test<"{:.6Lf}">(SV("-0#000012"), loc, F(-1.234567e-5)); - test<"{:.6Lf}">(SV("-0#000123"), loc, F(-1.234567e-4)); - test<"{:.6Lf}">(SV("-0#001235"), loc, F(-1.234567e-3)); - test<"{:.6Lf}">(SV("-0#012346"), loc, F(-1.234567e-2)); - test<"{:.6Lf}">(SV("-0#123457"), loc, F(-1.234567e-1)); - test<"{:.6Lf}">(SV("-1#234567"), loc, F(-1.234567e0)); - test<"{:.6Lf}">(SV("-1_2#345670"), loc, F(-1.234567e1)); + test(SV("-0#000001"), loc, SV("{:.6Lf}"), F(-1.234567e-6)); + test(SV("-0#000012"), loc, SV("{:.6Lf}"), F(-1.234567e-5)); + test(SV("-0#000123"), loc, SV("{:.6Lf}"), F(-1.234567e-4)); + test(SV("-0#001235"), loc, SV("{:.6Lf}"), F(-1.234567e-3)); + test(SV("-0#012346"), loc, SV("{:.6Lf}"), F(-1.234567e-2)); + test(SV("-0#123457"), loc, SV("{:.6Lf}"), F(-1.234567e-1)); + test(SV("-1#234567"), loc, SV("{:.6Lf}"), F(-1.234567e0)); + test(SV("-1_2#345670"), loc, SV("{:.6Lf}"), F(-1.234567e1)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:.6Lf}">(SV("-12_3#456700"), loc, F(-1.234567e2)); - test<"{:.6Lf}">(SV("-1_23_4#567000"), loc, F(-1.234567e3)); - test<"{:.6Lf}">(SV("-12_34_5#670000"), loc, F(-1.234567e4)); - test<"{:.6Lf}">(SV("-123_45_6#700000"), loc, F(-1.234567e5)); - test<"{:.6Lf}">(SV("-1_234_56_7#000000"), loc, F(-1.234567e6)); - test<"{:.6Lf}">(SV("-12_345_67_0#000000"), loc, F(-1.234567e7)); - test<"{:.6Lf}">(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, F(-1.234567e20)); + test(SV("-12_3#456700"), loc, SV("{:.6Lf}"), F(-1.234567e2)); + test(SV("-1_23_4#567000"), loc, SV("{:.6Lf}"), F(-1.234567e3)); + test(SV("-12_34_5#670000"), loc, SV("{:.6Lf}"), F(-1.234567e4)); + test(SV("-123_45_6#700000"), loc, SV("{:.6Lf}"), F(-1.234567e5)); + test(SV("-1_234_56_7#000000"), loc, SV("{:.6Lf}"), F(-1.234567e6)); + test(SV("-12_345_67_0#000000"), loc, SV("{:.6Lf}"), F(-1.234567e7)); + test(SV("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, SV("{:.6Lf}"), F(-1.234567e20)); } // *** Fill, align, zero padding *** if constexpr (sizeof(F) > sizeof(float)) { std::locale::global(en_US); - test<"{:$<15.6Lf}">(SV("1,234.567000$$$"), F(1.234567e3)); - test<"{:$>15.6Lf}">(SV("$$$1,234.567000"), F(1.234567e3)); - test<"{:$^15.6Lf}">(SV("$1,234.567000$$"), F(1.234567e3)); - test<"{:015.6Lf}">(SV("0001,234.567000"), F(1.234567e3)); - test<"{:$<16.6Lf}">(SV("-1,234.567000$$$"), F(-1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$-1,234.567000"), F(-1.234567e3)); - test<"{:$^16.6Lf}">(SV("$-1,234.567000$$"), F(-1.234567e3)); - test<"{:016.6Lf}">(SV("-0001,234.567000"), F(-1.234567e3)); + test(SV("1,234.567000$$$"), SV("{:$<15.6Lf}"), F(1.234567e3)); + test(SV("$$$1,234.567000"), SV("{:$>15.6Lf}"), F(1.234567e3)); + test(SV("$1,234.567000$$"), SV("{:$^15.6Lf}"), F(1.234567e3)); + test(SV("0001,234.567000"), SV("{:015.6Lf}"), F(1.234567e3)); + test(SV("-1,234.567000$$$"), SV("{:$<16.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1,234.567000"), SV("{:$>16.6Lf}"), F(-1.234567e3)); + test(SV("$-1,234.567000$$"), SV("{:$^16.6Lf}"), F(-1.234567e3)); + test(SV("-0001,234.567000"), SV("{:016.6Lf}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<16.6Lf}">(SV("1_23_4#567000$$$"), F(1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$1_23_4#567000"), F(1.234567e3)); - test<"{:$^16.6Lf}">(SV("$1_23_4#567000$$"), F(1.234567e3)); - test<"{:016.6Lf}">(SV("0001_23_4#567000"), F(1.234567e3)); - test<"{:$<17.6Lf}">(SV("-1_23_4#567000$$$"), F(-1.234567e3)); - test<"{:$>17.6Lf}">(SV("$$$-1_23_4#567000"), F(-1.234567e3)); - test<"{:$^17.6Lf}">(SV("$-1_23_4#567000$$"), F(-1.234567e3)); - test<"{:017.6Lf}">(SV("-0001_23_4#567000"), F(-1.234567e3)); - - test<"{:$<15.6Lf}">(SV("1,234.567000$$$"), en_US, F(1.234567e3)); - test<"{:$>15.6Lf}">(SV("$$$1,234.567000"), en_US, F(1.234567e3)); - test<"{:$^15.6Lf}">(SV("$1,234.567000$$"), en_US, F(1.234567e3)); - test<"{:015.6Lf}">(SV("0001,234.567000"), en_US, F(1.234567e3)); - test<"{:$<16.6Lf}">(SV("-1,234.567000$$$"), en_US, F(-1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$-1,234.567000"), en_US, F(-1.234567e3)); - test<"{:$^16.6Lf}">(SV("$-1,234.567000$$"), en_US, F(-1.234567e3)); - test<"{:016.6Lf}">(SV("-0001,234.567000"), en_US, F(-1.234567e3)); + test(SV("1_23_4#567000$$$"), SV("{:$<16.6Lf}"), F(1.234567e3)); + test(SV("$$$1_23_4#567000"), SV("{:$>16.6Lf}"), F(1.234567e3)); + test(SV("$1_23_4#567000$$"), SV("{:$^16.6Lf}"), F(1.234567e3)); + test(SV("0001_23_4#567000"), SV("{:016.6Lf}"), F(1.234567e3)); + test(SV("-1_23_4#567000$$$"), SV("{:$<17.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567000"), SV("{:$>17.6Lf}"), F(-1.234567e3)); + test(SV("$-1_23_4#567000$$"), SV("{:$^17.6Lf}"), F(-1.234567e3)); + test(SV("-0001_23_4#567000"), SV("{:017.6Lf}"), F(-1.234567e3)); + + test(SV("1,234.567000$$$"), en_US, SV("{:$<15.6Lf}"), F(1.234567e3)); + test(SV("$$$1,234.567000"), en_US, SV("{:$>15.6Lf}"), F(1.234567e3)); + test(SV("$1,234.567000$$"), en_US, SV("{:$^15.6Lf}"), F(1.234567e3)); + test(SV("0001,234.567000"), en_US, SV("{:015.6Lf}"), F(1.234567e3)); + test(SV("-1,234.567000$$$"), en_US, SV("{:$<16.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1,234.567000"), en_US, SV("{:$>16.6Lf}"), F(-1.234567e3)); + test(SV("$-1,234.567000$$"), en_US, SV("{:$^16.6Lf}"), F(-1.234567e3)); + test(SV("-0001,234.567000"), en_US, SV("{:016.6Lf}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<16.6Lf}">(SV("1_23_4#567000$$$"), loc, F(1.234567e3)); - test<"{:$>16.6Lf}">(SV("$$$1_23_4#567000"), loc, F(1.234567e3)); - test<"{:$^16.6Lf}">(SV("$1_23_4#567000$$"), loc, F(1.234567e3)); - test<"{:016.6Lf}">(SV("0001_23_4#567000"), loc, F(1.234567e3)); - test<"{:$<17.6Lf}">(SV("-1_23_4#567000$$$"), loc, F(-1.234567e3)); - test<"{:$>17.6Lf}">(SV("$$$-1_23_4#567000"), loc, F(-1.234567e3)); - test<"{:$^17.6Lf}">(SV("$-1_23_4#567000$$"), loc, F(-1.234567e3)); - test<"{:017.6Lf}">(SV("-0001_23_4#567000"), loc, F(-1.234567e3)); + test(SV("1_23_4#567000$$$"), loc, SV("{:$<16.6Lf}"), F(1.234567e3)); + test(SV("$$$1_23_4#567000"), loc, SV("{:$>16.6Lf}"), F(1.234567e3)); + test(SV("$1_23_4#567000$$"), loc, SV("{:$^16.6Lf}"), F(1.234567e3)); + test(SV("0001_23_4#567000"), loc, SV("{:016.6Lf}"), F(1.234567e3)); + test(SV("-1_23_4#567000$$$"), loc, SV("{:$<17.6Lf}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567000"), loc, SV("{:$>17.6Lf}"), F(-1.234567e3)); + test(SV("$-1_23_4#567000$$"), loc, SV("{:$^17.6Lf}"), F(-1.234567e3)); + test(SV("-0001_23_4#567000"), loc, SV("{:017.6Lf}"), F(-1.234567e3)); } } @@ -1571,163 +1570,163 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6Lg}">(SV("1.23457e-06"), F(1.234567e-6)); - test<"{:.6Lg}">(SV("1.23457e-05"), F(1.234567e-5)); - test<"{:.6Lg}">(SV("0.000123457"), F(1.234567e-4)); - test<"{:.6Lg}">(SV("0.00123457"), F(1.234567e-3)); - test<"{:.6Lg}">(SV("0.0123457"), F(1.234567e-2)); - test<"{:.6Lg}">(SV("0.123457"), F(1.234567e-1)); - test<"{:.6Lg}">(SV("1.23457"), F(1.234567e0)); - test<"{:.6Lg}">(SV("12.3457"), F(1.234567e1)); - test<"{:.6Lg}">(SV("123.457"), F(1.234567e2)); - test<"{:.6Lg}">(SV("1,234.57"), F(1.234567e3)); - test<"{:.6Lg}">(SV("12,345.7"), F(1.234567e4)); - test<"{:.6Lg}">(SV("123,457"), F(1.234567e5)); - test<"{:.6Lg}">(SV("1.23457e+06"), F(1.234567e6)); - test<"{:.6Lg}">(SV("1.23457e+07"), F(1.234567e7)); - test<"{:.6Lg}">(SV("-1.23457e-06"), F(-1.234567e-6)); - test<"{:.6Lg}">(SV("-1.23457e-05"), F(-1.234567e-5)); - test<"{:.6Lg}">(SV("-0.000123457"), F(-1.234567e-4)); - test<"{:.6Lg}">(SV("-0.00123457"), F(-1.234567e-3)); - test<"{:.6Lg}">(SV("-0.0123457"), F(-1.234567e-2)); - test<"{:.6Lg}">(SV("-0.123457"), F(-1.234567e-1)); - test<"{:.6Lg}">(SV("-1.23457"), F(-1.234567e0)); - test<"{:.6Lg}">(SV("-12.3457"), F(-1.234567e1)); - test<"{:.6Lg}">(SV("-123.457"), F(-1.234567e2)); - test<"{:.6Lg}">(SV("-1,234.57"), F(-1.234567e3)); - test<"{:.6Lg}">(SV("-12,345.7"), F(-1.234567e4)); - test<"{:.6Lg}">(SV("-123,457"), F(-1.234567e5)); - test<"{:.6Lg}">(SV("-1.23457e+06"), F(-1.234567e6)); - test<"{:.6Lg}">(SV("-1.23457e+07"), F(-1.234567e7)); + test(SV("1.23457e-06"), SV("{:.6Lg}"), F(1.234567e-6)); + test(SV("1.23457e-05"), SV("{:.6Lg}"), F(1.234567e-5)); + test(SV("0.000123457"), SV("{:.6Lg}"), F(1.234567e-4)); + test(SV("0.00123457"), SV("{:.6Lg}"), F(1.234567e-3)); + test(SV("0.0123457"), SV("{:.6Lg}"), F(1.234567e-2)); + test(SV("0.123457"), SV("{:.6Lg}"), F(1.234567e-1)); + test(SV("1.23457"), SV("{:.6Lg}"), F(1.234567e0)); + test(SV("12.3457"), SV("{:.6Lg}"), F(1.234567e1)); + test(SV("123.457"), SV("{:.6Lg}"), F(1.234567e2)); + test(SV("1,234.57"), SV("{:.6Lg}"), F(1.234567e3)); + test(SV("12,345.7"), SV("{:.6Lg}"), F(1.234567e4)); + test(SV("123,457"), SV("{:.6Lg}"), F(1.234567e5)); + test(SV("1.23457e+06"), SV("{:.6Lg}"), F(1.234567e6)); + test(SV("1.23457e+07"), SV("{:.6Lg}"), F(1.234567e7)); + test(SV("-1.23457e-06"), SV("{:.6Lg}"), F(-1.234567e-6)); + test(SV("-1.23457e-05"), SV("{:.6Lg}"), F(-1.234567e-5)); + test(SV("-0.000123457"), SV("{:.6Lg}"), F(-1.234567e-4)); + test(SV("-0.00123457"), SV("{:.6Lg}"), F(-1.234567e-3)); + test(SV("-0.0123457"), SV("{:.6Lg}"), F(-1.234567e-2)); + test(SV("-0.123457"), SV("{:.6Lg}"), F(-1.234567e-1)); + test(SV("-1.23457"), SV("{:.6Lg}"), F(-1.234567e0)); + test(SV("-12.3457"), SV("{:.6Lg}"), F(-1.234567e1)); + test(SV("-123.457"), SV("{:.6Lg}"), F(-1.234567e2)); + test(SV("-1,234.57"), SV("{:.6Lg}"), F(-1.234567e3)); + test(SV("-12,345.7"), SV("{:.6Lg}"), F(-1.234567e4)); + test(SV("-123,457"), SV("{:.6Lg}"), F(-1.234567e5)); + test(SV("-1.23457e+06"), SV("{:.6Lg}"), F(-1.234567e6)); + test(SV("-1.23457e+07"), SV("{:.6Lg}"), F(-1.234567e7)); std::locale::global(loc); - test<"{:.6Lg}">(SV("1#23457e-06"), F(1.234567e-6)); - test<"{:.6Lg}">(SV("1#23457e-05"), F(1.234567e-5)); - test<"{:.6Lg}">(SV("0#000123457"), F(1.234567e-4)); - test<"{:.6Lg}">(SV("0#00123457"), F(1.234567e-3)); - test<"{:.6Lg}">(SV("0#0123457"), F(1.234567e-2)); - test<"{:.6Lg}">(SV("0#123457"), F(1.234567e-1)); - test<"{:.6Lg}">(SV("1#23457"), F(1.234567e0)); - test<"{:.6Lg}">(SV("1_2#3457"), F(1.234567e1)); - test<"{:.6Lg}">(SV("12_3#457"), F(1.234567e2)); - test<"{:.6Lg}">(SV("1_23_4#57"), F(1.234567e3)); - test<"{:.6Lg}">(SV("12_34_5#7"), F(1.234567e4)); - test<"{:.6Lg}">(SV("123_45_7"), F(1.234567e5)); - test<"{:.6Lg}">(SV("1#23457e+06"), F(1.234567e6)); - test<"{:.6Lg}">(SV("1#23457e+07"), F(1.234567e7)); - test<"{:.6Lg}">(SV("-1#23457e-06"), F(-1.234567e-6)); - test<"{:.6Lg}">(SV("-1#23457e-05"), F(-1.234567e-5)); - test<"{:.6Lg}">(SV("-0#000123457"), F(-1.234567e-4)); - test<"{:.6Lg}">(SV("-0#00123457"), F(-1.234567e-3)); - test<"{:.6Lg}">(SV("-0#0123457"), F(-1.234567e-2)); - test<"{:.6Lg}">(SV("-0#123457"), F(-1.234567e-1)); - test<"{:.6Lg}">(SV("-1#23457"), F(-1.234567e0)); - test<"{:.6Lg}">(SV("-1_2#3457"), F(-1.234567e1)); - test<"{:.6Lg}">(SV("-12_3#457"), F(-1.234567e2)); - test<"{:.6Lg}">(SV("-1_23_4#57"), F(-1.234567e3)); - test<"{:.6Lg}">(SV("-12_34_5#7"), F(-1.234567e4)); - test<"{:.6Lg}">(SV("-123_45_7"), F(-1.234567e5)); - test<"{:.6Lg}">(SV("-1#23457e+06"), F(-1.234567e6)); - test<"{:.6Lg}">(SV("-1#23457e+07"), F(-1.234567e7)); - - test<"{:.6Lg}">(SV("1.23457e-06"), en_US, F(1.234567e-6)); - test<"{:.6Lg}">(SV("1.23457e-05"), en_US, F(1.234567e-5)); - test<"{:.6Lg}">(SV("0.000123457"), en_US, F(1.234567e-4)); - test<"{:.6Lg}">(SV("0.00123457"), en_US, F(1.234567e-3)); - test<"{:.6Lg}">(SV("0.0123457"), en_US, F(1.234567e-2)); - test<"{:.6Lg}">(SV("0.123457"), en_US, F(1.234567e-1)); - test<"{:.6Lg}">(SV("1.23457"), en_US, F(1.234567e0)); - test<"{:.6Lg}">(SV("12.3457"), en_US, F(1.234567e1)); - test<"{:.6Lg}">(SV("123.457"), en_US, F(1.234567e2)); - test<"{:.6Lg}">(SV("1,234.57"), en_US, F(1.234567e3)); - test<"{:.6Lg}">(SV("12,345.7"), en_US, F(1.234567e4)); - test<"{:.6Lg}">(SV("123,457"), en_US, F(1.234567e5)); - test<"{:.6Lg}">(SV("1.23457e+06"), en_US, F(1.234567e6)); - test<"{:.6Lg}">(SV("1.23457e+07"), en_US, F(1.234567e7)); - test<"{:.6Lg}">(SV("-1.23457e-06"), en_US, F(-1.234567e-6)); - test<"{:.6Lg}">(SV("-1.23457e-05"), en_US, F(-1.234567e-5)); - test<"{:.6Lg}">(SV("-0.000123457"), en_US, F(-1.234567e-4)); - test<"{:.6Lg}">(SV("-0.00123457"), en_US, F(-1.234567e-3)); - test<"{:.6Lg}">(SV("-0.0123457"), en_US, F(-1.234567e-2)); - test<"{:.6Lg}">(SV("-0.123457"), en_US, F(-1.234567e-1)); - test<"{:.6Lg}">(SV("-1.23457"), en_US, F(-1.234567e0)); - test<"{:.6Lg}">(SV("-12.3457"), en_US, F(-1.234567e1)); - test<"{:.6Lg}">(SV("-123.457"), en_US, F(-1.234567e2)); - test<"{:.6Lg}">(SV("-1,234.57"), en_US, F(-1.234567e3)); - test<"{:.6Lg}">(SV("-12,345.7"), en_US, F(-1.234567e4)); - test<"{:.6Lg}">(SV("-123,457"), en_US, F(-1.234567e5)); - test<"{:.6Lg}">(SV("-1.23457e+06"), en_US, F(-1.234567e6)); - test<"{:.6Lg}">(SV("-1.23457e+07"), en_US, F(-1.234567e7)); + test(SV("1#23457e-06"), SV("{:.6Lg}"), F(1.234567e-6)); + test(SV("1#23457e-05"), SV("{:.6Lg}"), F(1.234567e-5)); + test(SV("0#000123457"), SV("{:.6Lg}"), F(1.234567e-4)); + test(SV("0#00123457"), SV("{:.6Lg}"), F(1.234567e-3)); + test(SV("0#0123457"), SV("{:.6Lg}"), F(1.234567e-2)); + test(SV("0#123457"), SV("{:.6Lg}"), F(1.234567e-1)); + test(SV("1#23457"), SV("{:.6Lg}"), F(1.234567e0)); + test(SV("1_2#3457"), SV("{:.6Lg}"), F(1.234567e1)); + test(SV("12_3#457"), SV("{:.6Lg}"), F(1.234567e2)); + test(SV("1_23_4#57"), SV("{:.6Lg}"), F(1.234567e3)); + test(SV("12_34_5#7"), SV("{:.6Lg}"), F(1.234567e4)); + test(SV("123_45_7"), SV("{:.6Lg}"), F(1.234567e5)); + test(SV("1#23457e+06"), SV("{:.6Lg}"), F(1.234567e6)); + test(SV("1#23457e+07"), SV("{:.6Lg}"), F(1.234567e7)); + test(SV("-1#23457e-06"), SV("{:.6Lg}"), F(-1.234567e-6)); + test(SV("-1#23457e-05"), SV("{:.6Lg}"), F(-1.234567e-5)); + test(SV("-0#000123457"), SV("{:.6Lg}"), F(-1.234567e-4)); + test(SV("-0#00123457"), SV("{:.6Lg}"), F(-1.234567e-3)); + test(SV("-0#0123457"), SV("{:.6Lg}"), F(-1.234567e-2)); + test(SV("-0#123457"), SV("{:.6Lg}"), F(-1.234567e-1)); + test(SV("-1#23457"), SV("{:.6Lg}"), F(-1.234567e0)); + test(SV("-1_2#3457"), SV("{:.6Lg}"), F(-1.234567e1)); + test(SV("-12_3#457"), SV("{:.6Lg}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), SV("{:.6Lg}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), SV("{:.6Lg}"), F(-1.234567e4)); + test(SV("-123_45_7"), SV("{:.6Lg}"), F(-1.234567e5)); + test(SV("-1#23457e+06"), SV("{:.6Lg}"), F(-1.234567e6)); + test(SV("-1#23457e+07"), SV("{:.6Lg}"), F(-1.234567e7)); + + test(SV("1.23457e-06"), en_US, SV("{:.6Lg}"), F(1.234567e-6)); + test(SV("1.23457e-05"), en_US, SV("{:.6Lg}"), F(1.234567e-5)); + test(SV("0.000123457"), en_US, SV("{:.6Lg}"), F(1.234567e-4)); + test(SV("0.00123457"), en_US, SV("{:.6Lg}"), F(1.234567e-3)); + test(SV("0.0123457"), en_US, SV("{:.6Lg}"), F(1.234567e-2)); + test(SV("0.123457"), en_US, SV("{:.6Lg}"), F(1.234567e-1)); + test(SV("1.23457"), en_US, SV("{:.6Lg}"), F(1.234567e0)); + test(SV("12.3457"), en_US, SV("{:.6Lg}"), F(1.234567e1)); + test(SV("123.457"), en_US, SV("{:.6Lg}"), F(1.234567e2)); + test(SV("1,234.57"), en_US, SV("{:.6Lg}"), F(1.234567e3)); + test(SV("12,345.7"), en_US, SV("{:.6Lg}"), F(1.234567e4)); + test(SV("123,457"), en_US, SV("{:.6Lg}"), F(1.234567e5)); + test(SV("1.23457e+06"), en_US, SV("{:.6Lg}"), F(1.234567e6)); + test(SV("1.23457e+07"), en_US, SV("{:.6Lg}"), F(1.234567e7)); + test(SV("-1.23457e-06"), en_US, SV("{:.6Lg}"), F(-1.234567e-6)); + test(SV("-1.23457e-05"), en_US, SV("{:.6Lg}"), F(-1.234567e-5)); + test(SV("-0.000123457"), en_US, SV("{:.6Lg}"), F(-1.234567e-4)); + test(SV("-0.00123457"), en_US, SV("{:.6Lg}"), F(-1.234567e-3)); + test(SV("-0.0123457"), en_US, SV("{:.6Lg}"), F(-1.234567e-2)); + test(SV("-0.123457"), en_US, SV("{:.6Lg}"), F(-1.234567e-1)); + test(SV("-1.23457"), en_US, SV("{:.6Lg}"), F(-1.234567e0)); + test(SV("-12.3457"), en_US, SV("{:.6Lg}"), F(-1.234567e1)); + test(SV("-123.457"), en_US, SV("{:.6Lg}"), F(-1.234567e2)); + test(SV("-1,234.57"), en_US, SV("{:.6Lg}"), F(-1.234567e3)); + test(SV("-12,345.7"), en_US, SV("{:.6Lg}"), F(-1.234567e4)); + test(SV("-123,457"), en_US, SV("{:.6Lg}"), F(-1.234567e5)); + test(SV("-1.23457e+06"), en_US, SV("{:.6Lg}"), F(-1.234567e6)); + test(SV("-1.23457e+07"), en_US, SV("{:.6Lg}"), F(-1.234567e7)); std::locale::global(en_US); - test<"{:.6Lg}">(SV("1#23457e-06"), loc, F(1.234567e-6)); - test<"{:.6Lg}">(SV("1#23457e-05"), loc, F(1.234567e-5)); - test<"{:.6Lg}">(SV("0#000123457"), loc, F(1.234567e-4)); - test<"{:.6Lg}">(SV("0#00123457"), loc, F(1.234567e-3)); - test<"{:.6Lg}">(SV("0#0123457"), loc, F(1.234567e-2)); - test<"{:.6Lg}">(SV("0#123457"), loc, F(1.234567e-1)); - test<"{:.6Lg}">(SV("1#23457"), loc, F(1.234567e0)); - test<"{:.6Lg}">(SV("1_2#3457"), loc, F(1.234567e1)); - test<"{:.6Lg}">(SV("12_3#457"), loc, F(1.234567e2)); - test<"{:.6Lg}">(SV("1_23_4#57"), loc, F(1.234567e3)); - test<"{:.6Lg}">(SV("12_34_5#7"), loc, F(1.234567e4)); - test<"{:.6Lg}">(SV("123_45_7"), loc, F(1.234567e5)); - test<"{:.6Lg}">(SV("1#23457e+06"), loc, F(1.234567e6)); - test<"{:.6Lg}">(SV("1#23457e+07"), loc, F(1.234567e7)); - test<"{:.6Lg}">(SV("-1#23457e-06"), loc, F(-1.234567e-6)); - test<"{:.6Lg}">(SV("-1#23457e-05"), loc, F(-1.234567e-5)); - test<"{:.6Lg}">(SV("-0#000123457"), loc, F(-1.234567e-4)); - test<"{:.6Lg}">(SV("-0#00123457"), loc, F(-1.234567e-3)); - test<"{:.6Lg}">(SV("-0#0123457"), loc, F(-1.234567e-2)); - test<"{:.6Lg}">(SV("-0#123457"), loc, F(-1.234567e-1)); - test<"{:.6Lg}">(SV("-1#23457"), loc, F(-1.234567e0)); - test<"{:.6Lg}">(SV("-1_2#3457"), loc, F(-1.234567e1)); - test<"{:.6Lg}">(SV("-12_3#457"), loc, F(-1.234567e2)); - test<"{:.6Lg}">(SV("-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:.6Lg}">(SV("-12_34_5#7"), loc, F(-1.234567e4)); - test<"{:.6Lg}">(SV("-123_45_7"), loc, F(-1.234567e5)); - test<"{:.6Lg}">(SV("-1#23457e+06"), loc, F(-1.234567e6)); - test<"{:.6Lg}">(SV("-1#23457e+07"), loc, F(-1.234567e7)); + test(SV("1#23457e-06"), loc, SV("{:.6Lg}"), F(1.234567e-6)); + test(SV("1#23457e-05"), loc, SV("{:.6Lg}"), F(1.234567e-5)); + test(SV("0#000123457"), loc, SV("{:.6Lg}"), F(1.234567e-4)); + test(SV("0#00123457"), loc, SV("{:.6Lg}"), F(1.234567e-3)); + test(SV("0#0123457"), loc, SV("{:.6Lg}"), F(1.234567e-2)); + test(SV("0#123457"), loc, SV("{:.6Lg}"), F(1.234567e-1)); + test(SV("1#23457"), loc, SV("{:.6Lg}"), F(1.234567e0)); + test(SV("1_2#3457"), loc, SV("{:.6Lg}"), F(1.234567e1)); + test(SV("12_3#457"), loc, SV("{:.6Lg}"), F(1.234567e2)); + test(SV("1_23_4#57"), loc, SV("{:.6Lg}"), F(1.234567e3)); + test(SV("12_34_5#7"), loc, SV("{:.6Lg}"), F(1.234567e4)); + test(SV("123_45_7"), loc, SV("{:.6Lg}"), F(1.234567e5)); + test(SV("1#23457e+06"), loc, SV("{:.6Lg}"), F(1.234567e6)); + test(SV("1#23457e+07"), loc, SV("{:.6Lg}"), F(1.234567e7)); + test(SV("-1#23457e-06"), loc, SV("{:.6Lg}"), F(-1.234567e-6)); + test(SV("-1#23457e-05"), loc, SV("{:.6Lg}"), F(-1.234567e-5)); + test(SV("-0#000123457"), loc, SV("{:.6Lg}"), F(-1.234567e-4)); + test(SV("-0#00123457"), loc, SV("{:.6Lg}"), F(-1.234567e-3)); + test(SV("-0#0123457"), loc, SV("{:.6Lg}"), F(-1.234567e-2)); + test(SV("-0#123457"), loc, SV("{:.6Lg}"), F(-1.234567e-1)); + test(SV("-1#23457"), loc, SV("{:.6Lg}"), F(-1.234567e0)); + test(SV("-1_2#3457"), loc, SV("{:.6Lg}"), F(-1.234567e1)); + test(SV("-12_3#457"), loc, SV("{:.6Lg}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), loc, SV("{:.6Lg}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), loc, SV("{:.6Lg}"), F(-1.234567e4)); + test(SV("-123_45_7"), loc, SV("{:.6Lg}"), F(-1.234567e5)); + test(SV("-1#23457e+06"), loc, SV("{:.6Lg}"), F(-1.234567e6)); + test(SV("-1#23457e+07"), loc, SV("{:.6Lg}"), F(-1.234567e7)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<11.6Lg}">(SV("1,234.57$$$"), F(1.234567e3)); - test<"{:$>11.6Lg}">(SV("$$$1,234.57"), F(1.234567e3)); - test<"{:$^11.6Lg}">(SV("$1,234.57$$"), F(1.234567e3)); - test<"{:011.6Lg}">(SV("0001,234.57"), F(1.234567e3)); - test<"{:$<12.6Lg}">(SV("-1,234.57$$$"), F(-1.234567e3)); - test<"{:$>12.6Lg}">(SV("$$$-1,234.57"), F(-1.234567e3)); - test<"{:$^12.6Lg}">(SV("$-1,234.57$$"), F(-1.234567e3)); - test<"{:012.6Lg}">(SV("-0001,234.57"), F(-1.234567e3)); + test(SV("1,234.57$$$"), SV("{:$<11.6Lg}"), F(1.234567e3)); + test(SV("$$$1,234.57"), SV("{:$>11.6Lg}"), F(1.234567e3)); + test(SV("$1,234.57$$"), SV("{:$^11.6Lg}"), F(1.234567e3)); + test(SV("0001,234.57"), SV("{:011.6Lg}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), SV("{:$<12.6Lg}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), SV("{:$>12.6Lg}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), SV("{:$^12.6Lg}"), F(-1.234567e3)); + test(SV("-0001,234.57"), SV("{:012.6Lg}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<12.6Lg}">(SV("1_23_4#57$$$"), F(1.234567e3)); - test<"{:$>12.6Lg}">(SV("$$$1_23_4#57"), F(1.234567e3)); - test<"{:$^12.6Lg}">(SV("$1_23_4#57$$"), F(1.234567e3)); - test<"{:012.6Lg}">(SV("0001_23_4#57"), F(1.234567e3)); - test<"{:$<13.6Lg}">(SV("-1_23_4#57$$$"), F(-1.234567e3)); - test<"{:$>13.6Lg}">(SV("$$$-1_23_4#57"), F(-1.234567e3)); - test<"{:$^13.6Lg}">(SV("$-1_23_4#57$$"), F(-1.234567e3)); - test<"{:013.6Lg}">(SV("-0001_23_4#57"), F(-1.234567e3)); - - test<"{:$<11.6Lg}">(SV("1,234.57$$$"), en_US, F(1.234567e3)); - test<"{:$>11.6Lg}">(SV("$$$1,234.57"), en_US, F(1.234567e3)); - test<"{:$^11.6Lg}">(SV("$1,234.57$$"), en_US, F(1.234567e3)); - test<"{:011.6Lg}">(SV("0001,234.57"), en_US, F(1.234567e3)); - test<"{:$<12.6Lg}">(SV("-1,234.57$$$"), en_US, F(-1.234567e3)); - test<"{:$>12.6Lg}">(SV("$$$-1,234.57"), en_US, F(-1.234567e3)); - test<"{:$^12.6Lg}">(SV("$-1,234.57$$"), en_US, F(-1.234567e3)); - test<"{:012.6Lg}">(SV("-0001,234.57"), en_US, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), SV("{:$<12.6Lg}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), SV("{:$>12.6Lg}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), SV("{:$^12.6Lg}"), F(1.234567e3)); + test(SV("0001_23_4#57"), SV("{:012.6Lg}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), SV("{:$<13.6Lg}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), SV("{:$>13.6Lg}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), SV("{:$^13.6Lg}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), SV("{:013.6Lg}"), F(-1.234567e3)); + + test(SV("1,234.57$$$"), en_US, SV("{:$<11.6Lg}"), F(1.234567e3)); + test(SV("$$$1,234.57"), en_US, SV("{:$>11.6Lg}"), F(1.234567e3)); + test(SV("$1,234.57$$"), en_US, SV("{:$^11.6Lg}"), F(1.234567e3)); + test(SV("0001,234.57"), en_US, SV("{:011.6Lg}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), en_US, SV("{:$<12.6Lg}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), en_US, SV("{:$>12.6Lg}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), en_US, SV("{:$^12.6Lg}"), F(-1.234567e3)); + test(SV("-0001,234.57"), en_US, SV("{:012.6Lg}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<12.6Lg}">(SV("1_23_4#57$$$"), loc, F(1.234567e3)); - test<"{:$>12.6Lg}">(SV("$$$1_23_4#57"), loc, F(1.234567e3)); - test<"{:$^12.6Lg}">(SV("$1_23_4#57$$"), loc, F(1.234567e3)); - test<"{:012.6Lg}">(SV("0001_23_4#57"), loc, F(1.234567e3)); - test<"{:$<13.6Lg}">(SV("-1_23_4#57$$$"), loc, F(-1.234567e3)); - test<"{:$>13.6Lg}">(SV("$$$-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:$^13.6Lg}">(SV("$-1_23_4#57$$"), loc, F(-1.234567e3)); - test<"{:013.6Lg}">(SV("-0001_23_4#57"), loc, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), loc, SV("{:$<12.6Lg}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), loc, SV("{:$>12.6Lg}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), loc, SV("{:$^12.6Lg}"), F(1.234567e3)); + test(SV("0001_23_4#57"), loc, SV("{:012.6Lg}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), loc, SV("{:$<13.6Lg}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), loc, SV("{:$>13.6Lg}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), loc, SV("{:$^13.6Lg}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), loc, SV("{:013.6Lg}"), F(-1.234567e3)); } template @@ -1737,163 +1736,163 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6LG}">(SV("1.23457E-06"), F(1.234567e-6)); - test<"{:.6LG}">(SV("1.23457E-05"), F(1.234567e-5)); - test<"{:.6LG}">(SV("0.000123457"), F(1.234567e-4)); - test<"{:.6LG}">(SV("0.00123457"), F(1.234567e-3)); - test<"{:.6LG}">(SV("0.0123457"), F(1.234567e-2)); - test<"{:.6LG}">(SV("0.123457"), F(1.234567e-1)); - test<"{:.6LG}">(SV("1.23457"), F(1.234567e0)); - test<"{:.6LG}">(SV("12.3457"), F(1.234567e1)); - test<"{:.6LG}">(SV("123.457"), F(1.234567e2)); - test<"{:.6LG}">(SV("1,234.57"), F(1.234567e3)); - test<"{:.6LG}">(SV("12,345.7"), F(1.234567e4)); - test<"{:.6LG}">(SV("123,457"), F(1.234567e5)); - test<"{:.6LG}">(SV("1.23457E+06"), F(1.234567e6)); - test<"{:.6LG}">(SV("1.23457E+07"), F(1.234567e7)); - test<"{:.6LG}">(SV("-1.23457E-06"), F(-1.234567e-6)); - test<"{:.6LG}">(SV("-1.23457E-05"), F(-1.234567e-5)); - test<"{:.6LG}">(SV("-0.000123457"), F(-1.234567e-4)); - test<"{:.6LG}">(SV("-0.00123457"), F(-1.234567e-3)); - test<"{:.6LG}">(SV("-0.0123457"), F(-1.234567e-2)); - test<"{:.6LG}">(SV("-0.123457"), F(-1.234567e-1)); - test<"{:.6LG}">(SV("-1.23457"), F(-1.234567e0)); - test<"{:.6LG}">(SV("-12.3457"), F(-1.234567e1)); - test<"{:.6LG}">(SV("-123.457"), F(-1.234567e2)); - test<"{:.6LG}">(SV("-1,234.57"), F(-1.234567e3)); - test<"{:.6LG}">(SV("-12,345.7"), F(-1.234567e4)); - test<"{:.6LG}">(SV("-123,457"), F(-1.234567e5)); - test<"{:.6LG}">(SV("-1.23457E+06"), F(-1.234567e6)); - test<"{:.6LG}">(SV("-1.23457E+07"), F(-1.234567e7)); + test(SV("1.23457E-06"), SV("{:.6LG}"), F(1.234567e-6)); + test(SV("1.23457E-05"), SV("{:.6LG}"), F(1.234567e-5)); + test(SV("0.000123457"), SV("{:.6LG}"), F(1.234567e-4)); + test(SV("0.00123457"), SV("{:.6LG}"), F(1.234567e-3)); + test(SV("0.0123457"), SV("{:.6LG}"), F(1.234567e-2)); + test(SV("0.123457"), SV("{:.6LG}"), F(1.234567e-1)); + test(SV("1.23457"), SV("{:.6LG}"), F(1.234567e0)); + test(SV("12.3457"), SV("{:.6LG}"), F(1.234567e1)); + test(SV("123.457"), SV("{:.6LG}"), F(1.234567e2)); + test(SV("1,234.57"), SV("{:.6LG}"), F(1.234567e3)); + test(SV("12,345.7"), SV("{:.6LG}"), F(1.234567e4)); + test(SV("123,457"), SV("{:.6LG}"), F(1.234567e5)); + test(SV("1.23457E+06"), SV("{:.6LG}"), F(1.234567e6)); + test(SV("1.23457E+07"), SV("{:.6LG}"), F(1.234567e7)); + test(SV("-1.23457E-06"), SV("{:.6LG}"), F(-1.234567e-6)); + test(SV("-1.23457E-05"), SV("{:.6LG}"), F(-1.234567e-5)); + test(SV("-0.000123457"), SV("{:.6LG}"), F(-1.234567e-4)); + test(SV("-0.00123457"), SV("{:.6LG}"), F(-1.234567e-3)); + test(SV("-0.0123457"), SV("{:.6LG}"), F(-1.234567e-2)); + test(SV("-0.123457"), SV("{:.6LG}"), F(-1.234567e-1)); + test(SV("-1.23457"), SV("{:.6LG}"), F(-1.234567e0)); + test(SV("-12.3457"), SV("{:.6LG}"), F(-1.234567e1)); + test(SV("-123.457"), SV("{:.6LG}"), F(-1.234567e2)); + test(SV("-1,234.57"), SV("{:.6LG}"), F(-1.234567e3)); + test(SV("-12,345.7"), SV("{:.6LG}"), F(-1.234567e4)); + test(SV("-123,457"), SV("{:.6LG}"), F(-1.234567e5)); + test(SV("-1.23457E+06"), SV("{:.6LG}"), F(-1.234567e6)); + test(SV("-1.23457E+07"), SV("{:.6LG}"), F(-1.234567e7)); std::locale::global(loc); - test<"{:.6LG}">(SV("1#23457E-06"), F(1.234567e-6)); - test<"{:.6LG}">(SV("1#23457E-05"), F(1.234567e-5)); - test<"{:.6LG}">(SV("0#000123457"), F(1.234567e-4)); - test<"{:.6LG}">(SV("0#00123457"), F(1.234567e-3)); - test<"{:.6LG}">(SV("0#0123457"), F(1.234567e-2)); - test<"{:.6LG}">(SV("0#123457"), F(1.234567e-1)); - test<"{:.6LG}">(SV("1#23457"), F(1.234567e0)); - test<"{:.6LG}">(SV("1_2#3457"), F(1.234567e1)); - test<"{:.6LG}">(SV("12_3#457"), F(1.234567e2)); - test<"{:.6LG}">(SV("1_23_4#57"), F(1.234567e3)); - test<"{:.6LG}">(SV("12_34_5#7"), F(1.234567e4)); - test<"{:.6LG}">(SV("123_45_7"), F(1.234567e5)); - test<"{:.6LG}">(SV("1#23457E+06"), F(1.234567e6)); - test<"{:.6LG}">(SV("1#23457E+07"), F(1.234567e7)); - test<"{:.6LG}">(SV("-1#23457E-06"), F(-1.234567e-6)); - test<"{:.6LG}">(SV("-1#23457E-05"), F(-1.234567e-5)); - test<"{:.6LG}">(SV("-0#000123457"), F(-1.234567e-4)); - test<"{:.6LG}">(SV("-0#00123457"), F(-1.234567e-3)); - test<"{:.6LG}">(SV("-0#0123457"), F(-1.234567e-2)); - test<"{:.6LG}">(SV("-0#123457"), F(-1.234567e-1)); - test<"{:.6LG}">(SV("-1#23457"), F(-1.234567e0)); - test<"{:.6LG}">(SV("-1_2#3457"), F(-1.234567e1)); - test<"{:.6LG}">(SV("-12_3#457"), F(-1.234567e2)); - test<"{:.6LG}">(SV("-1_23_4#57"), F(-1.234567e3)); - test<"{:.6LG}">(SV("-12_34_5#7"), F(-1.234567e4)); - test<"{:.6LG}">(SV("-123_45_7"), F(-1.234567e5)); - test<"{:.6LG}">(SV("-1#23457E+06"), F(-1.234567e6)); - test<"{:.6LG}">(SV("-1#23457E+07"), F(-1.234567e7)); - - test<"{:.6LG}">(SV("1.23457E-06"), en_US, F(1.234567e-6)); - test<"{:.6LG}">(SV("1.23457E-05"), en_US, F(1.234567e-5)); - test<"{:.6LG}">(SV("0.000123457"), en_US, F(1.234567e-4)); - test<"{:.6LG}">(SV("0.00123457"), en_US, F(1.234567e-3)); - test<"{:.6LG}">(SV("0.0123457"), en_US, F(1.234567e-2)); - test<"{:.6LG}">(SV("0.123457"), en_US, F(1.234567e-1)); - test<"{:.6LG}">(SV("1.23457"), en_US, F(1.234567e0)); - test<"{:.6LG}">(SV("12.3457"), en_US, F(1.234567e1)); - test<"{:.6LG}">(SV("123.457"), en_US, F(1.234567e2)); - test<"{:.6LG}">(SV("1,234.57"), en_US, F(1.234567e3)); - test<"{:.6LG}">(SV("12,345.7"), en_US, F(1.234567e4)); - test<"{:.6LG}">(SV("123,457"), en_US, F(1.234567e5)); - test<"{:.6LG}">(SV("1.23457E+06"), en_US, F(1.234567e6)); - test<"{:.6LG}">(SV("1.23457E+07"), en_US, F(1.234567e7)); - test<"{:.6LG}">(SV("-1.23457E-06"), en_US, F(-1.234567e-6)); - test<"{:.6LG}">(SV("-1.23457E-05"), en_US, F(-1.234567e-5)); - test<"{:.6LG}">(SV("-0.000123457"), en_US, F(-1.234567e-4)); - test<"{:.6LG}">(SV("-0.00123457"), en_US, F(-1.234567e-3)); - test<"{:.6LG}">(SV("-0.0123457"), en_US, F(-1.234567e-2)); - test<"{:.6LG}">(SV("-0.123457"), en_US, F(-1.234567e-1)); - test<"{:.6LG}">(SV("-1.23457"), en_US, F(-1.234567e0)); - test<"{:.6LG}">(SV("-12.3457"), en_US, F(-1.234567e1)); - test<"{:.6LG}">(SV("-123.457"), en_US, F(-1.234567e2)); - test<"{:.6LG}">(SV("-1,234.57"), en_US, F(-1.234567e3)); - test<"{:.6LG}">(SV("-12,345.7"), en_US, F(-1.234567e4)); - test<"{:.6LG}">(SV("-123,457"), en_US, F(-1.234567e5)); - test<"{:.6LG}">(SV("-1.23457E+06"), en_US, F(-1.234567e6)); - test<"{:.6LG}">(SV("-1.23457E+07"), en_US, F(-1.234567e7)); + test(SV("1#23457E-06"), SV("{:.6LG}"), F(1.234567e-6)); + test(SV("1#23457E-05"), SV("{:.6LG}"), F(1.234567e-5)); + test(SV("0#000123457"), SV("{:.6LG}"), F(1.234567e-4)); + test(SV("0#00123457"), SV("{:.6LG}"), F(1.234567e-3)); + test(SV("0#0123457"), SV("{:.6LG}"), F(1.234567e-2)); + test(SV("0#123457"), SV("{:.6LG}"), F(1.234567e-1)); + test(SV("1#23457"), SV("{:.6LG}"), F(1.234567e0)); + test(SV("1_2#3457"), SV("{:.6LG}"), F(1.234567e1)); + test(SV("12_3#457"), SV("{:.6LG}"), F(1.234567e2)); + test(SV("1_23_4#57"), SV("{:.6LG}"), F(1.234567e3)); + test(SV("12_34_5#7"), SV("{:.6LG}"), F(1.234567e4)); + test(SV("123_45_7"), SV("{:.6LG}"), F(1.234567e5)); + test(SV("1#23457E+06"), SV("{:.6LG}"), F(1.234567e6)); + test(SV("1#23457E+07"), SV("{:.6LG}"), F(1.234567e7)); + test(SV("-1#23457E-06"), SV("{:.6LG}"), F(-1.234567e-6)); + test(SV("-1#23457E-05"), SV("{:.6LG}"), F(-1.234567e-5)); + test(SV("-0#000123457"), SV("{:.6LG}"), F(-1.234567e-4)); + test(SV("-0#00123457"), SV("{:.6LG}"), F(-1.234567e-3)); + test(SV("-0#0123457"), SV("{:.6LG}"), F(-1.234567e-2)); + test(SV("-0#123457"), SV("{:.6LG}"), F(-1.234567e-1)); + test(SV("-1#23457"), SV("{:.6LG}"), F(-1.234567e0)); + test(SV("-1_2#3457"), SV("{:.6LG}"), F(-1.234567e1)); + test(SV("-12_3#457"), SV("{:.6LG}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), SV("{:.6LG}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), SV("{:.6LG}"), F(-1.234567e4)); + test(SV("-123_45_7"), SV("{:.6LG}"), F(-1.234567e5)); + test(SV("-1#23457E+06"), SV("{:.6LG}"), F(-1.234567e6)); + test(SV("-1#23457E+07"), SV("{:.6LG}"), F(-1.234567e7)); + + test(SV("1.23457E-06"), en_US, SV("{:.6LG}"), F(1.234567e-6)); + test(SV("1.23457E-05"), en_US, SV("{:.6LG}"), F(1.234567e-5)); + test(SV("0.000123457"), en_US, SV("{:.6LG}"), F(1.234567e-4)); + test(SV("0.00123457"), en_US, SV("{:.6LG}"), F(1.234567e-3)); + test(SV("0.0123457"), en_US, SV("{:.6LG}"), F(1.234567e-2)); + test(SV("0.123457"), en_US, SV("{:.6LG}"), F(1.234567e-1)); + test(SV("1.23457"), en_US, SV("{:.6LG}"), F(1.234567e0)); + test(SV("12.3457"), en_US, SV("{:.6LG}"), F(1.234567e1)); + test(SV("123.457"), en_US, SV("{:.6LG}"), F(1.234567e2)); + test(SV("1,234.57"), en_US, SV("{:.6LG}"), F(1.234567e3)); + test(SV("12,345.7"), en_US, SV("{:.6LG}"), F(1.234567e4)); + test(SV("123,457"), en_US, SV("{:.6LG}"), F(1.234567e5)); + test(SV("1.23457E+06"), en_US, SV("{:.6LG}"), F(1.234567e6)); + test(SV("1.23457E+07"), en_US, SV("{:.6LG}"), F(1.234567e7)); + test(SV("-1.23457E-06"), en_US, SV("{:.6LG}"), F(-1.234567e-6)); + test(SV("-1.23457E-05"), en_US, SV("{:.6LG}"), F(-1.234567e-5)); + test(SV("-0.000123457"), en_US, SV("{:.6LG}"), F(-1.234567e-4)); + test(SV("-0.00123457"), en_US, SV("{:.6LG}"), F(-1.234567e-3)); + test(SV("-0.0123457"), en_US, SV("{:.6LG}"), F(-1.234567e-2)); + test(SV("-0.123457"), en_US, SV("{:.6LG}"), F(-1.234567e-1)); + test(SV("-1.23457"), en_US, SV("{:.6LG}"), F(-1.234567e0)); + test(SV("-12.3457"), en_US, SV("{:.6LG}"), F(-1.234567e1)); + test(SV("-123.457"), en_US, SV("{:.6LG}"), F(-1.234567e2)); + test(SV("-1,234.57"), en_US, SV("{:.6LG}"), F(-1.234567e3)); + test(SV("-12,345.7"), en_US, SV("{:.6LG}"), F(-1.234567e4)); + test(SV("-123,457"), en_US, SV("{:.6LG}"), F(-1.234567e5)); + test(SV("-1.23457E+06"), en_US, SV("{:.6LG}"), F(-1.234567e6)); + test(SV("-1.23457E+07"), en_US, SV("{:.6LG}"), F(-1.234567e7)); std::locale::global(en_US); - test<"{:.6LG}">(SV("1#23457E-06"), loc, F(1.234567e-6)); - test<"{:.6LG}">(SV("1#23457E-05"), loc, F(1.234567e-5)); - test<"{:.6LG}">(SV("0#000123457"), loc, F(1.234567e-4)); - test<"{:.6LG}">(SV("0#00123457"), loc, F(1.234567e-3)); - test<"{:.6LG}">(SV("0#0123457"), loc, F(1.234567e-2)); - test<"{:.6LG}">(SV("0#123457"), loc, F(1.234567e-1)); - test<"{:.6LG}">(SV("1#23457"), loc, F(1.234567e0)); - test<"{:.6LG}">(SV("1_2#3457"), loc, F(1.234567e1)); - test<"{:.6LG}">(SV("12_3#457"), loc, F(1.234567e2)); - test<"{:.6LG}">(SV("1_23_4#57"), loc, F(1.234567e3)); - test<"{:.6LG}">(SV("12_34_5#7"), loc, F(1.234567e4)); - test<"{:.6LG}">(SV("123_45_7"), loc, F(1.234567e5)); - test<"{:.6LG}">(SV("1#23457E+06"), loc, F(1.234567e6)); - test<"{:.6LG}">(SV("1#23457E+07"), loc, F(1.234567e7)); - test<"{:.6LG}">(SV("-1#23457E-06"), loc, F(-1.234567e-6)); - test<"{:.6LG}">(SV("-1#23457E-05"), loc, F(-1.234567e-5)); - test<"{:.6LG}">(SV("-0#000123457"), loc, F(-1.234567e-4)); - test<"{:.6LG}">(SV("-0#00123457"), loc, F(-1.234567e-3)); - test<"{:.6LG}">(SV("-0#0123457"), loc, F(-1.234567e-2)); - test<"{:.6LG}">(SV("-0#123457"), loc, F(-1.234567e-1)); - test<"{:.6LG}">(SV("-1#23457"), loc, F(-1.234567e0)); - test<"{:.6LG}">(SV("-1_2#3457"), loc, F(-1.234567e1)); - test<"{:.6LG}">(SV("-12_3#457"), loc, F(-1.234567e2)); - test<"{:.6LG}">(SV("-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:.6LG}">(SV("-12_34_5#7"), loc, F(-1.234567e4)); - test<"{:.6LG}">(SV("-123_45_7"), loc, F(-1.234567e5)); - test<"{:.6LG}">(SV("-1#23457E+06"), loc, F(-1.234567e6)); - test<"{:.6LG}">(SV("-1#23457E+07"), loc, F(-1.234567e7)); + test(SV("1#23457E-06"), loc, SV("{:.6LG}"), F(1.234567e-6)); + test(SV("1#23457E-05"), loc, SV("{:.6LG}"), F(1.234567e-5)); + test(SV("0#000123457"), loc, SV("{:.6LG}"), F(1.234567e-4)); + test(SV("0#00123457"), loc, SV("{:.6LG}"), F(1.234567e-3)); + test(SV("0#0123457"), loc, SV("{:.6LG}"), F(1.234567e-2)); + test(SV("0#123457"), loc, SV("{:.6LG}"), F(1.234567e-1)); + test(SV("1#23457"), loc, SV("{:.6LG}"), F(1.234567e0)); + test(SV("1_2#3457"), loc, SV("{:.6LG}"), F(1.234567e1)); + test(SV("12_3#457"), loc, SV("{:.6LG}"), F(1.234567e2)); + test(SV("1_23_4#57"), loc, SV("{:.6LG}"), F(1.234567e3)); + test(SV("12_34_5#7"), loc, SV("{:.6LG}"), F(1.234567e4)); + test(SV("123_45_7"), loc, SV("{:.6LG}"), F(1.234567e5)); + test(SV("1#23457E+06"), loc, SV("{:.6LG}"), F(1.234567e6)); + test(SV("1#23457E+07"), loc, SV("{:.6LG}"), F(1.234567e7)); + test(SV("-1#23457E-06"), loc, SV("{:.6LG}"), F(-1.234567e-6)); + test(SV("-1#23457E-05"), loc, SV("{:.6LG}"), F(-1.234567e-5)); + test(SV("-0#000123457"), loc, SV("{:.6LG}"), F(-1.234567e-4)); + test(SV("-0#00123457"), loc, SV("{:.6LG}"), F(-1.234567e-3)); + test(SV("-0#0123457"), loc, SV("{:.6LG}"), F(-1.234567e-2)); + test(SV("-0#123457"), loc, SV("{:.6LG}"), F(-1.234567e-1)); + test(SV("-1#23457"), loc, SV("{:.6LG}"), F(-1.234567e0)); + test(SV("-1_2#3457"), loc, SV("{:.6LG}"), F(-1.234567e1)); + test(SV("-12_3#457"), loc, SV("{:.6LG}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), loc, SV("{:.6LG}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), loc, SV("{:.6LG}"), F(-1.234567e4)); + test(SV("-123_45_7"), loc, SV("{:.6LG}"), F(-1.234567e5)); + test(SV("-1#23457E+06"), loc, SV("{:.6LG}"), F(-1.234567e6)); + test(SV("-1#23457E+07"), loc, SV("{:.6LG}"), F(-1.234567e7)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<11.6LG}">(SV("1,234.57$$$"), F(1.234567e3)); - test<"{:$>11.6LG}">(SV("$$$1,234.57"), F(1.234567e3)); - test<"{:$^11.6LG}">(SV("$1,234.57$$"), F(1.234567e3)); - test<"{:011.6LG}">(SV("0001,234.57"), F(1.234567e3)); - test<"{:$<12.6LG}">(SV("-1,234.57$$$"), F(-1.234567e3)); - test<"{:$>12.6LG}">(SV("$$$-1,234.57"), F(-1.234567e3)); - test<"{:$^12.6LG}">(SV("$-1,234.57$$"), F(-1.234567e3)); - test<"{:012.6LG}">(SV("-0001,234.57"), F(-1.234567e3)); + test(SV("1,234.57$$$"), SV("{:$<11.6LG}"), F(1.234567e3)); + test(SV("$$$1,234.57"), SV("{:$>11.6LG}"), F(1.234567e3)); + test(SV("$1,234.57$$"), SV("{:$^11.6LG}"), F(1.234567e3)); + test(SV("0001,234.57"), SV("{:011.6LG}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), SV("{:$<12.6LG}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), SV("{:$>12.6LG}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), SV("{:$^12.6LG}"), F(-1.234567e3)); + test(SV("-0001,234.57"), SV("{:012.6LG}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<12.6LG}">(SV("1_23_4#57$$$"), F(1.234567e3)); - test<"{:$>12.6LG}">(SV("$$$1_23_4#57"), F(1.234567e3)); - test<"{:$^12.6LG}">(SV("$1_23_4#57$$"), F(1.234567e3)); - test<"{:012.6LG}">(SV("0001_23_4#57"), F(1.234567e3)); - test<"{:$<13.6LG}">(SV("-1_23_4#57$$$"), F(-1.234567e3)); - test<"{:$>13.6LG}">(SV("$$$-1_23_4#57"), F(-1.234567e3)); - test<"{:$^13.6LG}">(SV("$-1_23_4#57$$"), F(-1.234567e3)); - test<"{:013.6LG}">(SV("-0001_23_4#57"), F(-1.234567e3)); - - test<"{:$<11.6LG}">(SV("1,234.57$$$"), en_US, F(1.234567e3)); - test<"{:$>11.6LG}">(SV("$$$1,234.57"), en_US, F(1.234567e3)); - test<"{:$^11.6LG}">(SV("$1,234.57$$"), en_US, F(1.234567e3)); - test<"{:011.6LG}">(SV("0001,234.57"), en_US, F(1.234567e3)); - test<"{:$<12.6LG}">(SV("-1,234.57$$$"), en_US, F(-1.234567e3)); - test<"{:$>12.6LG}">(SV("$$$-1,234.57"), en_US, F(-1.234567e3)); - test<"{:$^12.6LG}">(SV("$-1,234.57$$"), en_US, F(-1.234567e3)); - test<"{:012.6LG}">(SV("-0001,234.57"), en_US, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), SV("{:$<12.6LG}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), SV("{:$>12.6LG}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), SV("{:$^12.6LG}"), F(1.234567e3)); + test(SV("0001_23_4#57"), SV("{:012.6LG}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), SV("{:$<13.6LG}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), SV("{:$>13.6LG}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), SV("{:$^13.6LG}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), SV("{:013.6LG}"), F(-1.234567e3)); + + test(SV("1,234.57$$$"), en_US, SV("{:$<11.6LG}"), F(1.234567e3)); + test(SV("$$$1,234.57"), en_US, SV("{:$>11.6LG}"), F(1.234567e3)); + test(SV("$1,234.57$$"), en_US, SV("{:$^11.6LG}"), F(1.234567e3)); + test(SV("0001,234.57"), en_US, SV("{:011.6LG}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), en_US, SV("{:$<12.6LG}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), en_US, SV("{:$>12.6LG}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), en_US, SV("{:$^12.6LG}"), F(-1.234567e3)); + test(SV("-0001,234.57"), en_US, SV("{:012.6LG}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<12.6LG}">(SV("1_23_4#57$$$"), loc, F(1.234567e3)); - test<"{:$>12.6LG}">(SV("$$$1_23_4#57"), loc, F(1.234567e3)); - test<"{:$^12.6LG}">(SV("$1_23_4#57$$"), loc, F(1.234567e3)); - test<"{:012.6LG}">(SV("0001_23_4#57"), loc, F(1.234567e3)); - test<"{:$<13.6LG}">(SV("-1_23_4#57$$$"), loc, F(-1.234567e3)); - test<"{:$>13.6LG}">(SV("$$$-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:$^13.6LG}">(SV("$-1_23_4#57$$"), loc, F(-1.234567e3)); - test<"{:013.6LG}">(SV("-0001_23_4#57"), loc, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), loc, SV("{:$<12.6LG}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), loc, SV("{:$>12.6LG}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), loc, SV("{:$^12.6LG}"), F(1.234567e3)); + test(SV("0001_23_4#57"), loc, SV("{:012.6LG}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), loc, SV("{:$<13.6LG}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), loc, SV("{:$>13.6LG}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), loc, SV("{:$^13.6LG}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), loc, SV("{:013.6LG}"), F(-1.234567e3)); } template @@ -1903,227 +1902,227 @@ // *** Basic *** std::locale::global(en_US); - test<"{:L}">(SV("1.234567e-06"), F(1.234567e-6)); - test<"{:L}">(SV("1.234567e-05"), F(1.234567e-5)); - test<"{:L}">(SV("0.0001234567"), F(1.234567e-4)); - test<"{:L}">(SV("0.001234567"), F(1.234567e-3)); - test<"{:L}">(SV("0.01234567"), F(1.234567e-2)); - test<"{:L}">(SV("0.1234567"), F(1.234567e-1)); - test<"{:L}">(SV("1.234567"), F(1.234567e0)); - test<"{:L}">(SV("12.34567"), F(1.234567e1)); - test<"{:L}">(SV("123.4567"), F(1.234567e2)); - test<"{:L}">(SV("1,234.567"), F(1.234567e3)); - test<"{:L}">(SV("12,345.67"), F(1.234567e4)); - test<"{:L}">(SV("123,456.7"), F(1.234567e5)); - test<"{:L}">(SV("1,234,567"), F(1.234567e6)); - test<"{:L}">(SV("12,345,670"), F(1.234567e7)); + test(SV("1.234567e-06"), SV("{:L}"), F(1.234567e-6)); + test(SV("1.234567e-05"), SV("{:L}"), F(1.234567e-5)); + test(SV("0.0001234567"), SV("{:L}"), F(1.234567e-4)); + test(SV("0.001234567"), SV("{:L}"), F(1.234567e-3)); + test(SV("0.01234567"), SV("{:L}"), F(1.234567e-2)); + test(SV("0.1234567"), SV("{:L}"), F(1.234567e-1)); + test(SV("1.234567"), SV("{:L}"), F(1.234567e0)); + test(SV("12.34567"), SV("{:L}"), F(1.234567e1)); + test(SV("123.4567"), SV("{:L}"), F(1.234567e2)); + test(SV("1,234.567"), SV("{:L}"), F(1.234567e3)); + test(SV("12,345.67"), SV("{:L}"), F(1.234567e4)); + test(SV("123,456.7"), SV("{:L}"), F(1.234567e5)); + test(SV("1,234,567"), SV("{:L}"), F(1.234567e6)); + test(SV("12,345,670"), SV("{:L}"), F(1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("123,456,700"), F(1.234567e8)); - test<"{:L}">(SV("1,234,567,000"), F(1.234567e9)); - test<"{:L}">(SV("12,345,670,000"), F(1.234567e10)); - test<"{:L}">(SV("123,456,700,000"), F(1.234567e11)); - test<"{:L}">(SV("1.234567e+12"), F(1.234567e12)); - test<"{:L}">(SV("1.234567e+13"), F(1.234567e13)); + test(SV("123,456,700"), SV("{:L}"), F(1.234567e8)); + test(SV("1,234,567,000"), SV("{:L}"), F(1.234567e9)); + test(SV("12,345,670,000"), SV("{:L}"), F(1.234567e10)); + test(SV("123,456,700,000"), SV("{:L}"), F(1.234567e11)); + test(SV("1.234567e+12"), SV("{:L}"), F(1.234567e12)); + test(SV("1.234567e+13"), SV("{:L}"), F(1.234567e13)); } - test<"{:L}">(SV("-1.234567e-06"), F(-1.234567e-6)); - test<"{:L}">(SV("-1.234567e-05"), F(-1.234567e-5)); - test<"{:L}">(SV("-0.0001234567"), F(-1.234567e-4)); - test<"{:L}">(SV("-0.001234567"), F(-1.234567e-3)); - test<"{:L}">(SV("-0.01234567"), F(-1.234567e-2)); - test<"{:L}">(SV("-0.1234567"), F(-1.234567e-1)); - test<"{:L}">(SV("-1.234567"), F(-1.234567e0)); - test<"{:L}">(SV("-12.34567"), F(-1.234567e1)); - test<"{:L}">(SV("-123.4567"), F(-1.234567e2)); - test<"{:L}">(SV("-1,234.567"), F(-1.234567e3)); - test<"{:L}">(SV("-12,345.67"), F(-1.234567e4)); - test<"{:L}">(SV("-123,456.7"), F(-1.234567e5)); - test<"{:L}">(SV("-1,234,567"), F(-1.234567e6)); - test<"{:L}">(SV("-12,345,670"), F(-1.234567e7)); + test(SV("-1.234567e-06"), SV("{:L}"), F(-1.234567e-6)); + test(SV("-1.234567e-05"), SV("{:L}"), F(-1.234567e-5)); + test(SV("-0.0001234567"), SV("{:L}"), F(-1.234567e-4)); + test(SV("-0.001234567"), SV("{:L}"), F(-1.234567e-3)); + test(SV("-0.01234567"), SV("{:L}"), F(-1.234567e-2)); + test(SV("-0.1234567"), SV("{:L}"), F(-1.234567e-1)); + test(SV("-1.234567"), SV("{:L}"), F(-1.234567e0)); + test(SV("-12.34567"), SV("{:L}"), F(-1.234567e1)); + test(SV("-123.4567"), SV("{:L}"), F(-1.234567e2)); + test(SV("-1,234.567"), SV("{:L}"), F(-1.234567e3)); + test(SV("-12,345.67"), SV("{:L}"), F(-1.234567e4)); + test(SV("-123,456.7"), SV("{:L}"), F(-1.234567e5)); + test(SV("-1,234,567"), SV("{:L}"), F(-1.234567e6)); + test(SV("-12,345,670"), SV("{:L}"), F(-1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("-123,456,700"), F(-1.234567e8)); - test<"{:L}">(SV("-1,234,567,000"), F(-1.234567e9)); - test<"{:L}">(SV("-12,345,670,000"), F(-1.234567e10)); - test<"{:L}">(SV("-123,456,700,000"), F(-1.234567e11)); - test<"{:L}">(SV("-1.234567e+12"), F(-1.234567e12)); - test<"{:L}">(SV("-1.234567e+13"), F(-1.234567e13)); + test(SV("-123,456,700"), SV("{:L}"), F(-1.234567e8)); + test(SV("-1,234,567,000"), SV("{:L}"), F(-1.234567e9)); + test(SV("-12,345,670,000"), SV("{:L}"), F(-1.234567e10)); + test(SV("-123,456,700,000"), SV("{:L}"), F(-1.234567e11)); + test(SV("-1.234567e+12"), SV("{:L}"), F(-1.234567e12)); + test(SV("-1.234567e+13"), SV("{:L}"), F(-1.234567e13)); } std::locale::global(loc); - test<"{:L}">(SV("1#234567e-06"), F(1.234567e-6)); - test<"{:L}">(SV("1#234567e-05"), F(1.234567e-5)); - test<"{:L}">(SV("0#0001234567"), F(1.234567e-4)); - test<"{:L}">(SV("0#001234567"), F(1.234567e-3)); - test<"{:L}">(SV("0#01234567"), F(1.234567e-2)); - test<"{:L}">(SV("0#1234567"), F(1.234567e-1)); - test<"{:L}">(SV("1#234567"), F(1.234567e0)); - test<"{:L}">(SV("1_2#34567"), F(1.234567e1)); - test<"{:L}">(SV("12_3#4567"), F(1.234567e2)); - test<"{:L}">(SV("1_23_4#567"), F(1.234567e3)); - test<"{:L}">(SV("12_34_5#67"), F(1.234567e4)); - test<"{:L}">(SV("123_45_6#7"), F(1.234567e5)); - test<"{:L}">(SV("1_234_56_7"), F(1.234567e6)); - test<"{:L}">(SV("12_345_67_0"), F(1.234567e7)); + test(SV("1#234567e-06"), SV("{:L}"), F(1.234567e-6)); + test(SV("1#234567e-05"), SV("{:L}"), F(1.234567e-5)); + test(SV("0#0001234567"), SV("{:L}"), F(1.234567e-4)); + test(SV("0#001234567"), SV("{:L}"), F(1.234567e-3)); + test(SV("0#01234567"), SV("{:L}"), F(1.234567e-2)); + test(SV("0#1234567"), SV("{:L}"), F(1.234567e-1)); + test(SV("1#234567"), SV("{:L}"), F(1.234567e0)); + test(SV("1_2#34567"), SV("{:L}"), F(1.234567e1)); + test(SV("12_3#4567"), SV("{:L}"), F(1.234567e2)); + test(SV("1_23_4#567"), SV("{:L}"), F(1.234567e3)); + test(SV("12_34_5#67"), SV("{:L}"), F(1.234567e4)); + test(SV("123_45_6#7"), SV("{:L}"), F(1.234567e5)); + test(SV("1_234_56_7"), SV("{:L}"), F(1.234567e6)); + test(SV("12_345_67_0"), SV("{:L}"), F(1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("1_23_456_70_0"), F(1.234567e8)); - test<"{:L}">(SV("1_2_34_567_00_0"), F(1.234567e9)); - test<"{:L}">(SV("1_2_3_45_670_00_0"), F(1.234567e10)); - test<"{:L}">(SV("1_2_3_4_56_700_00_0"), F(1.234567e11)); - test<"{:L}">(SV("1#234567e+12"), F(1.234567e12)); - test<"{:L}">(SV("1#234567e+13"), F(1.234567e13)); + test(SV("1_23_456_70_0"), SV("{:L}"), F(1.234567e8)); + test(SV("1_2_34_567_00_0"), SV("{:L}"), F(1.234567e9)); + test(SV("1_2_3_45_670_00_0"), SV("{:L}"), F(1.234567e10)); + test(SV("1_2_3_4_56_700_00_0"), SV("{:L}"), F(1.234567e11)); + test(SV("1#234567e+12"), SV("{:L}"), F(1.234567e12)); + test(SV("1#234567e+13"), SV("{:L}"), F(1.234567e13)); } - test<"{:L}">(SV("-1#234567e-06"), F(-1.234567e-6)); - test<"{:L}">(SV("-1#234567e-05"), F(-1.234567e-5)); - test<"{:L}">(SV("-0#0001234567"), F(-1.234567e-4)); - test<"{:L}">(SV("-0#001234567"), F(-1.234567e-3)); - test<"{:L}">(SV("-0#01234567"), F(-1.234567e-2)); - test<"{:L}">(SV("-0#1234567"), F(-1.234567e-1)); - test<"{:L}">(SV("-1#234567"), F(-1.234567e0)); - test<"{:L}">(SV("-1_2#34567"), F(-1.234567e1)); - test<"{:L}">(SV("-12_3#4567"), F(-1.234567e2)); - test<"{:L}">(SV("-1_23_4#567"), F(-1.234567e3)); - test<"{:L}">(SV("-12_34_5#67"), F(-1.234567e4)); - test<"{:L}">(SV("-123_45_6#7"), F(-1.234567e5)); - test<"{:L}">(SV("-1_234_56_7"), F(-1.234567e6)); - test<"{:L}">(SV("-12_345_67_0"), F(-1.234567e7)); + test(SV("-1#234567e-06"), SV("{:L}"), F(-1.234567e-6)); + test(SV("-1#234567e-05"), SV("{:L}"), F(-1.234567e-5)); + test(SV("-0#0001234567"), SV("{:L}"), F(-1.234567e-4)); + test(SV("-0#001234567"), SV("{:L}"), F(-1.234567e-3)); + test(SV("-0#01234567"), SV("{:L}"), F(-1.234567e-2)); + test(SV("-0#1234567"), SV("{:L}"), F(-1.234567e-1)); + test(SV("-1#234567"), SV("{:L}"), F(-1.234567e0)); + test(SV("-1_2#34567"), SV("{:L}"), F(-1.234567e1)); + test(SV("-12_3#4567"), SV("{:L}"), F(-1.234567e2)); + test(SV("-1_23_4#567"), SV("{:L}"), F(-1.234567e3)); + test(SV("-12_34_5#67"), SV("{:L}"), F(-1.234567e4)); + test(SV("-123_45_6#7"), SV("{:L}"), F(-1.234567e5)); + test(SV("-1_234_56_7"), SV("{:L}"), F(-1.234567e6)); + test(SV("-12_345_67_0"), SV("{:L}"), F(-1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("-1_23_456_70_0"), F(-1.234567e8)); - test<"{:L}">(SV("-1_2_34_567_00_0"), F(-1.234567e9)); - test<"{:L}">(SV("-1_2_3_45_670_00_0"), F(-1.234567e10)); - test<"{:L}">(SV("-1_2_3_4_56_700_00_0"), F(-1.234567e11)); - test<"{:L}">(SV("-1#234567e+12"), F(-1.234567e12)); - test<"{:L}">(SV("-1#234567e+13"), F(-1.234567e13)); + test(SV("-1_23_456_70_0"), SV("{:L}"), F(-1.234567e8)); + test(SV("-1_2_34_567_00_0"), SV("{:L}"), F(-1.234567e9)); + test(SV("-1_2_3_45_670_00_0"), SV("{:L}"), F(-1.234567e10)); + test(SV("-1_2_3_4_56_700_00_0"), SV("{:L}"), F(-1.234567e11)); + test(SV("-1#234567e+12"), SV("{:L}"), F(-1.234567e12)); + test(SV("-1#234567e+13"), SV("{:L}"), F(-1.234567e13)); } - test<"{:L}">(SV("1.234567e-06"), en_US, F(1.234567e-6)); - test<"{:L}">(SV("1.234567e-05"), en_US, F(1.234567e-5)); - test<"{:L}">(SV("0.0001234567"), en_US, F(1.234567e-4)); - test<"{:L}">(SV("0.001234567"), en_US, F(1.234567e-3)); - test<"{:L}">(SV("0.01234567"), en_US, F(1.234567e-2)); - test<"{:L}">(SV("0.1234567"), en_US, F(1.234567e-1)); - test<"{:L}">(SV("1.234567"), en_US, F(1.234567e0)); - test<"{:L}">(SV("12.34567"), en_US, F(1.234567e1)); - test<"{:L}">(SV("123.4567"), en_US, F(1.234567e2)); - test<"{:L}">(SV("1,234.567"), en_US, F(1.234567e3)); - test<"{:L}">(SV("12,345.67"), en_US, F(1.234567e4)); - test<"{:L}">(SV("123,456.7"), en_US, F(1.234567e5)); - test<"{:L}">(SV("1,234,567"), en_US, F(1.234567e6)); - test<"{:L}">(SV("12,345,670"), en_US, F(1.234567e7)); + test(SV("1.234567e-06"), en_US, SV("{:L}"), F(1.234567e-6)); + test(SV("1.234567e-05"), en_US, SV("{:L}"), F(1.234567e-5)); + test(SV("0.0001234567"), en_US, SV("{:L}"), F(1.234567e-4)); + test(SV("0.001234567"), en_US, SV("{:L}"), F(1.234567e-3)); + test(SV("0.01234567"), en_US, SV("{:L}"), F(1.234567e-2)); + test(SV("0.1234567"), en_US, SV("{:L}"), F(1.234567e-1)); + test(SV("1.234567"), en_US, SV("{:L}"), F(1.234567e0)); + test(SV("12.34567"), en_US, SV("{:L}"), F(1.234567e1)); + test(SV("123.4567"), en_US, SV("{:L}"), F(1.234567e2)); + test(SV("1,234.567"), en_US, SV("{:L}"), F(1.234567e3)); + test(SV("12,345.67"), en_US, SV("{:L}"), F(1.234567e4)); + test(SV("123,456.7"), en_US, SV("{:L}"), F(1.234567e5)); + test(SV("1,234,567"), en_US, SV("{:L}"), F(1.234567e6)); + test(SV("12,345,670"), en_US, SV("{:L}"), F(1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("123,456,700"), en_US, F(1.234567e8)); - test<"{:L}">(SV("1,234,567,000"), en_US, F(1.234567e9)); - test<"{:L}">(SV("12,345,670,000"), en_US, F(1.234567e10)); - test<"{:L}">(SV("123,456,700,000"), en_US, F(1.234567e11)); - test<"{:L}">(SV("1.234567e+12"), en_US, F(1.234567e12)); - test<"{:L}">(SV("1.234567e+13"), en_US, F(1.234567e13)); + test(SV("123,456,700"), en_US, SV("{:L}"), F(1.234567e8)); + test(SV("1,234,567,000"), en_US, SV("{:L}"), F(1.234567e9)); + test(SV("12,345,670,000"), en_US, SV("{:L}"), F(1.234567e10)); + test(SV("123,456,700,000"), en_US, SV("{:L}"), F(1.234567e11)); + test(SV("1.234567e+12"), en_US, SV("{:L}"), F(1.234567e12)); + test(SV("1.234567e+13"), en_US, SV("{:L}"), F(1.234567e13)); } - test<"{:L}">(SV("-1.234567e-06"), en_US, F(-1.234567e-6)); - test<"{:L}">(SV("-1.234567e-05"), en_US, F(-1.234567e-5)); - test<"{:L}">(SV("-0.0001234567"), en_US, F(-1.234567e-4)); - test<"{:L}">(SV("-0.001234567"), en_US, F(-1.234567e-3)); - test<"{:L}">(SV("-0.01234567"), en_US, F(-1.234567e-2)); - test<"{:L}">(SV("-0.1234567"), en_US, F(-1.234567e-1)); - test<"{:L}">(SV("-1.234567"), en_US, F(-1.234567e0)); - test<"{:L}">(SV("-12.34567"), en_US, F(-1.234567e1)); - test<"{:L}">(SV("-123.4567"), en_US, F(-1.234567e2)); - test<"{:L}">(SV("-1,234.567"), en_US, F(-1.234567e3)); - test<"{:L}">(SV("-12,345.67"), en_US, F(-1.234567e4)); - test<"{:L}">(SV("-123,456.7"), en_US, F(-1.234567e5)); - test<"{:L}">(SV("-1,234,567"), en_US, F(-1.234567e6)); - test<"{:L}">(SV("-12,345,670"), en_US, F(-1.234567e7)); + test(SV("-1.234567e-06"), en_US, SV("{:L}"), F(-1.234567e-6)); + test(SV("-1.234567e-05"), en_US, SV("{:L}"), F(-1.234567e-5)); + test(SV("-0.0001234567"), en_US, SV("{:L}"), F(-1.234567e-4)); + test(SV("-0.001234567"), en_US, SV("{:L}"), F(-1.234567e-3)); + test(SV("-0.01234567"), en_US, SV("{:L}"), F(-1.234567e-2)); + test(SV("-0.1234567"), en_US, SV("{:L}"), F(-1.234567e-1)); + test(SV("-1.234567"), en_US, SV("{:L}"), F(-1.234567e0)); + test(SV("-12.34567"), en_US, SV("{:L}"), F(-1.234567e1)); + test(SV("-123.4567"), en_US, SV("{:L}"), F(-1.234567e2)); + test(SV("-1,234.567"), en_US, SV("{:L}"), F(-1.234567e3)); + test(SV("-12,345.67"), en_US, SV("{:L}"), F(-1.234567e4)); + test(SV("-123,456.7"), en_US, SV("{:L}"), F(-1.234567e5)); + test(SV("-1,234,567"), en_US, SV("{:L}"), F(-1.234567e6)); + test(SV("-12,345,670"), en_US, SV("{:L}"), F(-1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("-123,456,700"), en_US, F(-1.234567e8)); - test<"{:L}">(SV("-1,234,567,000"), en_US, F(-1.234567e9)); - test<"{:L}">(SV("-12,345,670,000"), en_US, F(-1.234567e10)); - test<"{:L}">(SV("-123,456,700,000"), en_US, F(-1.234567e11)); - test<"{:L}">(SV("-1.234567e+12"), en_US, F(-1.234567e12)); - test<"{:L}">(SV("-1.234567e+13"), en_US, F(-1.234567e13)); + test(SV("-123,456,700"), en_US, SV("{:L}"), F(-1.234567e8)); + test(SV("-1,234,567,000"), en_US, SV("{:L}"), F(-1.234567e9)); + test(SV("-12,345,670,000"), en_US, SV("{:L}"), F(-1.234567e10)); + test(SV("-123,456,700,000"), en_US, SV("{:L}"), F(-1.234567e11)); + test(SV("-1.234567e+12"), en_US, SV("{:L}"), F(-1.234567e12)); + test(SV("-1.234567e+13"), en_US, SV("{:L}"), F(-1.234567e13)); } std::locale::global(en_US); - test<"{:L}">(SV("1#234567e-06"), loc, F(1.234567e-6)); - test<"{:L}">(SV("1#234567e-05"), loc, F(1.234567e-5)); - test<"{:L}">(SV("0#0001234567"), loc, F(1.234567e-4)); - test<"{:L}">(SV("0#001234567"), loc, F(1.234567e-3)); - test<"{:L}">(SV("0#01234567"), loc, F(1.234567e-2)); - test<"{:L}">(SV("0#1234567"), loc, F(1.234567e-1)); - test<"{:L}">(SV("1#234567"), loc, F(1.234567e0)); - test<"{:L}">(SV("1_2#34567"), loc, F(1.234567e1)); - test<"{:L}">(SV("12_3#4567"), loc, F(1.234567e2)); - test<"{:L}">(SV("1_23_4#567"), loc, F(1.234567e3)); - test<"{:L}">(SV("12_34_5#67"), loc, F(1.234567e4)); - test<"{:L}">(SV("123_45_6#7"), loc, F(1.234567e5)); - test<"{:L}">(SV("1_234_56_7"), loc, F(1.234567e6)); - test<"{:L}">(SV("12_345_67_0"), loc, F(1.234567e7)); + test(SV("1#234567e-06"), loc, SV("{:L}"), F(1.234567e-6)); + test(SV("1#234567e-05"), loc, SV("{:L}"), F(1.234567e-5)); + test(SV("0#0001234567"), loc, SV("{:L}"), F(1.234567e-4)); + test(SV("0#001234567"), loc, SV("{:L}"), F(1.234567e-3)); + test(SV("0#01234567"), loc, SV("{:L}"), F(1.234567e-2)); + test(SV("0#1234567"), loc, SV("{:L}"), F(1.234567e-1)); + test(SV("1#234567"), loc, SV("{:L}"), F(1.234567e0)); + test(SV("1_2#34567"), loc, SV("{:L}"), F(1.234567e1)); + test(SV("12_3#4567"), loc, SV("{:L}"), F(1.234567e2)); + test(SV("1_23_4#567"), loc, SV("{:L}"), F(1.234567e3)); + test(SV("12_34_5#67"), loc, SV("{:L}"), F(1.234567e4)); + test(SV("123_45_6#7"), loc, SV("{:L}"), F(1.234567e5)); + test(SV("1_234_56_7"), loc, SV("{:L}"), F(1.234567e6)); + test(SV("12_345_67_0"), loc, SV("{:L}"), F(1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("1_23_456_70_0"), loc, F(1.234567e8)); - test<"{:L}">(SV("1_2_34_567_00_0"), loc, F(1.234567e9)); - test<"{:L}">(SV("1_2_3_45_670_00_0"), loc, F(1.234567e10)); - test<"{:L}">(SV("1_2_3_4_56_700_00_0"), loc, F(1.234567e11)); - test<"{:L}">(SV("1#234567e+12"), loc, F(1.234567e12)); - test<"{:L}">(SV("1#234567e+13"), loc, F(1.234567e13)); + test(SV("1_23_456_70_0"), loc, SV("{:L}"), F(1.234567e8)); + test(SV("1_2_34_567_00_0"), loc, SV("{:L}"), F(1.234567e9)); + test(SV("1_2_3_45_670_00_0"), loc, SV("{:L}"), F(1.234567e10)); + test(SV("1_2_3_4_56_700_00_0"), loc, SV("{:L}"), F(1.234567e11)); + test(SV("1#234567e+12"), loc, SV("{:L}"), F(1.234567e12)); + test(SV("1#234567e+13"), loc, SV("{:L}"), F(1.234567e13)); } - test<"{:L}">(SV("-1#234567e-06"), loc, F(-1.234567e-6)); - test<"{:L}">(SV("-1#234567e-05"), loc, F(-1.234567e-5)); - test<"{:L}">(SV("-0#0001234567"), loc, F(-1.234567e-4)); - test<"{:L}">(SV("-0#001234567"), loc, F(-1.234567e-3)); - test<"{:L}">(SV("-0#01234567"), loc, F(-1.234567e-2)); - test<"{:L}">(SV("-0#1234567"), loc, F(-1.234567e-1)); - test<"{:L}">(SV("-1#234567"), loc, F(-1.234567e0)); - test<"{:L}">(SV("-1_2#34567"), loc, F(-1.234567e1)); - test<"{:L}">(SV("-12_3#4567"), loc, F(-1.234567e2)); - test<"{:L}">(SV("-1_23_4#567"), loc, F(-1.234567e3)); - test<"{:L}">(SV("-12_34_5#67"), loc, F(-1.234567e4)); - test<"{:L}">(SV("-123_45_6#7"), loc, F(-1.234567e5)); - test<"{:L}">(SV("-1_234_56_7"), loc, F(-1.234567e6)); - test<"{:L}">(SV("-12_345_67_0"), loc, F(-1.234567e7)); + test(SV("-1#234567e-06"), loc, SV("{:L}"), F(-1.234567e-6)); + test(SV("-1#234567e-05"), loc, SV("{:L}"), F(-1.234567e-5)); + test(SV("-0#0001234567"), loc, SV("{:L}"), F(-1.234567e-4)); + test(SV("-0#001234567"), loc, SV("{:L}"), F(-1.234567e-3)); + test(SV("-0#01234567"), loc, SV("{:L}"), F(-1.234567e-2)); + test(SV("-0#1234567"), loc, SV("{:L}"), F(-1.234567e-1)); + test(SV("-1#234567"), loc, SV("{:L}"), F(-1.234567e0)); + test(SV("-1_2#34567"), loc, SV("{:L}"), F(-1.234567e1)); + test(SV("-12_3#4567"), loc, SV("{:L}"), F(-1.234567e2)); + test(SV("-1_23_4#567"), loc, SV("{:L}"), F(-1.234567e3)); + test(SV("-12_34_5#67"), loc, SV("{:L}"), F(-1.234567e4)); + test(SV("-123_45_6#7"), loc, SV("{:L}"), F(-1.234567e5)); + test(SV("-1_234_56_7"), loc, SV("{:L}"), F(-1.234567e6)); + test(SV("-12_345_67_0"), loc, SV("{:L}"), F(-1.234567e7)); if constexpr (sizeof(F) > sizeof(float)) { - test<"{:L}">(SV("-1_23_456_70_0"), loc, F(-1.234567e8)); - test<"{:L}">(SV("-1_2_34_567_00_0"), loc, F(-1.234567e9)); - test<"{:L}">(SV("-1_2_3_45_670_00_0"), loc, F(-1.234567e10)); - test<"{:L}">(SV("-1_2_3_4_56_700_00_0"), loc, F(-1.234567e11)); - test<"{:L}">(SV("-1#234567e+12"), loc, F(-1.234567e12)); - test<"{:L}">(SV("-1#234567e+13"), loc, F(-1.234567e13)); + test(SV("-1_23_456_70_0"), loc, SV("{:L}"), F(-1.234567e8)); + test(SV("-1_2_34_567_00_0"), loc, SV("{:L}"), F(-1.234567e9)); + test(SV("-1_2_3_45_670_00_0"), loc, SV("{:L}"), F(-1.234567e10)); + test(SV("-1_2_3_4_56_700_00_0"), loc, SV("{:L}"), F(-1.234567e11)); + test(SV("-1#234567e+12"), loc, SV("{:L}"), F(-1.234567e12)); + test(SV("-1#234567e+13"), loc, SV("{:L}"), F(-1.234567e13)); } // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<12L}">(SV("1,234.567$$$"), F(1.234567e3)); - test<"{:$>12L}">(SV("$$$1,234.567"), F(1.234567e3)); - test<"{:$^12L}">(SV("$1,234.567$$"), F(1.234567e3)); - test<"{:012L}">(SV("0001,234.567"), F(1.234567e3)); - test<"{:$<13L}">(SV("-1,234.567$$$"), F(-1.234567e3)); - test<"{:$>13L}">(SV("$$$-1,234.567"), F(-1.234567e3)); - test<"{:$^13L}">(SV("$-1,234.567$$"), F(-1.234567e3)); - test<"{:013L}">(SV("-0001,234.567"), F(-1.234567e3)); + test(SV("1,234.567$$$"), SV("{:$<12L}"), F(1.234567e3)); + test(SV("$$$1,234.567"), SV("{:$>12L}"), F(1.234567e3)); + test(SV("$1,234.567$$"), SV("{:$^12L}"), F(1.234567e3)); + test(SV("0001,234.567"), SV("{:012L}"), F(1.234567e3)); + test(SV("-1,234.567$$$"), SV("{:$<13L}"), F(-1.234567e3)); + test(SV("$$$-1,234.567"), SV("{:$>13L}"), F(-1.234567e3)); + test(SV("$-1,234.567$$"), SV("{:$^13L}"), F(-1.234567e3)); + test(SV("-0001,234.567"), SV("{:013L}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<13L}">(SV("1_23_4#567$$$"), F(1.234567e3)); - test<"{:$>13L}">(SV("$$$1_23_4#567"), F(1.234567e3)); - test<"{:$^13L}">(SV("$1_23_4#567$$"), F(1.234567e3)); - test<"{:013L}">(SV("0001_23_4#567"), F(1.234567e3)); - test<"{:$<14L}">(SV("-1_23_4#567$$$"), F(-1.234567e3)); - test<"{:$>14L}">(SV("$$$-1_23_4#567"), F(-1.234567e3)); - test<"{:$^14L}">(SV("$-1_23_4#567$$"), F(-1.234567e3)); - test<"{:014L}">(SV("-0001_23_4#567"), F(-1.234567e3)); - - test<"{:$<12L}">(SV("1,234.567$$$"), en_US, F(1.234567e3)); - test<"{:$>12L}">(SV("$$$1,234.567"), en_US, F(1.234567e3)); - test<"{:$^12L}">(SV("$1,234.567$$"), en_US, F(1.234567e3)); - test<"{:012L}">(SV("0001,234.567"), en_US, F(1.234567e3)); - test<"{:$<13L}">(SV("-1,234.567$$$"), en_US, F(-1.234567e3)); - test<"{:$>13L}">(SV("$$$-1,234.567"), en_US, F(-1.234567e3)); - test<"{:$^13L}">(SV("$-1,234.567$$"), en_US, F(-1.234567e3)); - test<"{:013L}">(SV("-0001,234.567"), en_US, F(-1.234567e3)); + test(SV("1_23_4#567$$$"), SV("{:$<13L}"), F(1.234567e3)); + test(SV("$$$1_23_4#567"), SV("{:$>13L}"), F(1.234567e3)); + test(SV("$1_23_4#567$$"), SV("{:$^13L}"), F(1.234567e3)); + test(SV("0001_23_4#567"), SV("{:013L}"), F(1.234567e3)); + test(SV("-1_23_4#567$$$"), SV("{:$<14L}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567"), SV("{:$>14L}"), F(-1.234567e3)); + test(SV("$-1_23_4#567$$"), SV("{:$^14L}"), F(-1.234567e3)); + test(SV("-0001_23_4#567"), SV("{:014L}"), F(-1.234567e3)); + + test(SV("1,234.567$$$"), en_US, SV("{:$<12L}"), F(1.234567e3)); + test(SV("$$$1,234.567"), en_US, SV("{:$>12L}"), F(1.234567e3)); + test(SV("$1,234.567$$"), en_US, SV("{:$^12L}"), F(1.234567e3)); + test(SV("0001,234.567"), en_US, SV("{:012L}"), F(1.234567e3)); + test(SV("-1,234.567$$$"), en_US, SV("{:$<13L}"), F(-1.234567e3)); + test(SV("$$$-1,234.567"), en_US, SV("{:$>13L}"), F(-1.234567e3)); + test(SV("$-1,234.567$$"), en_US, SV("{:$^13L}"), F(-1.234567e3)); + test(SV("-0001,234.567"), en_US, SV("{:013L}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<13L}">(SV("1_23_4#567$$$"), loc, F(1.234567e3)); - test<"{:$>13L}">(SV("$$$1_23_4#567"), loc, F(1.234567e3)); - test<"{:$^13L}">(SV("$1_23_4#567$$"), loc, F(1.234567e3)); - test<"{:013L}">(SV("0001_23_4#567"), loc, F(1.234567e3)); - test<"{:$<14L}">(SV("-1_23_4#567$$$"), loc, F(-1.234567e3)); - test<"{:$>14L}">(SV("$$$-1_23_4#567"), loc, F(-1.234567e3)); - test<"{:$^14L}">(SV("$-1_23_4#567$$"), loc, F(-1.234567e3)); - test<"{:014L}">(SV("-0001_23_4#567"), loc, F(-1.234567e3)); + test(SV("1_23_4#567$$$"), loc, SV("{:$<13L}"), F(1.234567e3)); + test(SV("$$$1_23_4#567"), loc, SV("{:$>13L}"), F(1.234567e3)); + test(SV("$1_23_4#567$$"), loc, SV("{:$^13L}"), F(1.234567e3)); + test(SV("0001_23_4#567"), loc, SV("{:013L}"), F(1.234567e3)); + test(SV("-1_23_4#567$$$"), loc, SV("{:$<14L}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#567"), loc, SV("{:$>14L}"), F(-1.234567e3)); + test(SV("$-1_23_4#567$$"), loc, SV("{:$^14L}"), F(-1.234567e3)); + test(SV("-0001_23_4#567"), loc, SV("{:014L}"), F(-1.234567e3)); } template @@ -2133,163 +2132,163 @@ // *** Basic *** std::locale::global(en_US); - test<"{:.6L}">(SV("1.23457e-06"), F(1.234567e-6)); - test<"{:.6L}">(SV("1.23457e-05"), F(1.234567e-5)); - test<"{:.6L}">(SV("0.000123457"), F(1.234567e-4)); - test<"{:.6L}">(SV("0.00123457"), F(1.234567e-3)); - test<"{:.6L}">(SV("0.0123457"), F(1.234567e-2)); - test<"{:.6L}">(SV("0.123457"), F(1.234567e-1)); - test<"{:.6L}">(SV("1.23457"), F(1.234567e0)); - test<"{:.6L}">(SV("12.3457"), F(1.234567e1)); - test<"{:.6L}">(SV("123.457"), F(1.234567e2)); - test<"{:.6L}">(SV("1,234.57"), F(1.234567e3)); - test<"{:.6L}">(SV("12,345.7"), F(1.234567e4)); - test<"{:.6L}">(SV("123,457"), F(1.234567e5)); - test<"{:.6L}">(SV("1.23457e+06"), F(1.234567e6)); - test<"{:.6L}">(SV("1.23457e+07"), F(1.234567e7)); - test<"{:.6L}">(SV("-1.23457e-06"), F(-1.234567e-6)); - test<"{:.6L}">(SV("-1.23457e-05"), F(-1.234567e-5)); - test<"{:.6L}">(SV("-0.000123457"), F(-1.234567e-4)); - test<"{:.6L}">(SV("-0.00123457"), F(-1.234567e-3)); - test<"{:.6L}">(SV("-0.0123457"), F(-1.234567e-2)); - test<"{:.6L}">(SV("-0.123457"), F(-1.234567e-1)); - test<"{:.6L}">(SV("-1.23457"), F(-1.234567e0)); - test<"{:.6L}">(SV("-12.3457"), F(-1.234567e1)); - test<"{:.6L}">(SV("-123.457"), F(-1.234567e2)); - test<"{:.6L}">(SV("-1,234.57"), F(-1.234567e3)); - test<"{:.6L}">(SV("-12,345.7"), F(-1.234567e4)); - test<"{:.6L}">(SV("-123,457"), F(-1.234567e5)); - test<"{:.6L}">(SV("-1.23457e+06"), F(-1.234567e6)); - test<"{:.6L}">(SV("-1.23457e+07"), F(-1.234567e7)); + test(SV("1.23457e-06"), SV("{:.6L}"), F(1.234567e-6)); + test(SV("1.23457e-05"), SV("{:.6L}"), F(1.234567e-5)); + test(SV("0.000123457"), SV("{:.6L}"), F(1.234567e-4)); + test(SV("0.00123457"), SV("{:.6L}"), F(1.234567e-3)); + test(SV("0.0123457"), SV("{:.6L}"), F(1.234567e-2)); + test(SV("0.123457"), SV("{:.6L}"), F(1.234567e-1)); + test(SV("1.23457"), SV("{:.6L}"), F(1.234567e0)); + test(SV("12.3457"), SV("{:.6L}"), F(1.234567e1)); + test(SV("123.457"), SV("{:.6L}"), F(1.234567e2)); + test(SV("1,234.57"), SV("{:.6L}"), F(1.234567e3)); + test(SV("12,345.7"), SV("{:.6L}"), F(1.234567e4)); + test(SV("123,457"), SV("{:.6L}"), F(1.234567e5)); + test(SV("1.23457e+06"), SV("{:.6L}"), F(1.234567e6)); + test(SV("1.23457e+07"), SV("{:.6L}"), F(1.234567e7)); + test(SV("-1.23457e-06"), SV("{:.6L}"), F(-1.234567e-6)); + test(SV("-1.23457e-05"), SV("{:.6L}"), F(-1.234567e-5)); + test(SV("-0.000123457"), SV("{:.6L}"), F(-1.234567e-4)); + test(SV("-0.00123457"), SV("{:.6L}"), F(-1.234567e-3)); + test(SV("-0.0123457"), SV("{:.6L}"), F(-1.234567e-2)); + test(SV("-0.123457"), SV("{:.6L}"), F(-1.234567e-1)); + test(SV("-1.23457"), SV("{:.6L}"), F(-1.234567e0)); + test(SV("-12.3457"), SV("{:.6L}"), F(-1.234567e1)); + test(SV("-123.457"), SV("{:.6L}"), F(-1.234567e2)); + test(SV("-1,234.57"), SV("{:.6L}"), F(-1.234567e3)); + test(SV("-12,345.7"), SV("{:.6L}"), F(-1.234567e4)); + test(SV("-123,457"), SV("{:.6L}"), F(-1.234567e5)); + test(SV("-1.23457e+06"), SV("{:.6L}"), F(-1.234567e6)); + test(SV("-1.23457e+07"), SV("{:.6L}"), F(-1.234567e7)); std::locale::global(loc); - test<"{:.6L}">(SV("1#23457e-06"), F(1.234567e-6)); - test<"{:.6L}">(SV("1#23457e-05"), F(1.234567e-5)); - test<"{:.6L}">(SV("0#000123457"), F(1.234567e-4)); - test<"{:.6L}">(SV("0#00123457"), F(1.234567e-3)); - test<"{:.6L}">(SV("0#0123457"), F(1.234567e-2)); - test<"{:.6L}">(SV("0#123457"), F(1.234567e-1)); - test<"{:.6L}">(SV("1#23457"), F(1.234567e0)); - test<"{:.6L}">(SV("1_2#3457"), F(1.234567e1)); - test<"{:.6L}">(SV("12_3#457"), F(1.234567e2)); - test<"{:.6L}">(SV("1_23_4#57"), F(1.234567e3)); - test<"{:.6L}">(SV("12_34_5#7"), F(1.234567e4)); - test<"{:.6L}">(SV("123_45_7"), F(1.234567e5)); - test<"{:.6L}">(SV("1#23457e+06"), F(1.234567e6)); - test<"{:.6L}">(SV("1#23457e+07"), F(1.234567e7)); - test<"{:.6L}">(SV("-1#23457e-06"), F(-1.234567e-6)); - test<"{:.6L}">(SV("-1#23457e-05"), F(-1.234567e-5)); - test<"{:.6L}">(SV("-0#000123457"), F(-1.234567e-4)); - test<"{:.6L}">(SV("-0#00123457"), F(-1.234567e-3)); - test<"{:.6L}">(SV("-0#0123457"), F(-1.234567e-2)); - test<"{:.6L}">(SV("-0#123457"), F(-1.234567e-1)); - test<"{:.6L}">(SV("-1#23457"), F(-1.234567e0)); - test<"{:.6L}">(SV("-1_2#3457"), F(-1.234567e1)); - test<"{:.6L}">(SV("-12_3#457"), F(-1.234567e2)); - test<"{:.6L}">(SV("-1_23_4#57"), F(-1.234567e3)); - test<"{:.6L}">(SV("-12_34_5#7"), F(-1.234567e4)); - test<"{:.6L}">(SV("-123_45_7"), F(-1.234567e5)); - test<"{:.6L}">(SV("-1#23457e+06"), F(-1.234567e6)); - test<"{:.6L}">(SV("-1#23457e+07"), F(-1.234567e7)); - - test<"{:.6L}">(SV("1.23457e-06"), en_US, F(1.234567e-6)); - test<"{:.6L}">(SV("1.23457e-05"), en_US, F(1.234567e-5)); - test<"{:.6L}">(SV("0.000123457"), en_US, F(1.234567e-4)); - test<"{:.6L}">(SV("0.00123457"), en_US, F(1.234567e-3)); - test<"{:.6L}">(SV("0.0123457"), en_US, F(1.234567e-2)); - test<"{:.6L}">(SV("0.123457"), en_US, F(1.234567e-1)); - test<"{:.6L}">(SV("1.23457"), en_US, F(1.234567e0)); - test<"{:.6L}">(SV("12.3457"), en_US, F(1.234567e1)); - test<"{:.6L}">(SV("123.457"), en_US, F(1.234567e2)); - test<"{:.6L}">(SV("1,234.57"), en_US, F(1.234567e3)); - test<"{:.6L}">(SV("12,345.7"), en_US, F(1.234567e4)); - test<"{:.6L}">(SV("123,457"), en_US, F(1.234567e5)); - test<"{:.6L}">(SV("1.23457e+06"), en_US, F(1.234567e6)); - test<"{:.6L}">(SV("1.23457e+07"), en_US, F(1.234567e7)); - test<"{:.6L}">(SV("-1.23457e-06"), en_US, F(-1.234567e-6)); - test<"{:.6L}">(SV("-1.23457e-05"), en_US, F(-1.234567e-5)); - test<"{:.6L}">(SV("-0.000123457"), en_US, F(-1.234567e-4)); - test<"{:.6L}">(SV("-0.00123457"), en_US, F(-1.234567e-3)); - test<"{:.6L}">(SV("-0.0123457"), en_US, F(-1.234567e-2)); - test<"{:.6L}">(SV("-0.123457"), en_US, F(-1.234567e-1)); - test<"{:.6L}">(SV("-1.23457"), en_US, F(-1.234567e0)); - test<"{:.6L}">(SV("-12.3457"), en_US, F(-1.234567e1)); - test<"{:.6L}">(SV("-123.457"), en_US, F(-1.234567e2)); - test<"{:.6L}">(SV("-1,234.57"), en_US, F(-1.234567e3)); - test<"{:.6L}">(SV("-12,345.7"), en_US, F(-1.234567e4)); - test<"{:.6L}">(SV("-123,457"), en_US, F(-1.234567e5)); - test<"{:.6L}">(SV("-1.23457e+06"), en_US, F(-1.234567e6)); - test<"{:.6L}">(SV("-1.23457e+07"), en_US, F(-1.234567e7)); + test(SV("1#23457e-06"), SV("{:.6L}"), F(1.234567e-6)); + test(SV("1#23457e-05"), SV("{:.6L}"), F(1.234567e-5)); + test(SV("0#000123457"), SV("{:.6L}"), F(1.234567e-4)); + test(SV("0#00123457"), SV("{:.6L}"), F(1.234567e-3)); + test(SV("0#0123457"), SV("{:.6L}"), F(1.234567e-2)); + test(SV("0#123457"), SV("{:.6L}"), F(1.234567e-1)); + test(SV("1#23457"), SV("{:.6L}"), F(1.234567e0)); + test(SV("1_2#3457"), SV("{:.6L}"), F(1.234567e1)); + test(SV("12_3#457"), SV("{:.6L}"), F(1.234567e2)); + test(SV("1_23_4#57"), SV("{:.6L}"), F(1.234567e3)); + test(SV("12_34_5#7"), SV("{:.6L}"), F(1.234567e4)); + test(SV("123_45_7"), SV("{:.6L}"), F(1.234567e5)); + test(SV("1#23457e+06"), SV("{:.6L}"), F(1.234567e6)); + test(SV("1#23457e+07"), SV("{:.6L}"), F(1.234567e7)); + test(SV("-1#23457e-06"), SV("{:.6L}"), F(-1.234567e-6)); + test(SV("-1#23457e-05"), SV("{:.6L}"), F(-1.234567e-5)); + test(SV("-0#000123457"), SV("{:.6L}"), F(-1.234567e-4)); + test(SV("-0#00123457"), SV("{:.6L}"), F(-1.234567e-3)); + test(SV("-0#0123457"), SV("{:.6L}"), F(-1.234567e-2)); + test(SV("-0#123457"), SV("{:.6L}"), F(-1.234567e-1)); + test(SV("-1#23457"), SV("{:.6L}"), F(-1.234567e0)); + test(SV("-1_2#3457"), SV("{:.6L}"), F(-1.234567e1)); + test(SV("-12_3#457"), SV("{:.6L}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), SV("{:.6L}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), SV("{:.6L}"), F(-1.234567e4)); + test(SV("-123_45_7"), SV("{:.6L}"), F(-1.234567e5)); + test(SV("-1#23457e+06"), SV("{:.6L}"), F(-1.234567e6)); + test(SV("-1#23457e+07"), SV("{:.6L}"), F(-1.234567e7)); + + test(SV("1.23457e-06"), en_US, SV("{:.6L}"), F(1.234567e-6)); + test(SV("1.23457e-05"), en_US, SV("{:.6L}"), F(1.234567e-5)); + test(SV("0.000123457"), en_US, SV("{:.6L}"), F(1.234567e-4)); + test(SV("0.00123457"), en_US, SV("{:.6L}"), F(1.234567e-3)); + test(SV("0.0123457"), en_US, SV("{:.6L}"), F(1.234567e-2)); + test(SV("0.123457"), en_US, SV("{:.6L}"), F(1.234567e-1)); + test(SV("1.23457"), en_US, SV("{:.6L}"), F(1.234567e0)); + test(SV("12.3457"), en_US, SV("{:.6L}"), F(1.234567e1)); + test(SV("123.457"), en_US, SV("{:.6L}"), F(1.234567e2)); + test(SV("1,234.57"), en_US, SV("{:.6L}"), F(1.234567e3)); + test(SV("12,345.7"), en_US, SV("{:.6L}"), F(1.234567e4)); + test(SV("123,457"), en_US, SV("{:.6L}"), F(1.234567e5)); + test(SV("1.23457e+06"), en_US, SV("{:.6L}"), F(1.234567e6)); + test(SV("1.23457e+07"), en_US, SV("{:.6L}"), F(1.234567e7)); + test(SV("-1.23457e-06"), en_US, SV("{:.6L}"), F(-1.234567e-6)); + test(SV("-1.23457e-05"), en_US, SV("{:.6L}"), F(-1.234567e-5)); + test(SV("-0.000123457"), en_US, SV("{:.6L}"), F(-1.234567e-4)); + test(SV("-0.00123457"), en_US, SV("{:.6L}"), F(-1.234567e-3)); + test(SV("-0.0123457"), en_US, SV("{:.6L}"), F(-1.234567e-2)); + test(SV("-0.123457"), en_US, SV("{:.6L}"), F(-1.234567e-1)); + test(SV("-1.23457"), en_US, SV("{:.6L}"), F(-1.234567e0)); + test(SV("-12.3457"), en_US, SV("{:.6L}"), F(-1.234567e1)); + test(SV("-123.457"), en_US, SV("{:.6L}"), F(-1.234567e2)); + test(SV("-1,234.57"), en_US, SV("{:.6L}"), F(-1.234567e3)); + test(SV("-12,345.7"), en_US, SV("{:.6L}"), F(-1.234567e4)); + test(SV("-123,457"), en_US, SV("{:.6L}"), F(-1.234567e5)); + test(SV("-1.23457e+06"), en_US, SV("{:.6L}"), F(-1.234567e6)); + test(SV("-1.23457e+07"), en_US, SV("{:.6L}"), F(-1.234567e7)); std::locale::global(en_US); - test<"{:.6L}">(SV("1#23457e-06"), loc, F(1.234567e-6)); - test<"{:.6L}">(SV("1#23457e-05"), loc, F(1.234567e-5)); - test<"{:.6L}">(SV("0#000123457"), loc, F(1.234567e-4)); - test<"{:.6L}">(SV("0#00123457"), loc, F(1.234567e-3)); - test<"{:.6L}">(SV("0#0123457"), loc, F(1.234567e-2)); - test<"{:.6L}">(SV("0#123457"), loc, F(1.234567e-1)); - test<"{:.6L}">(SV("1#23457"), loc, F(1.234567e0)); - test<"{:.6L}">(SV("1_2#3457"), loc, F(1.234567e1)); - test<"{:.6L}">(SV("12_3#457"), loc, F(1.234567e2)); - test<"{:.6L}">(SV("1_23_4#57"), loc, F(1.234567e3)); - test<"{:.6L}">(SV("12_34_5#7"), loc, F(1.234567e4)); - test<"{:.6L}">(SV("123_45_7"), loc, F(1.234567e5)); - test<"{:.6L}">(SV("1#23457e+06"), loc, F(1.234567e6)); - test<"{:.6L}">(SV("1#23457e+07"), loc, F(1.234567e7)); - test<"{:.6L}">(SV("-1#23457e-06"), loc, F(-1.234567e-6)); - test<"{:.6L}">(SV("-1#23457e-05"), loc, F(-1.234567e-5)); - test<"{:.6L}">(SV("-0#000123457"), loc, F(-1.234567e-4)); - test<"{:.6L}">(SV("-0#00123457"), loc, F(-1.234567e-3)); - test<"{:.6L}">(SV("-0#0123457"), loc, F(-1.234567e-2)); - test<"{:.6L}">(SV("-0#123457"), loc, F(-1.234567e-1)); - test<"{:.6L}">(SV("-1#23457"), loc, F(-1.234567e0)); - test<"{:.6L}">(SV("-1_2#3457"), loc, F(-1.234567e1)); - test<"{:.6L}">(SV("-12_3#457"), loc, F(-1.234567e2)); - test<"{:.6L}">(SV("-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:.6L}">(SV("-12_34_5#7"), loc, F(-1.234567e4)); - test<"{:.6L}">(SV("-123_45_7"), loc, F(-1.234567e5)); - test<"{:.6L}">(SV("-1#23457e+06"), loc, F(-1.234567e6)); - test<"{:.6L}">(SV("-1#23457e+07"), loc, F(-1.234567e7)); + test(SV("1#23457e-06"), loc, SV("{:.6L}"), F(1.234567e-6)); + test(SV("1#23457e-05"), loc, SV("{:.6L}"), F(1.234567e-5)); + test(SV("0#000123457"), loc, SV("{:.6L}"), F(1.234567e-4)); + test(SV("0#00123457"), loc, SV("{:.6L}"), F(1.234567e-3)); + test(SV("0#0123457"), loc, SV("{:.6L}"), F(1.234567e-2)); + test(SV("0#123457"), loc, SV("{:.6L}"), F(1.234567e-1)); + test(SV("1#23457"), loc, SV("{:.6L}"), F(1.234567e0)); + test(SV("1_2#3457"), loc, SV("{:.6L}"), F(1.234567e1)); + test(SV("12_3#457"), loc, SV("{:.6L}"), F(1.234567e2)); + test(SV("1_23_4#57"), loc, SV("{:.6L}"), F(1.234567e3)); + test(SV("12_34_5#7"), loc, SV("{:.6L}"), F(1.234567e4)); + test(SV("123_45_7"), loc, SV("{:.6L}"), F(1.234567e5)); + test(SV("1#23457e+06"), loc, SV("{:.6L}"), F(1.234567e6)); + test(SV("1#23457e+07"), loc, SV("{:.6L}"), F(1.234567e7)); + test(SV("-1#23457e-06"), loc, SV("{:.6L}"), F(-1.234567e-6)); + test(SV("-1#23457e-05"), loc, SV("{:.6L}"), F(-1.234567e-5)); + test(SV("-0#000123457"), loc, SV("{:.6L}"), F(-1.234567e-4)); + test(SV("-0#00123457"), loc, SV("{:.6L}"), F(-1.234567e-3)); + test(SV("-0#0123457"), loc, SV("{:.6L}"), F(-1.234567e-2)); + test(SV("-0#123457"), loc, SV("{:.6L}"), F(-1.234567e-1)); + test(SV("-1#23457"), loc, SV("{:.6L}"), F(-1.234567e0)); + test(SV("-1_2#3457"), loc, SV("{:.6L}"), F(-1.234567e1)); + test(SV("-12_3#457"), loc, SV("{:.6L}"), F(-1.234567e2)); + test(SV("-1_23_4#57"), loc, SV("{:.6L}"), F(-1.234567e3)); + test(SV("-12_34_5#7"), loc, SV("{:.6L}"), F(-1.234567e4)); + test(SV("-123_45_7"), loc, SV("{:.6L}"), F(-1.234567e5)); + test(SV("-1#23457e+06"), loc, SV("{:.6L}"), F(-1.234567e6)); + test(SV("-1#23457e+07"), loc, SV("{:.6L}"), F(-1.234567e7)); // *** Fill, align, zero padding *** std::locale::global(en_US); - test<"{:$<11.6L}">(SV("1,234.57$$$"), F(1.234567e3)); - test<"{:$>11.6L}">(SV("$$$1,234.57"), F(1.234567e3)); - test<"{:$^11.6L}">(SV("$1,234.57$$"), F(1.234567e3)); - test<"{:011.6L}">(SV("0001,234.57"), F(1.234567e3)); - test<"{:$<12.6L}">(SV("-1,234.57$$$"), F(-1.234567e3)); - test<"{:$>12.6L}">(SV("$$$-1,234.57"), F(-1.234567e3)); - test<"{:$^12.6L}">(SV("$-1,234.57$$"), F(-1.234567e3)); - test<"{:012.6L}">(SV("-0001,234.57"), F(-1.234567e3)); + test(SV("1,234.57$$$"), SV("{:$<11.6L}"), F(1.234567e3)); + test(SV("$$$1,234.57"), SV("{:$>11.6L}"), F(1.234567e3)); + test(SV("$1,234.57$$"), SV("{:$^11.6L}"), F(1.234567e3)); + test(SV("0001,234.57"), SV("{:011.6L}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), SV("{:$<12.6L}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), SV("{:$>12.6L}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), SV("{:$^12.6L}"), F(-1.234567e3)); + test(SV("-0001,234.57"), SV("{:012.6L}"), F(-1.234567e3)); std::locale::global(loc); - test<"{:$<12.6L}">(SV("1_23_4#57$$$"), F(1.234567e3)); - test<"{:$>12.6L}">(SV("$$$1_23_4#57"), F(1.234567e3)); - test<"{:$^12.6L}">(SV("$1_23_4#57$$"), F(1.234567e3)); - test<"{:012.6L}">(SV("0001_23_4#57"), F(1.234567e3)); - test<"{:$<13.6L}">(SV("-1_23_4#57$$$"), F(-1.234567e3)); - test<"{:$>13.6L}">(SV("$$$-1_23_4#57"), F(-1.234567e3)); - test<"{:$^13.6L}">(SV("$-1_23_4#57$$"), F(-1.234567e3)); - test<"{:013.6L}">(SV("-0001_23_4#57"), F(-1.234567e3)); - - test<"{:$<11.6L}">(SV("1,234.57$$$"), en_US, F(1.234567e3)); - test<"{:$>11.6L}">(SV("$$$1,234.57"), en_US, F(1.234567e3)); - test<"{:$^11.6L}">(SV("$1,234.57$$"), en_US, F(1.234567e3)); - test<"{:011.6L}">(SV("0001,234.57"), en_US, F(1.234567e3)); - test<"{:$<12.6L}">(SV("-1,234.57$$$"), en_US, F(-1.234567e3)); - test<"{:$>12.6L}">(SV("$$$-1,234.57"), en_US, F(-1.234567e3)); - test<"{:$^12.6L}">(SV("$-1,234.57$$"), en_US, F(-1.234567e3)); - test<"{:012.6L}">(SV("-0001,234.57"), en_US, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), SV("{:$<12.6L}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), SV("{:$>12.6L}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), SV("{:$^12.6L}"), F(1.234567e3)); + test(SV("0001_23_4#57"), SV("{:012.6L}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), SV("{:$<13.6L}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), SV("{:$>13.6L}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), SV("{:$^13.6L}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), SV("{:013.6L}"), F(-1.234567e3)); + + test(SV("1,234.57$$$"), en_US, SV("{:$<11.6L}"), F(1.234567e3)); + test(SV("$$$1,234.57"), en_US, SV("{:$>11.6L}"), F(1.234567e3)); + test(SV("$1,234.57$$"), en_US, SV("{:$^11.6L}"), F(1.234567e3)); + test(SV("0001,234.57"), en_US, SV("{:011.6L}"), F(1.234567e3)); + test(SV("-1,234.57$$$"), en_US, SV("{:$<12.6L}"), F(-1.234567e3)); + test(SV("$$$-1,234.57"), en_US, SV("{:$>12.6L}"), F(-1.234567e3)); + test(SV("$-1,234.57$$"), en_US, SV("{:$^12.6L}"), F(-1.234567e3)); + test(SV("-0001,234.57"), en_US, SV("{:012.6L}"), F(-1.234567e3)); std::locale::global(en_US); - test<"{:$<12.6L}">(SV("1_23_4#57$$$"), loc, F(1.234567e3)); - test<"{:$>12.6L}">(SV("$$$1_23_4#57"), loc, F(1.234567e3)); - test<"{:$^12.6L}">(SV("$1_23_4#57$$"), loc, F(1.234567e3)); - test<"{:012.6L}">(SV("0001_23_4#57"), loc, F(1.234567e3)); - test<"{:$<13.6L}">(SV("-1_23_4#57$$$"), loc, F(-1.234567e3)); - test<"{:$>13.6L}">(SV("$$$-1_23_4#57"), loc, F(-1.234567e3)); - test<"{:$^13.6L}">(SV("$-1_23_4#57$$"), loc, F(-1.234567e3)); - test<"{:013.6L}">(SV("-0001_23_4#57"), loc, F(-1.234567e3)); + test(SV("1_23_4#57$$$"), loc, SV("{:$<12.6L}"), F(1.234567e3)); + test(SV("$$$1_23_4#57"), loc, SV("{:$>12.6L}"), F(1.234567e3)); + test(SV("$1_23_4#57$$"), loc, SV("{:$^12.6L}"), F(1.234567e3)); + test(SV("0001_23_4#57"), loc, SV("{:012.6L}"), F(1.234567e3)); + test(SV("-1_23_4#57$$$"), loc, SV("{:$<13.6L}"), F(-1.234567e3)); + test(SV("$$$-1_23_4#57"), loc, SV("{:$>13.6L}"), F(-1.234567e3)); + test(SV("$-1_23_4#57$$"), loc, SV("{:$^13.6L}"), F(-1.234567e3)); + test(SV("-0001_23_4#57"), loc, SV("{:013.6L}"), F(-1.234567e3)); } template diff --git a/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp b/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp @@ -29,6 +29,7 @@ #include "make_string.h" #include "test_macros.h" #include "string_literal.h" +#include "test_format_string.h" #ifndef TEST_HAS_NO_LOCALIZATION # include @@ -37,14 +38,14 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) -auto check = []( - std::basic_string_view expected, const Args&... args) constexpr { - std::basic_string out = std::format(fmt.template sv(), args...); +template < class CharT, class... Args> +void check(std::basic_string_view expected, test_format_string fmt, Args&&... args) { + std::basic_string out = std::format(fmt, std::forward(args)...); #ifndef TEST_HAS_NO_LOCALIZATION if constexpr (std::same_as) if (out != expected) - std::cerr << "\nFormat string " << fmt.template sv() << "\nExpected output " << expected - << "\nActual output " << out << '\n'; + std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " << out + << '\n'; #endif assert(out == expected); }; @@ -52,62 +53,61 @@ template static void test_single_code_point_fill() { //*** 1-byte code points *** - check.template operator()<"{:*^3}">(SV("* *"), SV(" ")); - check.template operator()<"{:*^3}">(SV("*~*"), SV("~")); + check(SV("* *"), SV("{:*^3}"), SV(" ")); + check(SV("*~*"), SV("{:*^3}"), SV("~")); //*** 2-byte code points *** - check.template operator()<"{:*^3}">(SV("*\u00a1*"), SV("\u00a1")); // INVERTED EXCLAMATION MARK - check.template operator()<"{:*^3}">(SV("*\u07ff*"), SV("\u07ff")); // NKO TAMAN SIGN + check(SV("*\u00a1*"), SV("{:*^3}"), SV("\u00a1")); // INVERTED EXCLAMATION MARK + check(SV("*\u07ff*"), SV("{:*^3}"), SV("\u07ff")); // NKO TAMAN SIGN //*** 3-byte code points *** - check.template operator()<"{:*^3}">(SV("*\u0800*"), SV("\u0800")); // SAMARITAN LETTER ALAF - check.template operator()<"{:*^3}">(SV("*\ufffd*"), SV("\ufffd")); // REPLACEMENT CHARACTER + check(SV("*\u0800*"), SV("{:*^3}"), SV("\u0800")); // SAMARITAN LETTER ALAF + check(SV("*\ufffd*"), SV("{:*^3}"), SV("\ufffd")); // REPLACEMENT CHARACTER // 2 column ranges - check.template operator()<"{:*^4}">(SV("*\u1100*"), SV("\u1100")); // HANGUL CHOSEONG KIYEOK - check.template operator()<"{:*^4}">(SV("*\u115f*"), SV("\u115f")); // HANGUL CHOSEONG FILLER + check(SV("*\u1100*"), SV("{:*^4}"), SV("\u1100")); // HANGUL CHOSEONG KIYEOK + check(SV("*\u115f*"), SV("{:*^4}"), SV("\u115f")); // HANGUL CHOSEONG FILLER - check.template operator()<"{:*^4}">(SV("*\u2329*"), SV("\u2329")); // LEFT-POINTING ANGLE BRACKET - check.template operator()<"{:*^4}">(SV("*\u232a*"), SV("\u232a")); // RIGHT-POINTING ANGLE BRACKET + check(SV("*\u2329*"), SV("{:*^4}"), SV("\u2329")); // LEFT-POINTING ANGLE BRACKET + check(SV("*\u232a*"), SV("{:*^4}"), SV("\u232a")); // RIGHT-POINTING ANGLE BRACKET - check.template operator()<"{:*^4}">(SV("*\u2e80*"), SV("\u2e80")); // CJK RADICAL REPEAT - check.template operator()<"{:*^4}">(SV("*\u303e*"), SV("\u303e")); // IDEOGRAPHIC VARIATION INDICATOR + check(SV("*\u2e80*"), SV("{:*^4}"), SV("\u2e80")); // CJK RADICAL REPEAT + check(SV("*\u303e*"), SV("{:*^4}"), SV("\u303e")); // IDEOGRAPHIC VARIATION INDICATOR - check.template operator()<"{:*^4}">(SV("*\u3040*"), SV("\u3040")); // U+3041 HIRAGANA LETTER SMALL A - check.template operator()<"{:*^4}">(SV("*\ua4cf*"), SV("\ua4cf")); // U+A4D0 LISU LETTER BA + check(SV("*\u3040*"), SV("{:*^4}"), SV("\u3040")); // U+3041 HIRAGANA LETTER SMALL A + check(SV("*\ua4cf*"), SV("{:*^4}"), SV("\ua4cf")); // U+A4D0 LISU LETTER BA - check.template operator()<"{:*^4}">(SV("*\uac00*"), SV("\uac00")); // - check.template operator()<"{:*^4}">(SV("*\ud7a3*"), SV("\ud7a3")); // Hangul Syllable Hih + check(SV("*\uac00*"), SV("{:*^4}"), SV("\uac00")); // + check(SV("*\ud7a3*"), SV("{:*^4}"), SV("\ud7a3")); // Hangul Syllable Hih - check.template operator()<"{:*^4}">(SV("*\uf900*"), SV("\uf900")); // CJK COMPATIBILITY IDEOGRAPH-F900 - check.template operator()<"{:*^4}">(SV("*\ufaff*"), SV("\ufaff")); // U+FB00 LATIN SMALL LIGATURE FF + check(SV("*\uf900*"), SV("{:*^4}"), SV("\uf900")); // CJK COMPATIBILITY IDEOGRAPH-F900 + check(SV("*\ufaff*"), SV("{:*^4}"), SV("\ufaff")); // U+FB00 LATIN SMALL LIGATURE FF - check.template operator()<"{:*^4}">(SV("*\ufe10*"), SV("\ufe10")); // PRESENTATION FORM FOR VERTICAL COMMA - check.template - operator()<"{:*^4}">(SV("*\ufe19*"), SV("\ufe19")); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS + check(SV("*\ufe10*"), SV("{:*^4}"), SV("\ufe10")); // PRESENTATION FORM FOR VERTICAL COMMA + check(SV("*\ufe19*"), SV("{:*^4}"), SV("\ufe19")); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS - check.template operator()<"{:*^4}">(SV("*\ufe30*"), SV("\ufe30")); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER - check.template operator()<"{:*^4}">(SV("*\ufe6f*"), SV("\ufe6f")); // U+FE70 ARABIC FATHATAN ISOLATED FORM + check(SV("*\ufe30*"), SV("{:*^4}"), SV("\ufe30")); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER + check(SV("*\ufe6f*"), SV("{:*^4}"), SV("\ufe6f")); // U+FE70 ARABIC FATHATAN ISOLATED FORM - check.template operator()<"{:*^4}">(SV("*\uff00*"), SV("\uff00")); // U+FF01 FULLWIDTH EXCLAMATION MARK - check.template operator()<"{:*^4}">(SV("*\uff60*"), SV("\uff60")); // FULLWIDTH RIGHT WHITE PARENTHESIS + check(SV("*\uff00*"), SV("{:*^4}"), SV("\uff00")); // U+FF01 FULLWIDTH EXCLAMATION MARK + check(SV("*\uff60*"), SV("{:*^4}"), SV("\uff60")); // FULLWIDTH RIGHT WHITE PARENTHESIS - check.template operator()<"{:*^4}">(SV("*\uffe0*"), SV("\uffe0")); // FULLWIDTH CENT SIGN - check.template operator()<"{:*^4}">(SV("*\uffe6*"), SV("\uffe6")); // FULLWIDTH WON SIGN + check(SV("*\uffe0*"), SV("{:*^4}"), SV("\uffe0")); // FULLWIDTH CENT SIGN + check(SV("*\uffe6*"), SV("{:*^4}"), SV("\uffe6")); // FULLWIDTH WON SIGN //*** 4-byte code points *** - check.template operator()<"{:*^3}">(SV("*\U00010000*"), SV("\U00010000")); // LINEAR B SYLLABLE B008 A - check.template operator()<"{:*^3}">(SV("*\U0010FFFF*"), SV("\U0010FFFF")); // Undefined Character + check(SV("*\U00010000*"), SV("{:*^3}"), SV("\U00010000")); // LINEAR B SYLLABLE B008 A + check(SV("*\U0010FFFF*"), SV("{:*^3}"), SV("\U0010FFFF")); // Undefined Character // 2 column ranges - check.template operator()<"{:*^4}">(SV("*\U0001f300*"), SV("\U0001f300")); // CYCLONE - check.template operator()<"{:*^4}">(SV("*\U0001f64f*"), SV("\U0001f64f")); // PERSON WITH FOLDED HANDS - check.template operator()<"{:*^4}">(SV("*\U0001f900*"), SV("\U0001f900")); // CIRCLED CROSS FORMEE WITH FOUR DOTS - check.template operator()<"{:*^4}">(SV("*\U0001f9ff*"), SV("\U0001f9ff")); // NAZAR AMULET - check.template operator()<"{:*^4}">(SV("*\U00020000*"), SV("\U00020000")); // - check.template operator()<"{:*^4}">(SV("*\U0002fffd*"), SV("\U0002fffd")); // Undefined Character - check.template operator()<"{:*^4}">(SV("*\U00030000*"), SV("\U00030000")); // - check.template operator()<"{:*^4}">(SV("*\U0003fffd*"), SV("\U0003fffd")); // Undefined Character + check(SV("*\U0001f300*"), SV("{:*^4}"), SV("\U0001f300")); // CYCLONE + check(SV("*\U0001f64f*"), SV("{:*^4}"), SV("\U0001f64f")); // PERSON WITH FOLDED HANDS + check(SV("*\U0001f900*"), SV("{:*^4}"), SV("\U0001f900")); // CIRCLED CROSS FORMEE WITH FOUR DOTS + check(SV("*\U0001f9ff*"), SV("{:*^4}"), SV("\U0001f9ff")); // NAZAR AMULET + check(SV("*\U00020000*"), SV("{:*^4}"), SV("\U00020000")); // + check(SV("*\U0002fffd*"), SV("{:*^4}"), SV("\U0002fffd")); // Undefined Character + check(SV("*\U00030000*"), SV("{:*^4}"), SV("\U00030000")); // + check(SV("*\U0003fffd*"), SV("{:*^4}"), SV("\U0003fffd")); // Undefined Character } // One column output is unaffected. @@ -115,122 +115,122 @@ template static void test_single_code_point_truncate() { //*** 1-byte code points *** - check.template operator()<"{:*^3.1}">(SV("* *"), SV(" ")); - check.template operator()<"{:*^3.1}">(SV("*~*"), SV("~")); + check(SV("* *"), SV("{:*^3.1}"), SV(" ")); + check(SV("*~*"), SV("{:*^3.1}"), SV("~")); //*** 2-byte code points *** - check.template operator()<"{:*^3.1}">(SV("*\u00a1*"), SV("\u00a1")); // INVERTED EXCLAMATION MARK - check.template operator()<"{:*^3.1}">(SV("*\u07ff*"), SV("\u07ff")); // NKO TAMAN SIGN + check(SV("*\u00a1*"), SV("{:*^3.1}"), SV("\u00a1")); // INVERTED EXCLAMATION MARK + check(SV("*\u07ff*"), SV("{:*^3.1}"), SV("\u07ff")); // NKO TAMAN SIGN //*** 3.1-byte code points *** - check.template operator()<"{:*^3.1}">(SV("*\u0800*"), SV("\u0800")); // SAMARITAN LETTER ALAF - check.template operator()<"{:*^3.1}">(SV("*\ufffd*"), SV("\ufffd")); // REPLACEMENT CHARACTER + check(SV("*\u0800*"), SV("{:*^3.1}"), SV("\u0800")); // SAMARITAN LETTER ALAF + check(SV("*\ufffd*"), SV("{:*^3.1}"), SV("\ufffd")); // REPLACEMENT CHARACTER // 2 column ranges - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u1100")); // HANGUL CHOSEONG KIYEOK - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u115f")); // HANGUL CHOSEONG FILLER + check(SV("***"), SV("{:*^3.1}"), SV("\u1100")); // HANGUL CHOSEONG KIYEOK + check(SV("***"), SV("{:*^3.1}"), SV("\u115f")); // HANGUL CHOSEONG FILLER - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u2329")); // LEFT-POINTING ANGLE BRACKET - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u232a")); // RIGHT-POINTING ANGLE BRACKET + check(SV("***"), SV("{:*^3.1}"), SV("\u2329")); // LEFT-POINTING ANGLE BRACKET + check(SV("***"), SV("{:*^3.1}"), SV("\u232a")); // RIGHT-POINTING ANGLE BRACKET - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u2e80")); // CJK RADICAL REPEAT - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u303e")); // IDEOGRAPHIC VARIATION INDICATOR + check(SV("***"), SV("{:*^3.1}"), SV("\u2e80")); // CJK RADICAL REPEAT + check(SV("***"), SV("{:*^3.1}"), SV("\u303e")); // IDEOGRAPHIC VARIATION INDICATOR - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u3040")); // U+3041 HIRAGANA LETTER SMALL A - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ua4cf")); // U+A4D0 LISU LETTER BA + check(SV("***"), SV("{:*^3.1}"), SV("\u3040")); // U+3041 HIRAGANA LETTER SMALL A + check(SV("***"), SV("{:*^3.1}"), SV("\ua4cf")); // U+A4D0 LISU LETTER BA - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uac00")); // - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ud7a3")); // Hangul Syllable Hih + check(SV("***"), SV("{:*^3.1}"), SV("\uac00")); // + check(SV("***"), SV("{:*^3.1}"), SV("\ud7a3")); // Hangul Syllable Hih - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uf900")); // CJK COMPATIBILITY IDEOGRAPH-F900 - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ufaff")); // U+FB00 LATIN SMALL LIGATURE FF + check(SV("***"), SV("{:*^3.1}"), SV("\uf900")); // CJK COMPATIBILITY IDEOGRAPH-F900 + check(SV("***"), SV("{:*^3.1}"), SV("\ufaff")); // U+FB00 LATIN SMALL LIGATURE FF - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ufe10")); // PRESENTATION FORM FOR VERTICAL COMMA - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ufe19")); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS + check(SV("***"), SV("{:*^3.1}"), SV("\ufe10")); // PRESENTATION FORM FOR VERTICAL COMMA + check(SV("***"), SV("{:*^3.1}"), SV("\ufe19")); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ufe30")); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER - check.template operator()<"{:*^3.1}">(SV("***"), SV("\ufe6f")); // U+FE70 ARABIC FATHATAN ISOLATED FORM + check(SV("***"), SV("{:*^3.1}"), SV("\ufe30")); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER + check(SV("***"), SV("{:*^3.1}"), SV("\ufe6f")); // U+FE70 ARABIC FATHATAN ISOLATED FORM - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uff00")); // U+FF01 FULLWIDTH EXCLAMATION MARK - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uff60")); // FULLWIDTH RIGHT WHITE PARENTHESIS + check(SV("***"), SV("{:*^3.1}"), SV("\uff00")); // U+FF01 FULLWIDTH EXCLAMATION MARK + check(SV("***"), SV("{:*^3.1}"), SV("\uff60")); // FULLWIDTH RIGHT WHITE PARENTHESIS - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uffe0")); // FULLWIDTH CENT SIGN - check.template operator()<"{:*^3.1}">(SV("***"), SV("\uffe6")); // FULLWIDTH WON SIGN + check(SV("***"), SV("{:*^3.1}"), SV("\uffe0")); // FULLWIDTH CENT SIGN + check(SV("***"), SV("{:*^3.1}"), SV("\uffe6")); // FULLWIDTH WON SIGN //*** 3.1-byte code points *** - check.template operator()<"{:*^3.1}">(SV("*\U00010000*"), SV("\U00010000")); // LINEAR B SYLLABLE B008 A - check.template operator()<"{:*^3.1}">(SV("*\U0010FFFF*"), SV("\U0010FFFF")); // Undefined Character + check(SV("*\U00010000*"), SV("{:*^3.1}"), SV("\U00010000")); // LINEAR B SYLLABLE B008 A + check(SV("*\U0010FFFF*"), SV("{:*^3.1}"), SV("\U0010FFFF")); // Undefined Character // 2 column ranges - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0001f300")); // CYCLONE - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0001f64f")); // PERSON WITH FOLDED HANDS - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0001f900")); // CIRCLED CROSS FORMEE WITH FOUR DOTS - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0001f9ff")); // NAZAR AMULET - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U00020000")); // - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0002fffd")); // Undefined Character - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U00030000")); // - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0003fffd")); // Undefined Character + check(SV("***"), SV("{:*^3.1}"), SV("\U0001f300")); // CYCLONE + check(SV("***"), SV("{:*^3.1}"), SV("\U0001f64f")); // PERSON WITH FOLDED HANDS + check(SV("***"), SV("{:*^3.1}"), SV("\U0001f900")); // CIRCLED CROSS FORMEE WITH FOUR DOTS + check(SV("***"), SV("{:*^3.1}"), SV("\U0001f9ff")); // NAZAR AMULET + check(SV("***"), SV("{:*^3.1}"), SV("\U00020000")); // + check(SV("***"), SV("{:*^3.1}"), SV("\U0002fffd")); // Undefined Character + check(SV("***"), SV("{:*^3.1}"), SV("\U00030000")); // + check(SV("***"), SV("{:*^3.1}"), SV("\U0003fffd")); // Undefined Character } // The examples used in that paper. template static void test_P1868() { // Fill - check.template operator()<"{:*^3}">(SV("*\u0041*"), SV("\u0041")); // { LATIN CAPITAL LETTER A } - check.template operator()<"{:*^3}">(SV("*\u00c1*"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } - check.template operator()<"{:*^3}">( - SV("*\u0041\u0301*"), - SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } - check.template operator()<"{:*^3}">(SV("*\u0132*"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } - check.template operator()<"{:*^3}">(SV("*\u0394*"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } - - check.template operator()<"{:*^3}">(SV("*\u0429*"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } - check.template operator()<"{:*^3}">(SV("*\u05d0*"), SV("\u05d0")); // { HEBREW LETTER ALEF } - check.template operator()<"{:*^3}">(SV("*\u0634*"), SV("\u0634")); // { ARABIC LETTER SHEEN } - check.template operator()<"{:*^4}">(SV("*\u3009*"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } - check.template operator()<"{:*^4}">(SV("*\u754c*"), SV("\u754c")); // { CJK Unified Ideograph-754C } - check.template operator()<"{:*^4}">(SV("*\U0001f921*"), SV("\U0001f921")); // { UNICORN FACE } - check.template operator()<"{:*^4}">( - SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), - SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } + check(SV("*\u0041*"), SV("{:*^3}"), SV("\u0041")); // { LATIN CAPITAL LETTER A } + check(SV("*\u00c1*"), SV("{:*^3}"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } + check(SV("*\u0041\u0301*"), + SV("{:*^3}"), + SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } + check(SV("*\u0132*"), SV("{:*^3}"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } + check(SV("*\u0394*"), SV("{:*^3}"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } + + check(SV("*\u0429*"), SV("{:*^3}"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } + check(SV("*\u05d0*"), SV("{:*^3}"), SV("\u05d0")); // { HEBREW LETTER ALEF } + check(SV("*\u0634*"), SV("{:*^3}"), SV("\u0634")); // { ARABIC LETTER SHEEN } + check(SV("*\u3009*"), SV("{:*^4}"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } + check(SV("*\u754c*"), SV("{:*^4}"), SV("\u754c")); // { CJK Unified Ideograph-754C } + check(SV("*\U0001f921*"), SV("{:*^4}"), SV("\U0001f921")); // { UNICORN FACE } + check(SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), + SV("{:*^4}"), + SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } // Truncate to 1 column: 1 column grapheme clusters are kept together. - check.template operator()<"{:*^3.1}">(SV("*\u0041*"), SV("\u0041")); // { LATIN CAPITAL LETTER A } - check.template operator()<"{:*^3.1}">(SV("*\u00c1*"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } - check.template operator()<"{:*^3.1}">( - SV("*\u0041\u0301*"), - SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } - check.template operator()<"{:*^3.1}">(SV("*\u0132*"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } - check.template operator()<"{:*^3.1}">(SV("*\u0394*"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } - - check.template operator()<"{:*^3.1}">(SV("*\u0429*"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } - check.template operator()<"{:*^3.1}">(SV("*\u05d0*"), SV("\u05d0")); // { HEBREW LETTER ALEF } - check.template operator()<"{:*^3.1}">(SV("*\u0634*"), SV("\u0634")); // { ARABIC LETTER SHEEN } - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } - check.template operator()<"{:*^3.1}">(SV("***"), SV("\u754c")); // { CJK Unified Ideograph-754C } - check.template operator()<"{:*^3.1}">(SV("***"), SV("\U0001f921")); // { UNICORN FACE } - check.template operator()<"{:*^3.1}">( - SV("***"), - SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } + check(SV("*\u0041*"), SV("{:*^3.1}"), SV("\u0041")); // { LATIN CAPITAL LETTER A } + check(SV("*\u00c1*"), SV("{:*^3.1}"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } + check(SV("*\u0041\u0301*"), + SV("{:*^3.1}"), + SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } + check(SV("*\u0132*"), SV("{:*^3.1}"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } + check(SV("*\u0394*"), SV("{:*^3.1}"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } + + check(SV("*\u0429*"), SV("{:*^3.1}"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } + check(SV("*\u05d0*"), SV("{:*^3.1}"), SV("\u05d0")); // { HEBREW LETTER ALEF } + check(SV("*\u0634*"), SV("{:*^3.1}"), SV("\u0634")); // { ARABIC LETTER SHEEN } + check(SV("***"), SV("{:*^3.1}"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } + check(SV("***"), SV("{:*^3.1}"), SV("\u754c")); // { CJK Unified Ideograph-754C } + check(SV("***"), SV("{:*^3.1}"), SV("\U0001f921")); // { UNICORN FACE } + check(SV("***"), + SV("{:*^3.1}"), + SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } // Truncate to 2 column: 2 column grapheme clusters are kept together. - check.template operator()<"{:*^3.2}">(SV("*\u0041*"), SV("\u0041")); // { LATIN CAPITAL LETTER A } - check.template operator()<"{:*^3.2}">(SV("*\u00c1*"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } - check.template operator()<"{:*^3.2}">( - SV("*\u0041\u0301*"), - SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } - check.template operator()<"{:*^3.2}">(SV("*\u0132*"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } - check.template operator()<"{:*^3.2}">(SV("*\u0394*"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } - - check.template operator()<"{:*^3.2}">(SV("*\u0429*"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } - check.template operator()<"{:*^3.2}">(SV("*\u05d0*"), SV("\u05d0")); // { HEBREW LETTER ALEF } - check.template operator()<"{:*^3.2}">(SV("*\u0634*"), SV("\u0634")); // { ARABIC LETTER SHEEN } - check.template operator()<"{:*^4.2}">(SV("*\u3009*"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } - check.template operator()<"{:*^4.2}">(SV("*\u754c*"), SV("\u754c")); // { CJK Unified Ideograph-754C } - check.template operator()<"{:*^4.2}">(SV("*\U0001f921*"), SV("\U0001f921")); // { UNICORN FACE } - check.template operator()<"{:*^4.2}">( - SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), - SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } + check(SV("*\u0041*"), SV("{:*^3.2}"), SV("\u0041")); // { LATIN CAPITAL LETTER A } + check(SV("*\u00c1*"), SV("{:*^3.2}"), SV("\u00c1")); // { LATIN CAPITAL LETTER A WITH ACUTE } + check(SV("*\u0041\u0301*"), + SV("{:*^3.2}"), + SV("\u0041\u0301")); // { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT } + check(SV("*\u0132*"), SV("{:*^3.2}"), SV("\u0132")); // { LATIN CAPITAL LIGATURE IJ } + check(SV("*\u0394*"), SV("{:*^3.2}"), SV("\u0394")); // { GREEK CAPITAL LETTER DELTA } + + check(SV("*\u0429*"), SV("{:*^3.2}"), SV("\u0429")); // { CYRILLIC CAPITAL LETTER SHCHA } + check(SV("*\u05d0*"), SV("{:*^3.2}"), SV("\u05d0")); // { HEBREW LETTER ALEF } + check(SV("*\u0634*"), SV("{:*^3.2}"), SV("\u0634")); // { ARABIC LETTER SHEEN } + check(SV("*\u3009*"), SV("{:*^4.2}"), SV("\u3009")); // { RIGHT-POINTING ANGLE BRACKET } + check(SV("*\u754c*"), SV("{:*^4.2}"), SV("\u754c")); // { CJK Unified Ideograph-754C } + check(SV("*\U0001f921*"), SV("{:*^4.2}"), SV("\U0001f921")); // { UNICORN FACE } + check(SV("*\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466*"), + SV("{:*^4.2}"), + SV("\U0001f468\u200d\U0001F469\u200d\U0001F467\u200d\U0001F466")); // { Family: Man, Woman, Girl, Boy } } #ifdef _LIBCPP_VERSION @@ -240,37 +240,37 @@ static void test_malformed_code_point() { if constexpr (sizeof(CharT) == 1) { // Malformed at end. - check.template operator()<"{:*^7}">(SV("*ZZZZ\x8f*"), SV("ZZZZ\x8f")); - check.template operator()<"{:*^7}">(SV("*ZZZZ\xcf*"), SV("ZZZZ\xcf")); - check.template operator()<"{:*^7}">(SV("*ZZZZ\xef*"), SV("ZZZZ\xef")); - check.template operator()<"{:*^7}">(SV("*ZZZZ\xff*"), SV("ZZZZ\xff")); + check(SV("*ZZZZ\x8f*"), SV("{:*^7}"), SV("ZZZZ\x8f")); + check(SV("*ZZZZ\xcf*"), SV("{:*^7}"), SV("ZZZZ\xcf")); + check(SV("*ZZZZ\xef*"), SV("{:*^7}"), SV("ZZZZ\xef")); + check(SV("*ZZZZ\xff*"), SV("{:*^7}"), SV("ZZZZ\xff")); // Malformed in middle, no continuation - check.template operator()<"{:*^8}">(SV("*ZZZZ\x8fZ*"), SV("ZZZZ\x8fZ")); - check.template operator()<"{:*^8}">(SV("*ZZZZ\xcfZ*"), SV("ZZZZ\xcfZ")); - check.template operator()<"{:*^8}">(SV("*ZZZZ\xefZ*"), SV("ZZZZ\xefZ")); - check.template operator()<"{:*^8}">(SV("*ZZZZ\xffZ*"), SV("ZZZZ\xffZ")); - - check.template operator()<"{:*^9}">(SV("*ZZZZ\x8fZZ*"), SV("ZZZZ\x8fZZ")); - check.template operator()<"{:*^9}">(SV("*ZZZZ\xcfZZ*"), SV("ZZZZ\xcfZZ")); - check.template operator()<"{:*^9}">(SV("*ZZZZ\xefZZ*"), SV("ZZZZ\xefZZ")); - check.template operator()<"{:*^9}">(SV("*ZZZZ\xffZZ*"), SV("ZZZZ\xffZZ")); - - check.template operator()<"{:*^10}">(SV("*ZZZZ\x8fZZZ*"), SV("ZZZZ\x8fZZZ")); - check.template operator()<"{:*^10}">(SV("*ZZZZ\xcfZZZ*"), SV("ZZZZ\xcfZZZ")); - check.template operator()<"{:*^10}">(SV("*ZZZZ\xefZZZ*"), SV("ZZZZ\xefZZZ")); - check.template operator()<"{:*^10}">(SV("*ZZZZ\xffZZZ*"), SV("ZZZZ\xffZZZ")); - - check.template operator()<"{:*^11}">(SV("*ZZZZ\x8fZZZZ*"), SV("ZZZZ\x8fZZZZ")); - check.template operator()<"{:*^11}">(SV("*ZZZZ\xcfZZZZ*"), SV("ZZZZ\xcfZZZZ")); - check.template operator()<"{:*^11}">(SV("*ZZZZ\xefZZZZ*"), SV("ZZZZ\xefZZZZ")); - check.template operator()<"{:*^11}">(SV("*ZZZZ\xffZZZZ*"), SV("ZZZZ\xffZZZZ")); + check(SV("*ZZZZ\x8fZ*"), SV("{:*^8}"), SV("ZZZZ\x8fZ")); + check(SV("*ZZZZ\xcfZ*"), SV("{:*^8}"), SV("ZZZZ\xcfZ")); + check(SV("*ZZZZ\xefZ*"), SV("{:*^8}"), SV("ZZZZ\xefZ")); + check(SV("*ZZZZ\xffZ*"), SV("{:*^8}"), SV("ZZZZ\xffZ")); + + check(SV("*ZZZZ\x8fZZ*"), SV("{:*^9}"), SV("ZZZZ\x8fZZ")); + check(SV("*ZZZZ\xcfZZ*"), SV("{:*^9}"), SV("ZZZZ\xcfZZ")); + check(SV("*ZZZZ\xefZZ*"), SV("{:*^9}"), SV("ZZZZ\xefZZ")); + check(SV("*ZZZZ\xffZZ*"), SV("{:*^9}"), SV("ZZZZ\xffZZ")); + + check(SV("*ZZZZ\x8fZZZ*"), SV("{:*^10}"), SV("ZZZZ\x8fZZZ")); + check(SV("*ZZZZ\xcfZZZ*"), SV("{:*^10}"), SV("ZZZZ\xcfZZZ")); + check(SV("*ZZZZ\xefZZZ*"), SV("{:*^10}"), SV("ZZZZ\xefZZZ")); + check(SV("*ZZZZ\xffZZZ*"), SV("{:*^10}"), SV("ZZZZ\xffZZZ")); + + check(SV("*ZZZZ\x8fZZZZ*"), SV("{:*^11}"), SV("ZZZZ\x8fZZZZ")); + check(SV("*ZZZZ\xcfZZZZ*"), SV("{:*^11}"), SV("ZZZZ\xcfZZZZ")); + check(SV("*ZZZZ\xefZZZZ*"), SV("{:*^11}"), SV("ZZZZ\xefZZZZ")); + check(SV("*ZZZZ\xffZZZZ*"), SV("{:*^11}"), SV("ZZZZ\xffZZZZ")); // Premature end. - check.template operator()<"{:*^8}">(SV("*ZZZZ\xef\xf5*"), SV("ZZZZ\xef\xf5")); - check.template operator()<"{:*^12}">(SV("*ZZZZ\xef\xf5ZZZZ*"), SV("ZZZZ\xef\xf5ZZZZ")); - check.template operator()<"{:*^9}">(SV("*ZZZZ\xff\xf5\xf5*"), SV("ZZZZ\xff\xf5\xf5")); - check.template operator()<"{:*^13}">(SV("*ZZZZ\xff\xf5\xf5ZZZZ*"), SV("ZZZZ\xff\xf5\xf5ZZZZ")); + check(SV("*ZZZZ\xef\xf5*"), SV("{:*^8}"), SV("ZZZZ\xef\xf5")); + check(SV("*ZZZZ\xef\xf5ZZZZ*"), SV("{:*^12}"), SV("ZZZZ\xef\xf5ZZZZ")); + check(SV("*ZZZZ\xff\xf5\xf5*"), SV("{:*^9}"), SV("ZZZZ\xff\xf5\xf5")); + check(SV("*ZZZZ\xff\xf5\xf5ZZZZ*"), SV("{:*^13}"), SV("ZZZZ\xff\xf5\xf5ZZZZ")); } else if constexpr (sizeof(CharT) == 2) { // TODO FMT Add these tests. diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp @@ -26,29 +26,28 @@ #include "format_tests.h" #include "string_literal.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - std::basic_string out = - std::vformat(std::locale(), fmt.template sv(), std::make_format_args>(args...)); +auto test = []( + std::basic_string_view expected, std::basic_string_view fmt, Args&&... args) constexpr { + std::basic_string out = std::vformat(std::locale(), fmt, std::make_format_args>(args...)); assert(out == expected); }; -auto test_exception = [](std::string_view what, std::basic_string_view fmt, - const Args&... args) { +auto test_exception = + []( + [[maybe_unused]] std::string_view what, + [[maybe_unused]] std::basic_string_view fmt, + [[maybe_unused]] Args&&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS - try { - (void)std::vformat(std::locale(), fmt, std::make_format_args>(args...)); - assert(false); - } catch ([[maybe_unused]] const std::format_error& e) { - LIBCPP_ASSERT(e.what() == what); - return; - } - assert(false); + try { + (void)std::vformat(std::locale(), fmt, std::make_format_args>(args...)); + assert(false); + } catch ([[maybe_unused]] const std::format_error& e) { + LIBCPP_ASSERT(e.what() == what); + return; + } + assert(false); #endif - (void)what; - (void)fmt; - (void)sizeof...(args); -}; + }; int main(int, char**) { format_tests(test, test_exception); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp @@ -24,30 +24,28 @@ #include "test_macros.h" #include "format_tests.h" #include "string_literal.h" - -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { - std::basic_string out = - std::vformat(fmt.template sv(), std::make_format_args>(args...)); +auto test = []( + std::basic_string_view expected, std::basic_string_view fmt, Args&&... args) constexpr { + std::basic_string out = std::vformat(fmt, std::make_format_args>(args...)); assert(out == expected); }; -auto test_exception = [](std::string_view what, std::basic_string_view fmt, - const Args&... args) { +auto test_exception = + []( + [[maybe_unused]] std::string_view what, + [[maybe_unused]] std::basic_string_view fmt, + [[maybe_unused]] Args&&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS - try { - TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args>(args...)); - assert(false); - } catch ([[maybe_unused]] const std::format_error& e) { - LIBCPP_ASSERT(e.what() == what); - return; - } - assert(false); + try { + TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args>(args...)); + assert(false); + } catch ([[maybe_unused]] const std::format_error& e) { + LIBCPP_ASSERT(e.what() == what); + return; + } + assert(false); #endif - (void)what; - (void)fmt; - (void)sizeof...(args); -}; + }; int main(int, char**) { format_tests(test, test_exception); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp @@ -32,55 +32,51 @@ #include "format_tests.h" #include "string_literal.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { +auto test = []( + std::basic_string_view expected, std::basic_string_view fmt, Args&&... args) constexpr { { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to(out.begin(), std::locale(), fmt.template sv(), - std::make_format_args>(args...)); + auto it = std::vformat_to(out.begin(), std::locale(), fmt, std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } { std::list out; - std::vformat_to(std::back_inserter(out), std::locale(), fmt.template sv(), - std::make_format_args>(args...)); + std::vformat_to(std::back_inserter(out), std::locale(), fmt, std::make_format_args>(args...)); assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { std::vector out; - std::vformat_to(std::back_inserter(out), std::locale(), fmt.template sv(), - std::make_format_args>(args...)); + std::vformat_to(std::back_inserter(out), std::locale(), fmt, std::make_format_args>(args...)); assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { assert(expected.size() < 4096 && "Update the size of the buffer."); CharT out[4096]; - CharT* it = - std::vformat_to(out, std::locale(), fmt.template sv(), std::make_format_args>(args...)); + CharT* it = std::vformat_to(out, std::locale(), fmt, std::make_format_args>(args...)); assert(std::distance(out, it) == int(expected.size())); // Convert to std::string since output contains '\0' for boolean tests. assert(std::basic_string(out, it) == expected); } }; -auto test_exception = [](std::string_view what, std::basic_string_view fmt, - const Args&... args) { +auto test_exception = + []( + [[maybe_unused]] std::string_view what, + [[maybe_unused]] std::basic_string_view fmt, + [[maybe_unused]] Args&&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS - try { - std::basic_string out; - std::vformat_to(std::back_inserter(out), std::locale(), fmt, std::make_format_args>(args...)); - assert(false); - } catch ([[maybe_unused]] const std::format_error& e) { - LIBCPP_ASSERT(e.what() == what); - return; - } - assert(false); + try { + std::basic_string out; + std::vformat_to(std::back_inserter(out), std::locale(), fmt, std::make_format_args>(args...)); + assert(false); + } catch ([[maybe_unused]] const std::format_error& e) { + LIBCPP_ASSERT(e.what() == what); + return; + } + assert(false); #endif - (void)what; - (void)fmt; - (void)sizeof...(args); -}; + }; int main(int, char**) { format_tests(test, test_exception); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp @@ -29,53 +29,51 @@ #include "format_tests.h" #include "string_literal.h" -auto test = [](std::basic_string_view expected, - const Args&... args) constexpr { +auto test = []( + std::basic_string_view expected, std::basic_string_view fmt, Args&&... args) constexpr { { std::basic_string out(expected.size(), CharT(' ')); - auto it = std::vformat_to(out.begin(), fmt.template sv(), std::make_format_args>(args...)); + auto it = std::vformat_to(out.begin(), fmt, std::make_format_args>(args...)); assert(it == out.end()); assert(out == expected); } { std::list out; - std::vformat_to(std::back_inserter(out), fmt.template sv(), - std::make_format_args>(args...)); + std::vformat_to(std::back_inserter(out), fmt, std::make_format_args>(args...)); assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { std::vector out; - std::vformat_to(std::back_inserter(out), fmt.template sv(), - std::make_format_args>(args...)); + std::vformat_to(std::back_inserter(out), fmt, std::make_format_args>(args...)); assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); } { assert(expected.size() < 4096 && "Update the size of the buffer."); CharT out[4096]; - CharT* it = std::vformat_to(out, fmt.template sv(), std::make_format_args>(args...)); + CharT* it = std::vformat_to(out, fmt, std::make_format_args>(args...)); assert(std::distance(out, it) == int(expected.size())); // Convert to std::string since output contains '\0' for boolean tests. assert(std::basic_string(out, it) == expected); } }; -auto test_exception = [](std::string_view what, std::basic_string_view fmt, - const Args&... args) { +auto test_exception = + []( + [[maybe_unused]] std::string_view what, + [[maybe_unused]] std::basic_string_view fmt, + [[maybe_unused]] Args&&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS - try { - std::basic_string out; - std::vformat_to(std::back_inserter(out), fmt, std::make_format_args>(args...)); - assert(false); - } catch ([[maybe_unused]] const std::format_error& e) { - LIBCPP_ASSERT(e.what() == what); - return; - } - assert(false); + try { + std::basic_string out; + std::vformat_to(std::back_inserter(out), fmt, std::make_format_args>(args...)); + assert(false); + } catch ([[maybe_unused]] const std::format_error& e) { + LIBCPP_ASSERT(e.what() == what); + return; + } + assert(false); #endif - (void)what; - (void)fmt; - (void)sizeof...(args); -}; + }; int main(int, char**) { format_tests(test, test_exception);