From e885b1137bcbbdd732bab02a4dd02a6222711815 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 29 Jan 2022 14:52:41 +0100 Subject: [PATCH] [libc++][format[[nfc] Use string_view in tests. This change is a preparation for adapting the tests for P2216 std::format improvements Reviewed By: #libc, Quuxplusone, ldionne Differential Revision: https://reviews.llvm.org/D118717 --- .../format/format.functions/format.locale.pass.cpp | 8 +- .../format/format.functions/format.pass.cpp | 8 +- .../format/format.functions/format_tests.h | 3194 ++++++++++--------- .../format.functions/format_to.locale.pass.cpp | 8 +- .../format/format.functions/format_to.pass.cpp | 8 +- .../format.functions/format_to_n.locale.pass.cpp | 8 +- .../format/format.functions/format_to_n.pass.cpp | 8 +- .../formatted_size.locale.pass.cpp | 8 +- .../format.functions/formatted_size.pass.cpp | 8 +- .../format.functions/locale-specific_form.pass.cpp | 3310 ++++++++++---------- .../format.functions/vformat.locale.pass.cpp | 8 +- .../format/format.functions/vformat.pass.cpp | 8 +- .../format.functions/vformat_to.locale.pass.cpp | 8 +- .../format/format.functions/vformat_to.pass.cpp | 8 +- 14 files changed, 3299 insertions(+), 3301 deletions(-) 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 index 197fdda..1439eab 100644 --- a/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp @@ -27,7 +27,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { std::basic_string out = std::format(std::locale(), fmt, args...); if constexpr (std::same_as) @@ -37,15 +37,15 @@ auto test = [](std::basic_string expected, st assert(out == expected); }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::format(std::locale(), fmt, args...); if constexpr (std::same_as) std::cerr << "\nFormat string " << fmt << "\nDidn't throw an exception.\n"; assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { # ifdef _LIBCPP_VERSION if constexpr (std::same_as) if (e.what() != what) diff --git a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp index cf56667..bbd43f7 100644 --- a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp @@ -32,7 +32,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { std::basic_string out = std::format(fmt, args...); #ifndef _LIBCPP_HAS_NO_LOCALIZATION @@ -44,8 +44,8 @@ auto test = [](std::basic_string expected, st assert(out == expected); }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::format(fmt, args...); @@ -54,7 +54,7 @@ auto test_exception = std::cerr << "\nFormat string " << fmt << "\nDidn't throw an exception.\n"; # endif assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { # if defined(_LIBCPP_VERSION) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) if constexpr (std::same_as) if (e.what() != what) diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h index f5e84d1..4319f5f 100644 --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -23,6 +23,7 @@ // ExceptionTest must be callable as check_exception(expected-exception, string-to-format, args-to-format...) #define STR(S) MAKE_STRING(CharT, S) +#define SV(S) MAKE_STRING_VIEW(CharT, S) #define CSTR(S) MAKE_CSTRING(CharT, S) template @@ -131,12 +132,12 @@ private: }; template -std::vector> invalid_types(std::string valid) { - std::vector> result; +std::vector> invalid_types(std::string valid) { + std::vector> result; #define CASE(T) \ case #T[0]: \ - result.push_back(STR("Invalid formatter type {:" #T "}")); \ + result.push_back(SV("Invalid formatter type {:" #T "}")); \ break; for (auto type : "aAbBcdeEfFgGopsxX") { @@ -177,110 +178,108 @@ void format_test_string(T world, T universe, TestFunction check, ExceptionTest c // *** Valid input tests *** // Unsed argument is ignored. TODO FMT what does the Standard mandate? - check(STR("hello world"), STR("hello {}"), world, universe); - check(STR("hello world and universe"), STR("hello {} and {}"), world, universe); - check(STR("hello world"), STR("hello {0}"), world, universe); - check(STR("hello universe"), STR("hello {1}"), world, universe); - check(STR("hello universe and world"), STR("hello {1} and {0}"), world, universe); - - check(STR("hello world"), STR("hello {:_>}"), world); - check(STR("hello world"), STR("hello {:>8}"), world); - check(STR("hello ___world"), STR("hello {:_>8}"), world); - check(STR("hello _world__"), STR("hello {:_^8}"), world); - check(STR("hello world___"), STR("hello {:_<8}"), world); - - check(STR("hello >>>world"), STR("hello {:>>8}"), world); - check(STR("hello <<8}"), world); - check(STR("hello ^^^world"), STR("hello {:^>8}"), world); - - check(STR("hello $world"), STR("hello {:$>{}}"), world, 6); - check(STR("hello $world"), STR("hello {0:$>{1}}"), world, 6); - check(STR("hello $world"), STR("hello {1:$>{0}}"), 6, world); - - check(STR("hello world"), STR("hello {:.5}"), world); - check(STR("hello unive"), STR("hello {:.5}"), universe); - - check(STR("hello univer"), STR("hello {:.{}}"), universe, 6); - check(STR("hello univer"), STR("hello {0:.{1}}"), universe, 6); - check(STR("hello univer"), STR("hello {1:.{0}}"), 6, universe); - - check(STR("hello %world%"), STR("hello {:%^7.7}"), world); - check(STR("hello univers"), STR("hello {:%^7.7}"), universe); - check(STR("hello %world%"), STR("hello {:%^{}.{}}"), world, 7, 7); - check(STR("hello %world%"), STR("hello {0:%^{1}.{2}}"), world, 7, 7); - check(STR("hello %world%"), STR("hello {0:%^{2}.{1}}"), world, 7, 7); - check(STR("hello %world%"), STR("hello {1:%^{0}.{2}}"), 7, world, 7); - - check(STR("hello world"), STR("hello {:_>s}"), world); - check(STR("hello $world"), STR("hello {:$>{}s}"), world, 6); - check(STR("hello world"), STR("hello {:.5s}"), world); - check(STR("hello univer"), STR("hello {:.{}s}"), universe, 6); - check(STR("hello %world%"), STR("hello {:%^7.7s}"), world); - - check(STR("hello #####uni"), STR("hello {:#>8.3s}"), universe); - check(STR("hello ##uni###"), STR("hello {:#^8.3s}"), universe); - check(STR("hello uni#####"), STR("hello {:#<8.3s}"), universe); + 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 '}'", STR("hello {:-}"), world); + check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:-}"), world); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", STR("hello {:#}"), world); + check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:#}"), world); // *** zero-padding *** - check_exception("A format-spec width field shouldn't have a leading zero", STR("hello {:0}"), world); + check_exception("A format-spec width field shouldn't have a leading zero", SV("hello {:0}"), world); // *** width *** #ifdef _LIBCPP_VERSION // This limit isn't specified in the Standard. static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); - check_exception("The numeric value of the format-spec is too large", STR("{:2147483648}"), world); - check_exception("The numeric value of the format-spec is too large", STR("{:5000000000}"), world); - check_exception("The numeric value of the format-spec is too large", STR("{:10000000000}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:2147483648}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:5000000000}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:10000000000}"), world); #endif - check_exception("A format-spec width field replacement should have a positive value", STR("hello {:{}}"), world, 0); - check_exception("A format-spec arg-id replacement shouldn't have a negative value", STR("hello {:{}}"), world, -1); - check_exception("A format-spec arg-id replacement exceeds the maximum supported value", STR("hello {:{}}"), world, + check_exception("A format-spec width field replacement should have a positive value", SV("hello {:{}}"), world, 0); + 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, unsigned(-1)); - check_exception("Argument index out of bounds", STR("hello {:{}}"), world); - check_exception("A format-spec arg-id replacement argument isn't an integral type", STR("hello {:{}}"), world, + check_exception("Argument index out of bounds", SV("hello {:{}}"), world); + check_exception("A format-spec arg-id replacement argument isn't an integral type", SV("hello {:{}}"), world, universe); - check_exception("Using manual argument numbering in automatic argument numbering mode", STR("hello {:{0}}"), world, - 1); - check_exception("Using automatic argument numbering in manual argument numbering mode", STR("hello {0:{}}"), world, - 1); + check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:{0}}"), world, 1); + check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception("Invalid arg-id", STR("hello {0:{01}}"), world, 1); + check_exception("Invalid arg-id", SV("hello {0:{01}}"), world, 1); // *** precision *** #ifdef _LIBCPP_VERSION // This limit isn't specified in the Standard. static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); - check_exception("The numeric value of the format-spec is too large", STR("{:.2147483648}"), world); - check_exception("The numeric value of the format-spec is too large", STR("{:.5000000000}"), world); - check_exception("The numeric value of the format-spec is too large", STR("{:.10000000000}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:.2147483648}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:.5000000000}"), world); + check_exception("The numeric value of the format-spec is too large", SV("{:.10000000000}"), world); #endif // Precision 0 allowed, but not useful for string arguments. - check(STR("hello "), STR("hello {:.{}}"), world, 0); + check(SV("hello "), SV("hello {:.{}}"), world, 0); // Precision may have leading zeros. Secondly tests the value is still base 10. - check(STR("hello 0123456789"), STR("hello {:.000010}"), STR("0123456789abcdef")); - check_exception("A format-spec arg-id replacement shouldn't have a negative value", STR("hello {:.{}}"), world, -1); - check_exception("A format-spec arg-id replacement exceeds the maximum supported value", STR("hello {:.{}}"), world, + 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); - check_exception("Argument index out of bounds", STR("hello {:.{}}"), world); - check_exception("A format-spec arg-id replacement argument isn't an integral type", STR("hello {:.{}}"), world, + check_exception("Argument index out of bounds", SV("hello {:.{}}"), world); + check_exception("A format-spec arg-id replacement argument isn't an integral type", SV("hello {:.{}}"), world, universe); - check_exception("Using manual argument numbering in automatic argument numbering mode", STR("hello {:.{0}}"), world, + check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:.{0}}"), world, 1); - check_exception("Using automatic argument numbering in manual argument numbering mode", STR("hello {0:.{}}"), world, + check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:.{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception("Invalid arg-id", STR("hello {0:.{01}}"), world, 1); + check_exception("Invalid arg-id", SV("hello {0:.{01}}"), world, 1); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", STR("hello {:L}"), world); + check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:L}"), world); // *** type *** for (const auto& fmt : invalid_types("s")) @@ -292,36 +291,36 @@ void format_test_string_unicode(TestFunction check) { (void)check; #ifndef TEST_HAS_NO_UNICODE // ß requires one column - check(STR("aßc"), STR("{}"), STR("aßc")); + check(SV("aßc"), SV("{}"), STR("aßc")); - check(STR("aßc"), STR("{:.3}"), STR("aßc")); - check(STR("aß"), STR("{:.2}"), STR("aßc")); - check(STR("a"), STR("{:.1}"), 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(STR("aßc"), STR("{:3.3}"), STR("aßc")); - check(STR("aß"), STR("{:2.2}"), STR("aßc")); - check(STR("a"), STR("{:1.1}"), 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(STR("aßc---"), STR("{:-<6}"), STR("aßc")); - check(STR("-aßc--"), STR("{:-^6}"), STR("aßc")); - check(STR("---aßc"), STR("{:->6}"), 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(STR("a\u1110c"), STR("{}"), STR("a\u1110c")); + check(SV("a\u1110c"), SV("{}"), STR("a\u1110c")); - check(STR("a\u1100c"), STR("{:.4}"), STR("a\u1100c")); - check(STR("a\u1100"), STR("{:.3}"), STR("a\u1100c")); - check(STR("a"), STR("{:.2}"), STR("a\u1100c")); - check(STR("a"), STR("{:.1}"), 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(STR("a\u1100c"), STR("{:-<4.4}"), STR("a\u1100c")); - check(STR("a\u1100"), STR("{:-<3.3}"), STR("a\u1100c")); - check(STR("a-"), STR("{:-<2.2}"), STR("a\u1100c")); - check(STR("a"), STR("{:-<1.1}"), 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(STR("a\u1110c---"), STR("{:-<7}"), STR("a\u1110c")); - check(STR("-a\u1110c--"), STR("{:-^7}"), STR("a\u1110c")); - check(STR("---a\u1110c"), STR("{:->7}"), 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")); #endif // TEST_HAS_NO_UNICODE } @@ -346,49 +345,49 @@ template void format_test_bool(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is 'true '"), STR("answer is '{:7}'"), true); - check(STR("answer is ' true'"), STR("answer is '{:>7}'"), true); - check(STR("answer is 'true '"), STR("answer is '{:<7}'"), true); - check(STR("answer is ' true '"), STR("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(SV("answer is ' true '"), SV("answer is '{:^7}'"), true); - check(STR("answer is 'false '"), STR("answer is '{:8s}'"), false); - check(STR("answer is ' false'"), STR("answer is '{:>8s}'"), false); - check(STR("answer is 'false '"), STR("answer is '{:<8s}'"), false); - check(STR("answer is ' false '"), STR("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(SV("answer is ' false '"), SV("answer is '{:^8s}'"), false); - check(STR("answer is '---true'"), STR("answer is '{:->7}'"), true); - check(STR("answer is 'true---'"), STR("answer is '{:-<7}'"), true); - check(STR("answer is '-true--'"), STR("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(STR("answer is '---false'"), STR("answer is '{:->8s}'"), false); - check(STR("answer is 'false---'"), STR("answer is '{:-<8s}'"), false); - check(STR("answer is '-false--'"), STR("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); // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", STR("{:-}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{:+}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{: }"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:+}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{: }"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{:-s}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{:+s}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{: s}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:-s}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:+s}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{: s}"), true); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", STR("{:#}"), true); - check_exception("An alternate form field isn't allowed in this format-spec", STR("{:#s}"), true); + check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#}"), true); + check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#s}"), true); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", STR("{:0}"), true); - check_exception("A zero-padding field isn't allowed in this format-spec", STR("{:0s}"), true); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0}"), true); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0s}"), true); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.s}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0s}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42s}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.s}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0s}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42s}"), true); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -401,44 +400,44 @@ void format_test_bool(TestFunction check, ExceptionTest check_exception) { template void format_test_bool_as_char(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is '\1 '"), STR("answer is '{:6c}'"), true); - check(STR("answer is ' \1'"), STR("answer is '{:>6c}'"), true); - check(STR("answer is '\1 '"), STR("answer is '{:<6c}'"), true); - check(STR("answer is ' \1 '"), STR("answer is '{:^6c}'"), true); + check(SV("answer is '\1 '"), SV("answer is '{:6c}'"), true); + check(SV("answer is ' \1'"), SV("answer is '{:>6c}'"), true); + check(SV("answer is '\1 '"), SV("answer is '{:<6c}'"), true); + check(SV("answer is ' \1 '"), SV("answer is '{:^6c}'"), true); - check(STR("answer is '-----\1'"), STR("answer is '{:->6c}'"), true); - check(STR("answer is '\1-----'"), STR("answer is '{:-<6c}'"), true); - check(STR("answer is '--\1---'"), STR("answer is '{:-^6c}'"), true); + check(SV("answer is '-----\1'"), SV("answer is '{:->6c}'"), true); + check(SV("answer is '\1-----'"), SV("answer is '{:-<6c}'"), true); + check(SV("answer is '--\1---'"), SV("answer is '{:-^6c}'"), true); - check(std::basic_string(CSTR("answer is '\0 '"), 18), STR("answer is '{:6c}'"), false); - check(std::basic_string(CSTR("answer is '\0 '"), 18), STR("answer is '{:6c}'"), false); - check(std::basic_string(CSTR("answer is ' \0'"), 18), STR("answer is '{:>6c}'"), false); - check(std::basic_string(CSTR("answer is '\0 '"), 18), STR("answer is '{:<6c}'"), false); - check(std::basic_string(CSTR("answer is ' \0 '"), 18), STR("answer is '{:^6c}'"), false); + check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:6c}'"), false); + check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:6c}'"), false); + check(std::basic_string_view(CSTR("answer is ' \0'"), 18), SV("answer is '{:>6c}'"), false); + check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:<6c}'"), false); + check(std::basic_string_view(CSTR("answer is ' \0 '"), 18), SV("answer is '{:^6c}'"), false); - check(std::basic_string(CSTR("answer is '-----\0'"), 18), STR("answer is '{:->6c}'"), false); - check(std::basic_string(CSTR("answer is '\0-----'"), 18), STR("answer is '{:-<6c}'"), false); - check(std::basic_string(CSTR("answer is '--\0---'"), 18), STR("answer is '{:-^6c}'"), false); + check(std::basic_string_view(CSTR("answer is '-----\0'"), 18), SV("answer is '{:->6c}'"), false); + check(std::basic_string_view(CSTR("answer is '\0-----'"), 18), SV("answer is '{:-<6c}'"), false); + check(std::basic_string_view(CSTR("answer is '--\0---'"), 18), SV("answer is '{:-^6c}'"), false); // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", STR("{:-c}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{:+c}"), true); - check_exception("A sign field isn't allowed in this format-spec", STR("{: c}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:-c}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{:+c}"), true); + check_exception("A sign field isn't allowed in this format-spec", SV("{: c}"), true); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", STR("{:#c}"), true); + check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#c}"), true); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", STR("{:0c}"), true); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0c}"), true); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.c}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0c}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42c}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), true); // *** locale-specific form *** // Note it has no effect but it's allowed. - check(STR("answer is '*'"), STR("answer is '{:Lc}'"), '*'); + check(SV("answer is '*'"), SV("answer is '{:Lc}'"), '*'); // *** type *** for (const auto& fmt : invalid_types("bBcdosxX")) @@ -448,80 +447,80 @@ void format_test_bool_as_char(TestFunction check, ExceptionTest check_exception) template void format_test_bool_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is '1'"), STR("answer is '{:<1d}'"), true); - check(STR("answer is '1 '"), STR("answer is '{:<2d}'"), true); - check(STR("answer is '0 '"), STR("answer is '{:<2d}'"), 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(STR("answer is ' 1'"), STR("answer is '{:6d}'"), true); - check(STR("answer is ' 1'"), STR("answer is '{:>6d}'"), true); - check(STR("answer is '1 '"), STR("answer is '{:<6d}'"), true); - check(STR("answer is ' 1 '"), STR("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(SV("answer is ' 1 '"), SV("answer is '{:^6d}'"), true); - check(STR("answer is '*****0'"), STR("answer is '{:*>6d}'"), false); - check(STR("answer is '0*****'"), STR("answer is '{:*<6d}'"), false); - check(STR("answer is '**0***'"), STR("answer is '{:*^6d}'"), 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(STR("answer is ' 1'"), STR("answer is '{:>06d}'"), true); - check(STR("answer is '1 '"), STR("answer is '{:<06d}'"), true); - check(STR("answer is ' 1 '"), STR("answer is '{:^06d}'"), 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(STR("answer is 1"), STR("answer is {:d}"), true); - check(STR("answer is 0"), STR("answer is {:-d}"), false); - check(STR("answer is +1"), STR("answer is {:+d}"), true); - check(STR("answer is 0"), STR("answer is {: d}"), 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(STR("answer is +1"), STR("answer is {:+#d}"), true); - check(STR("answer is +1"), STR("answer is {:+b}"), true); - check(STR("answer is +0b1"), STR("answer is {:+#b}"), true); - check(STR("answer is +0B1"), STR("answer is {:+#B}"), true); - check(STR("answer is +1"), STR("answer is {:+o}"), true); - check(STR("answer is +01"), STR("answer is {:+#o}"), true); - check(STR("answer is +1"), STR("answer is {:+x}"), true); - check(STR("answer is +0x1"), STR("answer is {:+#x}"), true); - check(STR("answer is +1"), STR("answer is {:+X}"), true); - check(STR("answer is +0X1"), STR("answer is {:+#X}"), true); - - check(STR("answer is 0"), STR("answer is {:#d}"), false); - check(STR("answer is 0"), STR("answer is {:b}"), false); - check(STR("answer is 0b0"), STR("answer is {:#b}"), false); - check(STR("answer is 0B0"), STR("answer is {:#B}"), false); - check(STR("answer is 0"), STR("answer is {:o}"), false); - check(STR("answer is 0"), STR("answer is {:#o}"), false); - check(STR("answer is 0"), STR("answer is {:x}"), false); - check(STR("answer is 0x0"), STR("answer is {:#x}"), false); - check(STR("answer is 0"), STR("answer is {:X}"), false); - check(STR("answer is 0X0"), STR("answer is {:#X}"), 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(STR("answer is +00000000001"), STR("answer is {:+#012d}"), true); - check(STR("answer is +00000000001"), STR("answer is {:+012b}"), true); - check(STR("answer is +0b000000001"), STR("answer is {:+#012b}"), true); - check(STR("answer is +0B000000001"), STR("answer is {:+#012B}"), true); - check(STR("answer is +00000000001"), STR("answer is {:+012o}"), true); - check(STR("answer is +00000000001"), STR("answer is {:+#012o}"), true); - check(STR("answer is +00000000001"), STR("answer is {:+012x}"), true); - check(STR("answer is +0x000000001"), STR("answer is {:+#012x}"), true); - check(STR("answer is +00000000001"), STR("answer is {:+012X}"), true); - check(STR("answer is +0X000000001"), STR("answer is {:+#012X}"), true); - - check(STR("answer is 000000000000"), STR("answer is {:#012d}"), false); - check(STR("answer is 000000000000"), STR("answer is {:012b}"), false); - check(STR("answer is 0b0000000000"), STR("answer is {:#012b}"), false); - check(STR("answer is 0B0000000000"), STR("answer is {:#012B}"), false); - check(STR("answer is 000000000000"), STR("answer is {:012o}"), false); - check(STR("answer is 000000000000"), STR("answer is {:#012o}"), false); - check(STR("answer is 000000000000"), STR("answer is {:012x}"), false); - check(STR("answer is 0x0000000000"), STR("answer is {:#012x}"), false); - check(STR("answer is 000000000000"), STR("answer is {:012X}"), false); - check(STR("answer is 0X0000000000"), STR("answer is {:#012X}"), 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 '}'", STR("{:.}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0}"), true); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), true); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), true); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -534,126 +533,126 @@ void format_test_bool_as_integer(TestFunction check, ExceptionTest check_excepti template void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is '42'"), STR("answer is '{:<1}'"), I(42)); - check(STR("answer is '42'"), STR("answer is '{:<2}'"), I(42)); - check(STR("answer is '42 '"), STR("answer is '{:<3}'"), 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(STR("answer is ' 42'"), STR("answer is '{:7}'"), I(42)); - check(STR("answer is ' 42'"), STR("answer is '{:>7}'"), I(42)); - check(STR("answer is '42 '"), STR("answer is '{:<7}'"), I(42)); - check(STR("answer is ' 42 '"), STR("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(SV("answer is ' 42 '"), SV("answer is '{:^7}'"), I(42)); - check(STR("answer is '*****42'"), STR("answer is '{:*>7}'"), I(42)); - check(STR("answer is '42*****'"), STR("answer is '{:*<7}'"), I(42)); - check(STR("answer is '**42***'"), STR("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)); // Test whether zero padding is ignored - check(STR("answer is ' 42'"), STR("answer is '{:>07}'"), I(42)); - check(STR("answer is '42 '"), STR("answer is '{:<07}'"), I(42)); - check(STR("answer is ' 42 '"), STR("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)); + check(SV("answer is ' 42 '"), SV("answer is '{:^07}'"), I(42)); // *** Sign *** if constexpr (std::signed_integral) - check(STR("answer is -42"), STR("answer is {}"), I(-42)); - check(STR("answer is 0"), STR("answer is {}"), I(0)); - check(STR("answer is 42"), STR("answer is {}"), 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(STR("answer is -42"), STR("answer is {:-}"), I(-42)); - check(STR("answer is 0"), STR("answer is {:-}"), I(0)); - check(STR("answer is 42"), STR("answer is {:-}"), 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(STR("answer is -42"), STR("answer is {:+}"), I(-42)); - check(STR("answer is +0"), STR("answer is {:+}"), I(0)); - check(STR("answer is +42"), STR("answer is {:+}"), 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(STR("answer is -42"), STR("answer is {: }"), I(-42)); - check(STR("answer is 0"), STR("answer is {: }"), I(0)); - check(STR("answer is 42"), STR("answer is {: }"), 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(STR("answer is -42"), STR("answer is {:#}"), I(-42)); - check(STR("answer is -42"), STR("answer is {:#d}"), I(-42)); - check(STR("answer is -101010"), STR("answer is {:b}"), I(-42)); - check(STR("answer is -0b101010"), STR("answer is {:#b}"), I(-42)); - check(STR("answer is -0B101010"), STR("answer is {:#B}"), I(-42)); - check(STR("answer is -52"), STR("answer is {:o}"), I(-42)); - check(STR("answer is -052"), STR("answer is {:#o}"), I(-42)); - check(STR("answer is -2a"), STR("answer is {:x}"), I(-42)); - check(STR("answer is -0x2a"), STR("answer is {:#x}"), I(-42)); - check(STR("answer is -2A"), STR("answer is {:X}"), I(-42)); - check(STR("answer is -0X2A"), STR("answer is {:#X}"), 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(STR("answer is 0"), STR("answer is {:#}"), I(0)); - check(STR("answer is 0"), STR("answer is {:#d}"), I(0)); - check(STR("answer is 0"), STR("answer is {:b}"), I(0)); - check(STR("answer is 0b0"), STR("answer is {:#b}"), I(0)); - check(STR("answer is 0B0"), STR("answer is {:#B}"), I(0)); - check(STR("answer is 0"), STR("answer is {:o}"), I(0)); - check(STR("answer is 0"), STR("answer is {:#o}"), I(0)); - check(STR("answer is 0"), STR("answer is {:x}"), I(0)); - check(STR("answer is 0x0"), STR("answer is {:#x}"), I(0)); - check(STR("answer is 0"), STR("answer is {:X}"), I(0)); - check(STR("answer is 0X0"), STR("answer is {:#X}"), I(0)); - - check(STR("answer is +42"), STR("answer is {:+#}"), I(42)); - check(STR("answer is +42"), STR("answer is {:+#d}"), I(42)); - check(STR("answer is +101010"), STR("answer is {:+b}"), I(42)); - check(STR("answer is +0b101010"), STR("answer is {:+#b}"), I(42)); - check(STR("answer is +0B101010"), STR("answer is {:+#B}"), I(42)); - check(STR("answer is +52"), STR("answer is {:+o}"), I(42)); - check(STR("answer is +052"), STR("answer is {:+#o}"), I(42)); - check(STR("answer is +2a"), STR("answer is {:+x}"), I(42)); - check(STR("answer is +0x2a"), STR("answer is {:+#x}"), I(42)); - check(STR("answer is +2A"), STR("answer is {:+X}"), I(42)); - check(STR("answer is +0X2A"), STR("answer is {:+#X}"), 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(STR("answer is -00000000042"), STR("answer is {:#012}"), I(-42)); - check(STR("answer is -00000000042"), STR("answer is {:#012d}"), I(-42)); - check(STR("answer is -00000101010"), STR("answer is {:012b}"), I(-42)); - check(STR("answer is -0b000101010"), STR("answer is {:#012b}"), I(-42)); - check(STR("answer is -0B000101010"), STR("answer is {:#012B}"), I(-42)); - check(STR("answer is -00000000052"), STR("answer is {:012o}"), I(-42)); - check(STR("answer is -00000000052"), STR("answer is {:#012o}"), I(-42)); - check(STR("answer is -0000000002a"), STR("answer is {:012x}"), I(-42)); - check(STR("answer is -0x00000002a"), STR("answer is {:#012x}"), I(-42)); - check(STR("answer is -0000000002A"), STR("answer is {:012X}"), I(-42)); - check(STR("answer is -0X00000002A"), STR("answer is {:#012X}"), 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(STR("answer is 000000000000"), STR("answer is {:#012}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:#012d}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:012b}"), I(0)); - check(STR("answer is 0b0000000000"), STR("answer is {:#012b}"), I(0)); - check(STR("answer is 0B0000000000"), STR("answer is {:#012B}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:012o}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:#012o}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:012x}"), I(0)); - check(STR("answer is 0x0000000000"), STR("answer is {:#012x}"), I(0)); - check(STR("answer is 000000000000"), STR("answer is {:012X}"), I(0)); - check(STR("answer is 0X0000000000"), STR("answer is {:#012X}"), I(0)); - - check(STR("answer is +00000000042"), STR("answer is {:+#012}"), I(42)); - check(STR("answer is +00000000042"), STR("answer is {:+#012d}"), I(42)); - check(STR("answer is +00000101010"), STR("answer is {:+012b}"), I(42)); - check(STR("answer is +0b000101010"), STR("answer is {:+#012b}"), I(42)); - check(STR("answer is +0B000101010"), STR("answer is {:+#012B}"), I(42)); - check(STR("answer is +00000000052"), STR("answer is {:+012o}"), I(42)); - check(STR("answer is +00000000052"), STR("answer is {:+#012o}"), I(42)); - check(STR("answer is +0000000002a"), STR("answer is {:+012x}"), I(42)); - check(STR("answer is +0x00000002a"), STR("answer is {:+#012x}"), I(42)); - check(STR("answer is +0000000002A"), STR("answer is {:+012X}"), I(42)); - check(STR("answer is +0X00000002A"), STR("answer is {:+#012X}"), 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 '}'", STR("{:.}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), I(0)); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -666,35 +665,35 @@ void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exce template void format_test_integer_as_char(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is '* '"), STR("answer is '{:6c}'"), I(42)); - check(STR("answer is ' *'"), STR("answer is '{:>6c}'"), I(42)); - check(STR("answer is '* '"), STR("answer is '{:<6c}'"), I(42)); - check(STR("answer is ' * '"), STR("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(SV("answer is ' * '"), SV("answer is '{:^6c}'"), I(42)); - check(STR("answer is '-----*'"), STR("answer is '{:->6c}'"), I(42)); - check(STR("answer is '*-----'"), STR("answer is '{:-<6c}'"), I(42)); - check(STR("answer is '--*---'"), STR("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)); // *** Sign *** - check(STR("answer is *"), STR("answer is {:c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", STR("answer is {:-c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", STR("answer is {:+c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", STR("answer is {: c}"), 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)); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", STR("answer is {:#c}"), I(42)); + check_exception("An alternate form field isn't allowed in this format-spec", SV("answer is {:#c}"), I(42)); // *** zero-padding & width *** - check_exception("A zero-padding field isn't allowed in this format-spec", STR("answer is {:01c}"), I(42)); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("answer is {:01c}"), I(42)); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.c}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0c}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42c}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), I(0)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), I(0)); // *** locale-specific form *** // Note it has no effect but it's allowed. - check(STR("answer is '*'"), STR("answer is '{:Lc}'"), I(42)); + check(SV("answer is '*'"), SV("answer is '{:Lc}'"), I(42)); // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) @@ -706,16 +705,13 @@ void format_test_integer_as_char(TestFunction check, ExceptionTest check_excepti // The code has some duplications to keep the if statement readable. if constexpr (std::signed_integral) { if constexpr (std::signed_integral && sizeof(I) > sizeof(CharT)) { - check_exception("Integral value outside the range of the char type", STR("{:c}"), - std::numeric_limits::min()); - check_exception("Integral value outside the range of the char type", STR("{:c}"), - std::numeric_limits::max()); + check_exception("Integral value outside the range of the char type", SV("{:c}"), std::numeric_limits::min()); + check_exception("Integral value outside the range of the char type", SV("{:c}"), std::numeric_limits::max()); } else if constexpr (std::unsigned_integral && sizeof(I) >= sizeof(CharT)) { - check_exception("Integral value outside the range of the char type", STR("{:c}"), - std::numeric_limits::max()); + check_exception("Integral value outside the range of the char type", SV("{:c}"), std::numeric_limits::max()); } } else if constexpr (sizeof(I) > sizeof(CharT)) { - check_exception("Integral value outside the range of the char type", STR("{:c}"), std::numeric_limits::max()); + check_exception("Integral value outside the range of the char type", SV("{:c}"), std::numeric_limits::max()); } } } @@ -737,48 +733,47 @@ void format_test_signed_integer(TestFunction check, ExceptionTest check_exceptio format_test_integer<__int128_t, CharT>(check, check_exception); #endif // *** check the minma and maxima *** - check(STR("-0b10000000"), STR("{:#b}"), std::numeric_limits::min()); - check(STR("-0200"), STR("{:#o}"), std::numeric_limits::min()); - check(STR("-128"), STR("{:#}"), std::numeric_limits::min()); - check(STR("-0x80"), STR("{:#x}"), std::numeric_limits::min()); - - check(STR("-0b1000000000000000"), STR("{:#b}"), std::numeric_limits::min()); - check(STR("-0100000"), STR("{:#o}"), std::numeric_limits::min()); - check(STR("-32768"), STR("{:#}"), std::numeric_limits::min()); - check(STR("-0x8000"), STR("{:#x}"), std::numeric_limits::min()); - - check(STR("-0b10000000000000000000000000000000"), STR("{:#b}"), std::numeric_limits::min()); - check(STR("-020000000000"), STR("{:#o}"), std::numeric_limits::min()); - check(STR("-2147483648"), STR("{:#}"), std::numeric_limits::min()); - check(STR("-0x80000000"), STR("{:#x}"), std::numeric_limits::min()); - - check(STR("-0b100000000000000000000000000000000000000000000000000000000000000" - "0"), - STR("{:#b}"), std::numeric_limits::min()); - check(STR("-01000000000000000000000"), STR("{:#o}"), std::numeric_limits::min()); - check(STR("-9223372036854775808"), STR("{:#}"), std::numeric_limits::min()); - check(STR("-0x8000000000000000"), STR("{:#x}"), std::numeric_limits::min()); - - check(STR("0b1111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("0177"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("127"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0x7f"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b111111111111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("077777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("32767"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0x7fff"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b1111111111111111111111111111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("017777777777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("2147483647"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0x7fffffff"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b111111111111111111111111111111111111111111111111111111111111111"), STR("{:#b}"), + 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()); + + 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(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(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(SV("0b111111111111111111111111111111111111111111111111111111111111111"), SV("{:#b}"), std::numeric_limits::max()); - check(STR("0777777777777777777777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("9223372036854775807"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0x7fffffffffffffff"), STR("{:#x}"), 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()); // TODO FMT Add __int128_t test after implementing full range. } @@ -794,26 +789,26 @@ void format_test_unsigned_integer(TestFunction check, ExceptionTest check_except format_test_integer<__uint128_t, CharT>(check, check_exception); #endif // *** test the maxima *** - check(STR("0b11111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("0377"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("255"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0xff"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b1111111111111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("0177777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("65535"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0xffff"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b11111111111111111111111111111111"), STR("{:#b}"), std::numeric_limits::max()); - check(STR("037777777777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("4294967295"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0xffffffff"), STR("{:#x}"), std::numeric_limits::max()); - - check(STR("0b1111111111111111111111111111111111111111111111111111111111111111"), STR("{:#b}"), + 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(STR("01777777777777777777777"), STR("{:#o}"), std::numeric_limits::max()); - check(STR("18446744073709551615"), STR("{:#}"), std::numeric_limits::max()); - check(STR("0xffffffffffffffff"), STR("{:#x}"), 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()); // TODO FMT Add __uint128_t test after implementing full range. } @@ -823,54 +818,54 @@ void format_test_char(TestFunction check, ExceptionTest check_exception) { // ***** Char type ***** // *** align-fill & width *** - check(STR("answer is '* '"), STR("answer is '{:6}'"), CharT('*')); - check(STR("answer is ' *'"), STR("answer is '{:>6}'"), CharT('*')); - check(STR("answer is '* '"), STR("answer is '{:<6}'"), CharT('*')); - check(STR("answer is ' * '"), STR("answer is '{:^6}'"), 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(SV("answer is ' * '"), SV("answer is '{:^6}'"), CharT('*')); - check(STR("answer is '* '"), STR("answer is '{:6c}'"), CharT('*')); - check(STR("answer is ' *'"), STR("answer is '{:>6c}'"), CharT('*')); - check(STR("answer is '* '"), STR("answer is '{:<6c}'"), CharT('*')); - check(STR("answer is ' * '"), STR("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(SV("answer is ' * '"), SV("answer is '{:^6c}'"), CharT('*')); - check(STR("answer is '-----*'"), STR("answer is '{:->6}'"), CharT('*')); - check(STR("answer is '*-----'"), STR("answer is '{:-<6}'"), CharT('*')); - check(STR("answer is '--*---'"), STR("answer is '{:-^6}'"), 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(STR("answer is '-----*'"), STR("answer is '{:->6c}'"), CharT('*')); - check(STR("answer is '*-----'"), STR("answer is '{:-<6c}'"), CharT('*')); - check(STR("answer is '--*---'"), STR("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('*')); // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", STR("{:-}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", STR("{:+}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", STR("{: }"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{:+}"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{: }"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", STR("{:-c}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", STR("{:+c}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", STR("{: c}"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{:-c}"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{:+c}"), CharT('*')); + check_exception("A sign field isn't allowed in this format-spec", SV("{: c}"), CharT('*')); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", STR("{:#}"), CharT('*')); - check_exception("An alternate form field isn't allowed in this format-spec", STR("{:#c}"), CharT('*')); + check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#}"), CharT('*')); + check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#c}"), CharT('*')); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", STR("{:0}"), CharT('*')); - check_exception("A zero-padding field isn't allowed in this format-spec", STR("{:0c}"), CharT('*')); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0}"), CharT('*')); + check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0c}"), CharT('*')); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.c}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0c}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42c}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), CharT('*')); // *** locale-specific form *** // Note it has no effect but it's allowed. - check(STR("answer is '*'"), STR("answer is '{:L}'"), '*'); - check(STR("answer is '*'"), STR("answer is '{:Lc}'"), '*'); + check(SV("answer is '*'"), SV("answer is '{:L}'"), '*'); + check(SV("answer is '*'"), SV("answer is '{:Lc}'"), '*'); // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) @@ -880,60 +875,60 @@ void format_test_char(TestFunction check, ExceptionTest check_exception) { template void format_test_char_as_integer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is '42'"), STR("answer is '{:<1d}'"), CharT('*')); + check(SV("answer is '42'"), SV("answer is '{:<1d}'"), CharT('*')); - check(STR("answer is '42'"), STR("answer is '{:<2d}'"), CharT('*')); - check(STR("answer is '42 '"), STR("answer is '{:<3d}'"), CharT('*')); + check(SV("answer is '42'"), SV("answer is '{:<2d}'"), CharT('*')); + check(SV("answer is '42 '"), SV("answer is '{:<3d}'"), CharT('*')); - check(STR("answer is ' 42'"), STR("answer is '{:7d}'"), CharT('*')); - check(STR("answer is ' 42'"), STR("answer is '{:>7d}'"), CharT('*')); - check(STR("answer is '42 '"), STR("answer is '{:<7d}'"), CharT('*')); - check(STR("answer is ' 42 '"), STR("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(SV("answer is ' 42 '"), SV("answer is '{:^7d}'"), CharT('*')); - check(STR("answer is '*****42'"), STR("answer is '{:*>7d}'"), CharT('*')); - check(STR("answer is '42*****'"), STR("answer is '{:*<7d}'"), CharT('*')); - check(STR("answer is '**42***'"), STR("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('*')); // Test whether zero padding is ignored - check(STR("answer is ' 42'"), STR("answer is '{:>07d}'"), CharT('*')); - check(STR("answer is '42 '"), STR("answer is '{:<07d}'"), CharT('*')); - check(STR("answer is ' 42 '"), STR("answer is '{:^07d}'"), 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(STR("answer is 42"), STR("answer is {:d}"), CharT('*')); - check(STR("answer is 42"), STR("answer is {:-d}"), CharT('*')); - check(STR("answer is +42"), STR("answer is {:+d}"), CharT('*')); - check(STR("answer is 42"), STR("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('*')); + check(SV("answer is 42"), SV("answer is {: d}"), CharT('*')); // *** alternate form *** - check(STR("answer is +42"), STR("answer is {:+#d}"), CharT('*')); - check(STR("answer is +101010"), STR("answer is {:+b}"), CharT('*')); - check(STR("answer is +0b101010"), STR("answer is {:+#b}"), CharT('*')); - check(STR("answer is +0B101010"), STR("answer is {:+#B}"), CharT('*')); - check(STR("answer is +52"), STR("answer is {:+o}"), CharT('*')); - check(STR("answer is +052"), STR("answer is {:+#o}"), CharT('*')); - check(STR("answer is +2a"), STR("answer is {:+x}"), CharT('*')); - check(STR("answer is +0x2a"), STR("answer is {:+#x}"), CharT('*')); - check(STR("answer is +2A"), STR("answer is {:+X}"), CharT('*')); - check(STR("answer is +0X2A"), STR("answer is {:+#X}"), 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(STR("answer is +00000000042"), STR("answer is {:+#012d}"), CharT('*')); - check(STR("answer is +00000101010"), STR("answer is {:+012b}"), CharT('*')); - check(STR("answer is +0b000101010"), STR("answer is {:+#012b}"), CharT('*')); - check(STR("answer is +0B000101010"), STR("answer is {:+#012B}"), CharT('*')); - check(STR("answer is +00000000052"), STR("answer is {:+012o}"), CharT('*')); - check(STR("answer is +00000000052"), STR("answer is {:+#012o}"), CharT('*')); - check(STR("answer is +0000000002a"), STR("answer is {:+012x}"), CharT('*')); - check(STR("answer is +0x00000002a"), STR("answer is {:+#012x}"), CharT('*')); - check(STR("answer is +0000000002A"), STR("answer is {:+012X}"), CharT('*')); - - check(STR("answer is +0X00000002A"), STR("answer is {:+#012X}"), 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 '}'", STR("{:.d}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.0d}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.42d}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.d}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0d}"), CharT('*')); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42d}"), CharT('*')); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -950,116 +945,116 @@ void format_test_floating_point_hex_lower_case(TestFunction check) { // Test whether the hexadecimal letters are the proper case. // The precision is too large for float, so two tests are used. - check(STR("answer is '1.abcp+0'"), STR("answer is '{:a}'"), F(0x1.abcp+0)); - check(STR("answer is '1.defp+0'"), STR("answer is '{:a}'"), 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(STR("answer is ' 1p-2'"), STR("answer is '{:7a}'"), F(0.25)); - check(STR("answer is ' 1p-2'"), STR("answer is '{:>7a}'"), F(0.25)); - check(STR("answer is '1p-2 '"), STR("answer is '{:<7a}'"), F(0.25)); - check(STR("answer is ' 1p-2 '"), STR("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(SV("answer is ' 1p-2 '"), SV("answer is '{:^7a}'"), F(0.25)); - check(STR("answer is '---1p-3'"), STR("answer is '{:->7a}'"), F(125e-3)); - check(STR("answer is '1p-3---'"), STR("answer is '{:-<7a}'"), F(125e-3)); - check(STR("answer is '-1p-3--'"), STR("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(SV("answer is '-1p-3--'"), SV("answer is '{:-^7a}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6a}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6a}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(STR("answer is '###-inf'"), STR("answer is '{:#>7a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6a}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6a}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(STR("answer is '000-nan'"), STR("answer is '{:0>7a}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7a}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7a}'"), 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(STR("answer is ' 1p-2'"), STR("answer is '{:>07a}'"), F(0.25)); - check(STR("answer is '1p-2 '"), STR("answer is '{:<07a}'"), F(0.25)); - check(STR("answer is ' 1p-2 '"), STR("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)); + check(SV("answer is ' 1p-2 '"), SV("answer is '{:^07a}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0p+0'"), STR("answer is '{:a}'"), F(0)); - check(STR("answer is '0p+0'"), STR("answer is '{:-a}'"), F(0)); - check(STR("answer is '+0p+0'"), STR("answer is '{:+a}'"), F(0)); - check(STR("answer is ' 0p+0'"), STR("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(SV("answer is ' 0p+0'"), SV("answer is '{: a}'"), F(0)); - check(STR("answer is '-0p+0'"), STR("answer is '{:a}'"), F(-0.)); - check(STR("answer is '-0p+0'"), STR("answer is '{:-a}'"), F(-0.)); - check(STR("answer is '-0p+0'"), STR("answer is '{:+a}'"), F(-0.)); - check(STR("answer is '-0p+0'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:a}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-a}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: a}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: a}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:a}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-a}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: a}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: a}'"), 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(STR("answer is '0p+0'"), STR("answer is '{:a}'"), F(0)); - check(STR("answer is '0.p+0'"), STR("answer is '{:#a}'"), 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(STR("answer is '1p+1'"), STR("answer is '{:.0a}'"), F(2.5)); - check(STR("answer is '1.p+1'"), STR("answer is '{:#.0a}'"), F(2.5)); - check(STR("answer is '1.4p+1'"), STR("answer is '{:#a}'"), 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(STR("answer is 'inf'"), STR("answer is '{:#a}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#a}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#a}'"), 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(STR("answer is '1p-5'"), STR("answer is '{:04a}'"), 0.03125); - check(STR("answer is '+1p-5'"), STR("answer is '{:+05a}'"), 0.03125); - check(STR("answer is '+01p-5'"), STR("answer is '{:+06a}'"), 0.03125); - - check(STR("answer is '0001p-5'"), STR("answer is '{:07a}'"), 0.03125); - check(STR("answer is '0001p-5'"), STR("answer is '{:-07a}'"), 0.03125); - check(STR("answer is '+001p-5'"), STR("answer is '{:+07a}'"), 0.03125); - check(STR("answer is ' 001p-5'"), STR("answer is '{: 07a}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010a}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010a}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010a}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010a}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010a}'"), 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 @@ -1075,116 +1070,116 @@ void format_test_floating_point_hex_upper_case(TestFunction check) { // Test whether the hexadecimal letters are the proper case. // The precision is too large for float, so two tests are used. - check(STR("answer is '1.ABCP+0'"), STR("answer is '{:A}'"), F(0x1.abcp+0)); - check(STR("answer is '1.DEFP+0'"), STR("answer is '{:A}'"), 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(STR("answer is ' 1P-2'"), STR("answer is '{:7A}'"), F(0.25)); - check(STR("answer is ' 1P-2'"), STR("answer is '{:>7A}'"), F(0.25)); - check(STR("answer is '1P-2 '"), STR("answer is '{:<7A}'"), F(0.25)); - check(STR("answer is ' 1P-2 '"), STR("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(SV("answer is ' 1P-2 '"), SV("answer is '{:^7A}'"), F(0.25)); - check(STR("answer is '---1P-3'"), STR("answer is '{:->7A}'"), F(125e-3)); - check(STR("answer is '1P-3---'"), STR("answer is '{:-<7A}'"), F(125e-3)); - check(STR("answer is '-1P-3--'"), STR("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(SV("answer is '-1P-3--'"), SV("answer is '{:-^7A}'"), F(125e-3)); - check(STR("answer is '***INF'"), STR("answer is '{:*>6A}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF***'"), STR("answer is '{:*<6A}'"), std::numeric_limits::infinity()); - check(STR("answer is '*INF**'"), STR("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(STR("answer is '###-INF'"), STR("answer is '{:#>7A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF###'"), STR("answer is '{:#<7A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-INF##'"), STR("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(SV("answer is '#-INF##'"), SV("answer is '{:#^7A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^NAN'"), STR("answer is '{:^>6A}'"), nan_pos); - check(STR("answer is 'NAN^^^'"), STR("answer is '{:^<6A}'"), nan_pos); - check(STR("answer is '^NAN^^'"), STR("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(STR("answer is '000-NAN'"), STR("answer is '{:0>7A}'"), nan_neg); - check(STR("answer is '-NAN000'"), STR("answer is '{:0<7A}'"), nan_neg); - check(STR("answer is '0-NAN00'"), STR("answer is '{:0^7A}'"), 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(STR("answer is ' 1P-2'"), STR("answer is '{:>07A}'"), F(0.25)); - check(STR("answer is '1P-2 '"), STR("answer is '{:<07A}'"), F(0.25)); - check(STR("answer is ' 1P-2 '"), STR("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)); + check(SV("answer is ' 1P-2 '"), SV("answer is '{:^07A}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0P+0'"), STR("answer is '{:A}'"), F(0)); - check(STR("answer is '0P+0'"), STR("answer is '{:-A}'"), F(0)); - check(STR("answer is '+0P+0'"), STR("answer is '{:+A}'"), F(0)); - check(STR("answer is ' 0P+0'"), STR("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(SV("answer is ' 0P+0'"), SV("answer is '{: A}'"), F(0)); - check(STR("answer is '-0P+0'"), STR("answer is '{:A}'"), F(-0.)); - check(STR("answer is '-0P+0'"), STR("answer is '{:-A}'"), F(-0.)); - check(STR("answer is '-0P+0'"), STR("answer is '{:+A}'"), F(-0.)); - check(STR("answer is '-0P+0'"), STR("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(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(STR("answer is 'INF'"), STR("answer is '{:A}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF'"), STR("answer is '{:-A}'"), std::numeric_limits::infinity()); - check(STR("answer is '+INF'"), STR("answer is '{:+A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: A}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-INF'"), STR("answer is '{:A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:-A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:+A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{: A}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'NAN'"), STR("answer is '{:A}'"), nan_pos); - check(STR("answer is 'NAN'"), STR("answer is '{:-A}'"), nan_pos); - check(STR("answer is '+NAN'"), STR("answer is '{:+A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: A}'"), nan_pos); - - check(STR("answer is '-NAN'"), STR("answer is '{:A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:-A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:+A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{: A}'"), 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(STR("answer is '0P+0'"), STR("answer is '{:A}'"), F(0)); - check(STR("answer is '0.P+0'"), STR("answer is '{:#A}'"), 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(STR("answer is '1P+1'"), STR("answer is '{:.0A}'"), F(2.5)); - check(STR("answer is '1.P+1'"), STR("answer is '{:#.0A}'"), F(2.5)); - check(STR("answer is '1.4P+1'"), STR("answer is '{:#A}'"), 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(STR("answer is 'INF'"), STR("answer is '{:#A}'"), std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("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(STR("answer is 'NAN'"), STR("answer is '{:#A}'"), nan_pos); - check(STR("answer is '-NAN'"), STR("answer is '{:#A}'"), 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(STR("answer is '1P-5'"), STR("answer is '{:04A}'"), 0.03125); - check(STR("answer is '+1P-5'"), STR("answer is '{:+05A}'"), 0.03125); - check(STR("answer is '+01P-5'"), STR("answer is '{:+06A}'"), 0.03125); - - check(STR("answer is '0001P-5'"), STR("answer is '{:07A}'"), 0.03125); - check(STR("answer is '0001P-5'"), STR("answer is '{:-07A}'"), 0.03125); - check(STR("answer is '+001P-5'"), STR("answer is '{:+07A}'"), 0.03125); - check(STR("answer is ' 001P-5'"), STR("answer is '{: 07A}'"), 0.03125); - - check(STR("answer is ' INF'"), STR("answer is '{:010A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{:-010A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +INF'"), STR("answer is '{:+010A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: 010A}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -INF'"), STR("answer is '{:010A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:-010A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:+010A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{: 010A}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' NAN'"), STR("answer is '{:010A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{:-010A}'"), nan_pos); - check(STR("answer is ' +NAN'"), STR("answer is '{:+010A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: 010A}'"), nan_pos); - - check(STR("answer is ' -NAN'"), STR("answer is '{:010A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:-010A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:+010A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{: 010A}'"), 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 @@ -1199,106 +1194,106 @@ void format_test_floating_point_hex_lower_case_precision(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 1.000000p-2'"), STR("answer is '{:14.6a}'"), F(0.25)); - check(STR("answer is ' 1.000000p-2'"), STR("answer is '{:>14.6a}'"), F(0.25)); - check(STR("answer is '1.000000p-2 '"), STR("answer is '{:<14.6a}'"), F(0.25)); - check(STR("answer is ' 1.000000p-2 '"), STR("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(SV("answer is ' 1.000000p-2 '"), SV("answer is '{:^14.6a}'"), F(0.25)); - check(STR("answer is '---1.000000p-3'"), STR("answer is '{:->14.6a}'"), F(125e-3)); - check(STR("answer is '1.000000p-3---'"), STR("answer is '{:-<14.6a}'"), F(125e-3)); - check(STR("answer is '-1.000000p-3--'"), STR("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(SV("answer is '-1.000000p-3--'"), SV("answer is '{:-^14.6a}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(SV("answer is '*inf**'"), SV("answer is '{:*^6.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-inf'"), STR("answer is '{:#>7.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6.6a}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6.6a}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(SV("answer is '^nan^^'"), SV("answer is '{:^^6.6a}'"), nan_pos); - check(STR("answer is '000-nan'"), STR("answer is '{:0>7.6a}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7.6a}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7.6a}'"), 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(STR("answer is ' 1.000000p-2'"), STR("answer is '{:>014.6a}'"), F(0.25)); - check(STR("answer is '1.000000p-2 '"), STR("answer is '{:<014.6a}'"), F(0.25)); - check(STR("answer is ' 1.000000p-2 '"), STR("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)); + check(SV("answer is ' 1.000000p-2 '"), SV("answer is '{:^014.6a}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000p+0'"), STR("answer is '{:.6a}'"), F(0)); - check(STR("answer is '0.000000p+0'"), STR("answer is '{:-.6a}'"), F(0)); - check(STR("answer is '+0.000000p+0'"), STR("answer is '{:+.6a}'"), F(0)); - check(STR("answer is ' 0.000000p+0'"), STR("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(SV("answer is ' 0.000000p+0'"), SV("answer is '{: .6a}'"), F(0)); - check(STR("answer is '-0.000000p+0'"), STR("answer is '{:.6a}'"), F(-0.)); - check(STR("answer is '-0.000000p+0'"), STR("answer is '{:-.6a}'"), F(-0.)); - check(STR("answer is '-0.000000p+0'"), STR("answer is '{:+.6a}'"), F(-0.)); - check(STR("answer is '-0.000000p+0'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: .6a}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: .6a}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:.6a}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-.6a}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+.6a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: .6a}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:.6a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-.6a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+.6a}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: .6a}'"), 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(STR("answer is '1.400000p+1'"), STR("answer is '{:#.6a}'"), F(2.5)); + check(SV("answer is '1.400000p+1'"), SV("answer is '{:#.6a}'"), F(2.5)); - check(STR("answer is 'inf'"), STR("answer is '{:#.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#.6a}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#.6a}'"), 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(STR("answer is '1.000000p-5'"), STR("answer is '{:011.6a}'"), 0.03125); - check(STR("answer is '+1.000000p-5'"), STR("answer is '{:+012.6a}'"), 0.03125); - check(STR("answer is '+01.000000p-5'"), STR("answer is '{:+013.6a}'"), 0.03125); - - check(STR("answer is '0001.000000p-5'"), STR("answer is '{:014.6a}'"), 0.03125); - check(STR("answer is '0001.000000p-5'"), STR("answer is '{:-014.6a}'"), 0.03125); - check(STR("answer is '+001.000000p-5'"), STR("answer is '{:+014.6a}'"), 0.03125); - check(STR("answer is ' 001.000000p-5'"), STR("answer is '{: 014.6a}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010.6a}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010.6a}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010.6a}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010.6a}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010.6a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010.6a}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010.6a}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010.6a}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010.6a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010.6a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010.6a}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010.6a}'"), 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 @@ -1310,106 +1305,106 @@ void format_test_floating_point_hex_upper_case_precision(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 1.000000P-2'"), STR("answer is '{:14.6A}'"), F(0.25)); - check(STR("answer is ' 1.000000P-2'"), STR("answer is '{:>14.6A}'"), F(0.25)); - check(STR("answer is '1.000000P-2 '"), STR("answer is '{:<14.6A}'"), F(0.25)); - check(STR("answer is ' 1.000000P-2 '"), STR("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(SV("answer is ' 1.000000P-2 '"), SV("answer is '{:^14.6A}'"), F(0.25)); - check(STR("answer is '---1.000000P-3'"), STR("answer is '{:->14.6A}'"), F(125e-3)); - check(STR("answer is '1.000000P-3---'"), STR("answer is '{:-<14.6A}'"), F(125e-3)); - check(STR("answer is '-1.000000P-3--'"), STR("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(SV("answer is '-1.000000P-3--'"), SV("answer is '{:-^14.6A}'"), F(125e-3)); - check(STR("answer is '***INF'"), STR("answer is '{:*>6.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF***'"), STR("answer is '{:*<6.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is '*INF**'"), STR("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(SV("answer is '*INF**'"), SV("answer is '{:*^6.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-INF'"), STR("answer is '{:#>7.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF###'"), STR("answer is '{:#<7.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-INF##'"), STR("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(SV("answer is '#-INF##'"), SV("answer is '{:#^7.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^NAN'"), STR("answer is '{:^>6.6A}'"), nan_pos); - check(STR("answer is 'NAN^^^'"), STR("answer is '{:^<6.6A}'"), nan_pos); - check(STR("answer is '^NAN^^'"), STR("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(SV("answer is '^NAN^^'"), SV("answer is '{:^^6.6A}'"), nan_pos); - check(STR("answer is '000-NAN'"), STR("answer is '{:0>7.6A}'"), nan_neg); - check(STR("answer is '-NAN000'"), STR("answer is '{:0<7.6A}'"), nan_neg); - check(STR("answer is '0-NAN00'"), STR("answer is '{:0^7.6A}'"), 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(STR("answer is ' 1.000000P-2'"), STR("answer is '{:>014.6A}'"), F(0.25)); - check(STR("answer is '1.000000P-2 '"), STR("answer is '{:<014.6A}'"), F(0.25)); - check(STR("answer is ' 1.000000P-2 '"), STR("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)); + check(SV("answer is ' 1.000000P-2 '"), SV("answer is '{:^014.6A}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000P+0'"), STR("answer is '{:.6A}'"), F(0)); - check(STR("answer is '0.000000P+0'"), STR("answer is '{:-.6A}'"), F(0)); - check(STR("answer is '+0.000000P+0'"), STR("answer is '{:+.6A}'"), F(0)); - check(STR("answer is ' 0.000000P+0'"), STR("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(SV("answer is ' 0.000000P+0'"), SV("answer is '{: .6A}'"), F(0)); - check(STR("answer is '-0.000000P+0'"), STR("answer is '{:.6A}'"), F(-0.)); - check(STR("answer is '-0.000000P+0'"), STR("answer is '{:-.6A}'"), F(-0.)); - check(STR("answer is '-0.000000P+0'"), STR("answer is '{:+.6A}'"), F(-0.)); - check(STR("answer is '-0.000000P+0'"), STR("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(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(STR("answer is 'INF'"), STR("answer is '{:.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF'"), STR("answer is '{:-.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is '+INF'"), STR("answer is '{:+.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: .6A}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-INF'"), STR("answer is '{:.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:-.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:+.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{: .6A}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'NAN'"), STR("answer is '{:.6A}'"), nan_pos); - check(STR("answer is 'NAN'"), STR("answer is '{:-.6A}'"), nan_pos); - check(STR("answer is '+NAN'"), STR("answer is '{:+.6A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: .6A}'"), nan_pos); - - check(STR("answer is '-NAN'"), STR("answer is '{:.6A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:-.6A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:+.6A}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{: .6A}'"), 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(STR("answer is '1.400000P+1'"), STR("answer is '{:#.6A}'"), F(2.5)); + check(SV("answer is '1.400000P+1'"), SV("answer is '{:#.6A}'"), F(2.5)); - check(STR("answer is 'INF'"), STR("answer is '{:#.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("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(STR("answer is 'NAN'"), STR("answer is '{:#.6A}'"), nan_pos); - check(STR("answer is '-NAN'"), STR("answer is '{:#.6A}'"), 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(STR("answer is '1.000000P-5'"), STR("answer is '{:011.6A}'"), 0.03125); - check(STR("answer is '+1.000000P-5'"), STR("answer is '{:+012.6A}'"), 0.03125); - check(STR("answer is '+01.000000P-5'"), STR("answer is '{:+013.6A}'"), 0.03125); - - check(STR("answer is '0001.000000P-5'"), STR("answer is '{:014.6A}'"), 0.03125); - check(STR("answer is '0001.000000P-5'"), STR("answer is '{:-014.6A}'"), 0.03125); - check(STR("answer is '+001.000000P-5'"), STR("answer is '{:+014.6A}'"), 0.03125); - check(STR("answer is ' 001.000000P-5'"), STR("answer is '{: 014.6A}'"), 0.03125); - - check(STR("answer is ' INF'"), STR("answer is '{:010.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{:-010.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +INF'"), STR("answer is '{:+010.6A}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: 010.6A}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -INF'"), STR("answer is '{:010.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:-010.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:+010.6A}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{: 010.6A}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' NAN'"), STR("answer is '{:010.6A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{:-010.6A}'"), nan_pos); - check(STR("answer is ' +NAN'"), STR("answer is '{:+010.6A}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: 010.6A}'"), nan_pos); - - check(STR("answer is ' -NAN'"), STR("answer is '{:010.6A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:-010.6A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:+010.6A}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{: 010.6A}'"), 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 @@ -1421,118 +1416,118 @@ void format_test_floating_point_scientific_lower_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 2.500000e-01'"), STR("answer is '{:15e}'"), F(0.25)); - check(STR("answer is ' 2.500000e-01'"), STR("answer is '{:>15e}'"), F(0.25)); - check(STR("answer is '2.500000e-01 '"), STR("answer is '{:<15e}'"), F(0.25)); - check(STR("answer is ' 2.500000e-01 '"), STR("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(SV("answer is ' 2.500000e-01 '"), SV("answer is '{:^15e}'"), F(0.25)); - check(STR("answer is '---1.250000e-01'"), STR("answer is '{:->15e}'"), F(125e-3)); - check(STR("answer is '1.250000e-01---'"), STR("answer is '{:-<15e}'"), F(125e-3)); - check(STR("answer is '-1.250000e-01--'"), STR("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(SV("answer is '-1.250000e-01--'"), SV("answer is '{:-^15e}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6e}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6e}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(SV("answer is '*inf**'"), SV("answer is '{:*^6e}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-inf'"), STR("answer is '{:#>7e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6e}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6e}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(SV("answer is '^nan^^'"), SV("answer is '{:^^6e}'"), nan_pos); - check(STR("answer is '000-nan'"), STR("answer is '{:0>7e}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7e}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7e}'"), 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(STR("answer is ' 2.500000e-01'"), STR("answer is '{:>015e}'"), F(0.25)); - check(STR("answer is '2.500000e-01 '"), STR("answer is '{:<015e}'"), F(0.25)); - check(STR("answer is ' 2.500000e-01 '"), STR("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)); + check(SV("answer is ' 2.500000e-01 '"), SV("answer is '{:^015e}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000e+00'"), STR("answer is '{:e}'"), F(0)); - check(STR("answer is '0.000000e+00'"), STR("answer is '{:-e}'"), F(0)); - check(STR("answer is '+0.000000e+00'"), STR("answer is '{:+e}'"), F(0)); - check(STR("answer is ' 0.000000e+00'"), STR("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(SV("answer is ' 0.000000e+00'"), SV("answer is '{: e}'"), F(0)); - check(STR("answer is '-0.000000e+00'"), STR("answer is '{:e}'"), F(-0.)); - check(STR("answer is '-0.000000e+00'"), STR("answer is '{:-e}'"), F(-0.)); - check(STR("answer is '-0.000000e+00'"), STR("answer is '{:+e}'"), F(-0.)); - check(STR("answer is '-0.000000e+00'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:e}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-e}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+e}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: e}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+e}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: e}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:e}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-e}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+e}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: e}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:e}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-e}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+e}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: e}'"), 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(STR("answer is '0e+00'"), STR("answer is '{:.0e}'"), F(0)); - check(STR("answer is '0.e+00'"), STR("answer is '{:#.0e}'"), 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(STR("answer is '0.000000e+00'"), STR("answer is '{:#e}'"), F(0)); - check(STR("answer is '2.500000e+00'"), STR("answer is '{:#e}'"), 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(STR("answer is 'inf'"), STR("answer is '{:#e}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#e}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#e}'"), 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(STR("answer is '3.125000e-02'"), STR("answer is '{:07e}'"), 0.03125); - check(STR("answer is '+3.125000e-02'"), STR("answer is '{:+07e}'"), 0.03125); - check(STR("answer is '+3.125000e-02'"), STR("answer is '{:+08e}'"), 0.03125); - check(STR("answer is '+3.125000e-02'"), STR("answer is '{:+09e}'"), 0.03125); - - check(STR("answer is '003.125000e-02'"), STR("answer is '{:014e}'"), 0.03125); - check(STR("answer is '003.125000e-02'"), STR("answer is '{:-014e}'"), 0.03125); - check(STR("answer is '+03.125000e-02'"), STR("answer is '{:+014e}'"), 0.03125); - check(STR("answer is ' 03.125000e-02'"), STR("answer is '{: 014e}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010e}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010e}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010e}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010e}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010e}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010e}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010e}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010e}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010e}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010e}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010e}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010e}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010e}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010e}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010e}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010e}'"), 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(STR("answer is '3e-02'"), STR("answer is '{:.0e}'"), 0.03125); - check(STR("answer is '3.1e-02'"), STR("answer is '{:.1e}'"), 0.03125); - check(STR("answer is '3.125e-02'"), STR("answer is '{:.3e}'"), 0.03125); - check(STR("answer is '3.1250000000e-02'"), STR("answer is '{:.10e}'"), 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 @@ -1544,118 +1539,118 @@ void format_test_floating_point_scientific_upper_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 2.500000E-01'"), STR("answer is '{:15E}'"), F(0.25)); - check(STR("answer is ' 2.500000E-01'"), STR("answer is '{:>15E}'"), F(0.25)); - check(STR("answer is '2.500000E-01 '"), STR("answer is '{:<15E}'"), F(0.25)); - check(STR("answer is ' 2.500000E-01 '"), STR("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(SV("answer is ' 2.500000E-01 '"), SV("answer is '{:^15E}'"), F(0.25)); - check(STR("answer is '---1.250000E-01'"), STR("answer is '{:->15E}'"), F(125e-3)); - check(STR("answer is '1.250000E-01---'"), STR("answer is '{:-<15E}'"), F(125e-3)); - check(STR("answer is '-1.250000E-01--'"), STR("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(SV("answer is '-1.250000E-01--'"), SV("answer is '{:-^15E}'"), F(125e-3)); - check(STR("answer is '***INF'"), STR("answer is '{:*>6E}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF***'"), STR("answer is '{:*<6E}'"), std::numeric_limits::infinity()); - check(STR("answer is '*INF**'"), STR("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(SV("answer is '*INF**'"), SV("answer is '{:*^6E}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-INF'"), STR("answer is '{:#>7E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF###'"), STR("answer is '{:#<7E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-INF##'"), STR("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(SV("answer is '#-INF##'"), SV("answer is '{:#^7E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^NAN'"), STR("answer is '{:^>6E}'"), nan_pos); - check(STR("answer is 'NAN^^^'"), STR("answer is '{:^<6E}'"), nan_pos); - check(STR("answer is '^NAN^^'"), STR("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(SV("answer is '^NAN^^'"), SV("answer is '{:^^6E}'"), nan_pos); - check(STR("answer is '000-NAN'"), STR("answer is '{:0>7E}'"), nan_neg); - check(STR("answer is '-NAN000'"), STR("answer is '{:0<7E}'"), nan_neg); - check(STR("answer is '0-NAN00'"), STR("answer is '{:0^7E}'"), 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(STR("answer is ' 2.500000E-01'"), STR("answer is '{:>015E}'"), F(0.25)); - check(STR("answer is '2.500000E-01 '"), STR("answer is '{:<015E}'"), F(0.25)); - check(STR("answer is ' 2.500000E-01 '"), STR("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)); + check(SV("answer is ' 2.500000E-01 '"), SV("answer is '{:^015E}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000E+00'"), STR("answer is '{:E}'"), F(0)); - check(STR("answer is '0.000000E+00'"), STR("answer is '{:-E}'"), F(0)); - check(STR("answer is '+0.000000E+00'"), STR("answer is '{:+E}'"), F(0)); - check(STR("answer is ' 0.000000E+00'"), STR("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(SV("answer is ' 0.000000E+00'"), SV("answer is '{: E}'"), F(0)); - check(STR("answer is '-0.000000E+00'"), STR("answer is '{:E}'"), F(-0.)); - check(STR("answer is '-0.000000E+00'"), STR("answer is '{:-E}'"), F(-0.)); - check(STR("answer is '-0.000000E+00'"), STR("answer is '{:+E}'"), F(-0.)); - check(STR("answer is '-0.000000E+00'"), STR("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(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(STR("answer is 'INF'"), STR("answer is '{:E}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF'"), STR("answer is '{:-E}'"), std::numeric_limits::infinity()); - check(STR("answer is '+INF'"), STR("answer is '{:+E}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: E}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-INF'"), STR("answer is '{:E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:-E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:+E}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{: E}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'NAN'"), STR("answer is '{:E}'"), nan_pos); - check(STR("answer is 'NAN'"), STR("answer is '{:-E}'"), nan_pos); - check(STR("answer is '+NAN'"), STR("answer is '{:+E}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: E}'"), nan_pos); - - check(STR("answer is '-NAN'"), STR("answer is '{:E}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:-E}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:+E}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{: E}'"), 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(STR("answer is '0E+00'"), STR("answer is '{:.0E}'"), F(0)); - check(STR("answer is '0.E+00'"), STR("answer is '{:#.0E}'"), 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(STR("answer is '0.000000E+00'"), STR("answer is '{:#E}'"), F(0)); - check(STR("answer is '2.500000E+00'"), STR("answer is '{:#E}'"), 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(STR("answer is 'INF'"), STR("answer is '{:#E}'"), std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("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(STR("answer is 'NAN'"), STR("answer is '{:#E}'"), nan_pos); - check(STR("answer is '-NAN'"), STR("answer is '{:#E}'"), 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(STR("answer is '3.125000E-02'"), STR("answer is '{:07E}'"), 0.03125); - check(STR("answer is '+3.125000E-02'"), STR("answer is '{:+07E}'"), 0.03125); - check(STR("answer is '+3.125000E-02'"), STR("answer is '{:+08E}'"), 0.03125); - check(STR("answer is '+3.125000E-02'"), STR("answer is '{:+09E}'"), 0.03125); - - check(STR("answer is '003.125000E-02'"), STR("answer is '{:014E}'"), 0.03125); - check(STR("answer is '003.125000E-02'"), STR("answer is '{:-014E}'"), 0.03125); - check(STR("answer is '+03.125000E-02'"), STR("answer is '{:+014E}'"), 0.03125); - check(STR("answer is ' 03.125000E-02'"), STR("answer is '{: 014E}'"), 0.03125); - - check(STR("answer is ' INF'"), STR("answer is '{:010E}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{:-010E}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +INF'"), STR("answer is '{:+010E}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: 010E}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -INF'"), STR("answer is '{:010E}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:-010E}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:+010E}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{: 010E}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' NAN'"), STR("answer is '{:010E}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{:-010E}'"), nan_pos); - check(STR("answer is ' +NAN'"), STR("answer is '{:+010E}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: 010E}'"), nan_pos); - - check(STR("answer is ' -NAN'"), STR("answer is '{:010E}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:-010E}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:+010E}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{: 010E}'"), 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(STR("answer is '3E-02'"), STR("answer is '{:.0E}'"), 0.03125); - check(STR("answer is '3.1E-02'"), STR("answer is '{:.1E}'"), 0.03125); - check(STR("answer is '3.125E-02'"), STR("answer is '{:.3E}'"), 0.03125); - check(STR("answer is '3.1250000000E-02'"), STR("answer is '{:.10E}'"), 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 @@ -1667,118 +1662,118 @@ void format_test_floating_point_fixed_lower_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.250000'"), STR("answer is '{:11f}'"), F(0.25)); - check(STR("answer is ' 0.250000'"), STR("answer is '{:>11f}'"), F(0.25)); - check(STR("answer is '0.250000 '"), STR("answer is '{:<11f}'"), F(0.25)); - check(STR("answer is ' 0.250000 '"), STR("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(SV("answer is ' 0.250000 '"), SV("answer is '{:^11f}'"), F(0.25)); - check(STR("answer is '---0.125000'"), STR("answer is '{:->11f}'"), F(125e-3)); - check(STR("answer is '0.125000---'"), STR("answer is '{:-<11f}'"), F(125e-3)); - check(STR("answer is '-0.125000--'"), STR("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(SV("answer is '-0.125000--'"), SV("answer is '{:-^11f}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6f}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6f}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(SV("answer is '*inf**'"), SV("answer is '{:*^6f}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-inf'"), STR("answer is '{:#>7f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6f}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6f}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(SV("answer is '^nan^^'"), SV("answer is '{:^^6f}'"), nan_pos); - check(STR("answer is '000-nan'"), STR("answer is '{:0>7f}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7f}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7f}'"), 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(STR("answer is ' 0.250000'"), STR("answer is '{:>011f}'"), F(0.25)); - check(STR("answer is '0.250000 '"), STR("answer is '{:<011f}'"), F(0.25)); - check(STR("answer is ' 0.250000 '"), STR("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)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^011f}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000'"), STR("answer is '{:f}'"), F(0)); - check(STR("answer is '0.000000'"), STR("answer is '{:-f}'"), F(0)); - check(STR("answer is '+0.000000'"), STR("answer is '{:+f}'"), F(0)); - check(STR("answer is ' 0.000000'"), STR("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(SV("answer is ' 0.000000'"), SV("answer is '{: f}'"), F(0)); - check(STR("answer is '-0.000000'"), STR("answer is '{:f}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("answer is '{:-f}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("answer is '{:+f}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:f}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-f}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+f}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: f}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+f}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: f}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:f}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-f}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+f}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: f}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:f}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-f}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+f}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: f}'"), 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(STR("answer is '0'"), STR("answer is '{:.0f}'"), F(0)); - check(STR("answer is '0.'"), STR("answer is '{:#.0f}'"), 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(STR("answer is '0.000000'"), STR("answer is '{:#f}'"), F(0)); - check(STR("answer is '2.500000'"), STR("answer is '{:#f}'"), 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(STR("answer is 'inf'"), STR("answer is '{:#f}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#f}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#f}'"), 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(STR("answer is '0.031250'"), STR("answer is '{:07f}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+07f}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+08f}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+09f}'"), 0.03125); - - check(STR("answer is '000.031250'"), STR("answer is '{:010f}'"), 0.03125); - check(STR("answer is '000.031250'"), STR("answer is '{:-010f}'"), 0.03125); - check(STR("answer is '+00.031250'"), STR("answer is '{:+010f}'"), 0.03125); - check(STR("answer is ' 00.031250'"), STR("answer is '{: 010f}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010f}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010f}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010f}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010f}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010f}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010f}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010f}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010f}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010f}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010f}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010f}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010f}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010f}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010f}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010f}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010f}'"), 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(STR("answer is '0'"), STR("answer is '{:.0f}'"), 0.03125); - check(STR("answer is '0.0'"), STR("answer is '{:.1f}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.5f}'"), 0.03125); - check(STR("answer is '0.0312500000'"), STR("answer is '{:.10f}'"), 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 @@ -1790,118 +1785,118 @@ void format_test_floating_point_fixed_upper_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.250000'"), STR("answer is '{:11F}'"), F(0.25)); - check(STR("answer is ' 0.250000'"), STR("answer is '{:>11F}'"), F(0.25)); - check(STR("answer is '0.250000 '"), STR("answer is '{:<11F}'"), F(0.25)); - check(STR("answer is ' 0.250000 '"), STR("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(SV("answer is ' 0.250000 '"), SV("answer is '{:^11F}'"), F(0.25)); - check(STR("answer is '---0.125000'"), STR("answer is '{:->11F}'"), F(125e-3)); - check(STR("answer is '0.125000---'"), STR("answer is '{:-<11F}'"), F(125e-3)); - check(STR("answer is '-0.125000--'"), STR("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(SV("answer is '-0.125000--'"), SV("answer is '{:-^11F}'"), F(125e-3)); - check(STR("answer is '***INF'"), STR("answer is '{:*>6F}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF***'"), STR("answer is '{:*<6F}'"), std::numeric_limits::infinity()); - check(STR("answer is '*INF**'"), STR("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(SV("answer is '*INF**'"), SV("answer is '{:*^6F}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-INF'"), STR("answer is '{:#>7F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF###'"), STR("answer is '{:#<7F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-INF##'"), STR("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(SV("answer is '#-INF##'"), SV("answer is '{:#^7F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^NAN'"), STR("answer is '{:^>6F}'"), nan_pos); - check(STR("answer is 'NAN^^^'"), STR("answer is '{:^<6F}'"), nan_pos); - check(STR("answer is '^NAN^^'"), STR("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(SV("answer is '^NAN^^'"), SV("answer is '{:^^6F}'"), nan_pos); - check(STR("answer is '000-NAN'"), STR("answer is '{:0>7F}'"), nan_neg); - check(STR("answer is '-NAN000'"), STR("answer is '{:0<7F}'"), nan_neg); - check(STR("answer is '0-NAN00'"), STR("answer is '{:0^7F}'"), 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(STR("answer is ' 0.250000'"), STR("answer is '{:>011F}'"), F(0.25)); - check(STR("answer is '0.250000 '"), STR("answer is '{:<011F}'"), F(0.25)); - check(STR("answer is ' 0.250000 '"), STR("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)); + check(SV("answer is ' 0.250000 '"), SV("answer is '{:^011F}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0.000000'"), STR("answer is '{:F}'"), F(0)); - check(STR("answer is '0.000000'"), STR("answer is '{:-F}'"), F(0)); - check(STR("answer is '+0.000000'"), STR("answer is '{:+F}'"), F(0)); - check(STR("answer is ' 0.000000'"), STR("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(SV("answer is ' 0.000000'"), SV("answer is '{: F}'"), F(0)); - check(STR("answer is '-0.000000'"), STR("answer is '{:F}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("answer is '{:-F}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("answer is '{:+F}'"), F(-0.)); - check(STR("answer is '-0.000000'"), STR("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(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(STR("answer is 'INF'"), STR("answer is '{:F}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF'"), STR("answer is '{:-F}'"), std::numeric_limits::infinity()); - check(STR("answer is '+INF'"), STR("answer is '{:+F}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: F}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-INF'"), STR("answer is '{:F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:-F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:+F}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{: F}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'NAN'"), STR("answer is '{:F}'"), nan_pos); - check(STR("answer is 'NAN'"), STR("answer is '{:-F}'"), nan_pos); - check(STR("answer is '+NAN'"), STR("answer is '{:+F}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: F}'"), nan_pos); - - check(STR("answer is '-NAN'"), STR("answer is '{:F}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:-F}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:+F}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{: F}'"), 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(STR("answer is '0'"), STR("answer is '{:.0F}'"), F(0)); - check(STR("answer is '0.'"), STR("answer is '{:#.0F}'"), 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(STR("answer is '0.000000'"), STR("answer is '{:#F}'"), F(0)); - check(STR("answer is '2.500000'"), STR("answer is '{:#F}'"), 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(STR("answer is 'INF'"), STR("answer is '{:#F}'"), std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("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(STR("answer is 'NAN'"), STR("answer is '{:#F}'"), nan_pos); - check(STR("answer is '-NAN'"), STR("answer is '{:#F}'"), 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(STR("answer is '0.031250'"), STR("answer is '{:07F}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+07F}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+08F}'"), 0.03125); - check(STR("answer is '+0.031250'"), STR("answer is '{:+09F}'"), 0.03125); - - check(STR("answer is '000.031250'"), STR("answer is '{:010F}'"), 0.03125); - check(STR("answer is '000.031250'"), STR("answer is '{:-010F}'"), 0.03125); - check(STR("answer is '+00.031250'"), STR("answer is '{:+010F}'"), 0.03125); - check(STR("answer is ' 00.031250'"), STR("answer is '{: 010F}'"), 0.03125); - - check(STR("answer is ' INF'"), STR("answer is '{:010F}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{:-010F}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +INF'"), STR("answer is '{:+010F}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: 010F}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -INF'"), STR("answer is '{:010F}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:-010F}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:+010F}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{: 010F}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' NAN'"), STR("answer is '{:010F}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{:-010F}'"), nan_pos); - check(STR("answer is ' +NAN'"), STR("answer is '{:+010F}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: 010F}'"), nan_pos); - - check(STR("answer is ' -NAN'"), STR("answer is '{:010F}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:-010F}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:+010F}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{: 010F}'"), 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(STR("answer is '0'"), STR("answer is '{:.0F}'"), 0.03125); - check(STR("answer is '0.0'"), STR("answer is '{:.1F}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.5F}'"), 0.03125); - check(STR("answer is '0.0312500000'"), STR("answer is '{:.10F}'"), 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 @@ -1913,121 +1908,121 @@ void format_test_floating_point_general_lower_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.25'"), STR("answer is '{:7g}'"), F(0.25)); - check(STR("answer is ' 0.25'"), STR("answer is '{:>7g}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<7g}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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(SV("answer is ' 0.25 '"), SV("answer is '{:^7g}'"), F(0.25)); - check(STR("answer is '---0.125'"), STR("answer is '{:->8g}'"), F(125e-3)); - check(STR("answer is '0.125---'"), STR("answer is '{:-<8g}'"), F(125e-3)); - check(STR("answer is '-0.125--'"), STR("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(SV("answer is '-0.125--'"), SV("answer is '{:-^8g}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6g}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6g}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(SV("answer is '*inf**'"), SV("answer is '{:*^6g}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-inf'"), STR("answer is '{:#>7g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6g}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6g}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(SV("answer is '^nan^^'"), SV("answer is '{:^^6g}'"), nan_pos); - check(STR("answer is '000-nan'"), STR("answer is '{:0>7g}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7g}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7g}'"), 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(STR("answer is ' 0.25'"), STR("answer is '{:>07g}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<07g}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07g}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0'"), STR("answer is '{:g}'"), F(0)); - check(STR("answer is '0'"), STR("answer is '{:-g}'"), F(0)); - check(STR("answer is '+0'"), STR("answer is '{:+g}'"), F(0)); - check(STR("answer is ' 0'"), STR("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(SV("answer is ' 0'"), SV("answer is '{: g}'"), F(0)); - check(STR("answer is '-0'"), STR("answer is '{:g}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:-g}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:+g}'"), F(-0.)); - check(STR("answer is '-0'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:g}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-g}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+g}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: g}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+g}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: g}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:g}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-g}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+g}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: g}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:g}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-g}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+g}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: g}'"), 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(STR("answer is '0'"), STR("answer is '{:.0g}'"), F(0)); - check(STR("answer is '0.'"), STR("answer is '{:#.0g}'"), 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(STR("answer is '0.'"), STR("answer is '{:#g}'"), F(0)); - check(STR("answer is '2.5'"), STR("answer is '{:#g}'"), F(2.5)); + check(SV("answer is '0.'"), SV("answer is '{:#g}'"), F(0)); + check(SV("answer is '2.5'"), SV("answer is '{:#g}'"), F(2.5)); - check(STR("answer is 'inf'"), STR("answer is '{:#g}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#g}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#g}'"), 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(STR("answer is '0.03125'"), STR("answer is '{:06g}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+06g}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+07g}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+08g}'"), 0.03125); - - check(STR("answer is '000.03125'"), STR("answer is '{:09g}'"), 0.03125); - check(STR("answer is '000.03125'"), STR("answer is '{:-09g}'"), 0.03125); - check(STR("answer is '+00.03125'"), STR("answer is '{:+09g}'"), 0.03125); - check(STR("answer is ' 00.03125'"), STR("answer is '{: 09g}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010g}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010g}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010g}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010g}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010g}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010g}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010g}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010g}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010g}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010g}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010g}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010g}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010g}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010g}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010g}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010g}'"), 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(STR("answer is '0.03'"), STR("answer is '{:.0g}'"), 0.03125); - check(STR("answer is '0.03'"), STR("answer is '{:.1g}'"), 0.03125); - check(STR("answer is '0.031'"), STR("answer is '{:.2g}'"), 0.03125); - check(STR("answer is '0.0312'"), STR("answer is '{:.3g}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.4g}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.5g}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.10g}'"), 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); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2039,121 +2034,121 @@ void format_test_floating_point_general_upper_case(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.25'"), STR("answer is '{:7G}'"), F(0.25)); - check(STR("answer is ' 0.25'"), STR("answer is '{:>7G}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<7G}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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(SV("answer is ' 0.25 '"), SV("answer is '{:^7G}'"), F(0.25)); - check(STR("answer is '---0.125'"), STR("answer is '{:->8G}'"), F(125e-3)); - check(STR("answer is '0.125---'"), STR("answer is '{:-<8G}'"), F(125e-3)); - check(STR("answer is '-0.125--'"), STR("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(SV("answer is '-0.125--'"), SV("answer is '{:-^8G}'"), F(125e-3)); - check(STR("answer is '***INF'"), STR("answer is '{:*>6G}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF***'"), STR("answer is '{:*<6G}'"), std::numeric_limits::infinity()); - check(STR("answer is '*INF**'"), STR("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(SV("answer is '*INF**'"), SV("answer is '{:*^6G}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-INF'"), STR("answer is '{:#>7G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF###'"), STR("answer is '{:#<7G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-INF##'"), STR("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(SV("answer is '#-INF##'"), SV("answer is '{:#^7G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^NAN'"), STR("answer is '{:^>6G}'"), nan_pos); - check(STR("answer is 'NAN^^^'"), STR("answer is '{:^<6G}'"), nan_pos); - check(STR("answer is '^NAN^^'"), STR("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(SV("answer is '^NAN^^'"), SV("answer is '{:^^6G}'"), nan_pos); - check(STR("answer is '000-NAN'"), STR("answer is '{:0>7G}'"), nan_neg); - check(STR("answer is '-NAN000'"), STR("answer is '{:0<7G}'"), nan_neg); - check(STR("answer is '0-NAN00'"), STR("answer is '{:0^7G}'"), 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(STR("answer is ' 0.25'"), STR("answer is '{:>07G}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<07G}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07G}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0'"), STR("answer is '{:G}'"), F(0)); - check(STR("answer is '0'"), STR("answer is '{:-G}'"), F(0)); - check(STR("answer is '+0'"), STR("answer is '{:+G}'"), F(0)); - check(STR("answer is ' 0'"), STR("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(SV("answer is ' 0'"), SV("answer is '{: G}'"), F(0)); - check(STR("answer is '-0'"), STR("answer is '{:G}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:-G}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:+G}'"), F(-0.)); - check(STR("answer is '-0'"), STR("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(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(STR("answer is 'INF'"), STR("answer is '{:G}'"), std::numeric_limits::infinity()); - check(STR("answer is 'INF'"), STR("answer is '{:-G}'"), std::numeric_limits::infinity()); - check(STR("answer is '+INF'"), STR("answer is '{:+G}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: G}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-INF'"), STR("answer is '{:G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:-G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{:+G}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("answer is '{: G}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'NAN'"), STR("answer is '{:G}'"), nan_pos); - check(STR("answer is 'NAN'"), STR("answer is '{:-G}'"), nan_pos); - check(STR("answer is '+NAN'"), STR("answer is '{:+G}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: G}'"), nan_pos); - - check(STR("answer is '-NAN'"), STR("answer is '{:G}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:-G}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{:+G}'"), nan_neg); - check(STR("answer is '-NAN'"), STR("answer is '{: G}'"), 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(STR("answer is '0'"), STR("answer is '{:.0G}'"), F(0)); - check(STR("answer is '0.'"), STR("answer is '{:#.0G}'"), 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(STR("answer is '0.'"), STR("answer is '{:#G}'"), F(0)); - check(STR("answer is '2.5'"), STR("answer is '{:#G}'"), F(2.5)); + check(SV("answer is '0.'"), SV("answer is '{:#G}'"), F(0)); + check(SV("answer is '2.5'"), SV("answer is '{:#G}'"), F(2.5)); - check(STR("answer is 'INF'"), STR("answer is '{:#G}'"), std::numeric_limits::infinity()); - check(STR("answer is '-INF'"), STR("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(STR("answer is 'NAN'"), STR("answer is '{:#G}'"), nan_pos); - check(STR("answer is '-NAN'"), STR("answer is '{:#G}'"), 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(STR("answer is '0.03125'"), STR("answer is '{:06G}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+06G}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+07G}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+08G}'"), 0.03125); - - check(STR("answer is '000.03125'"), STR("answer is '{:09G}'"), 0.03125); - check(STR("answer is '000.03125'"), STR("answer is '{:-09G}'"), 0.03125); - check(STR("answer is '+00.03125'"), STR("answer is '{:+09G}'"), 0.03125); - check(STR("answer is ' 00.03125'"), STR("answer is '{: 09G}'"), 0.03125); - - check(STR("answer is ' INF'"), STR("answer is '{:010G}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{:-010G}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +INF'"), STR("answer is '{:+010G}'"), std::numeric_limits::infinity()); - check(STR("answer is ' INF'"), STR("answer is '{: 010G}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -INF'"), STR("answer is '{:010G}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:-010G}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{:+010G}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -INF'"), STR("answer is '{: 010G}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' NAN'"), STR("answer is '{:010G}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{:-010G}'"), nan_pos); - check(STR("answer is ' +NAN'"), STR("answer is '{:+010G}'"), nan_pos); - check(STR("answer is ' NAN'"), STR("answer is '{: 010G}'"), nan_pos); - - check(STR("answer is ' -NAN'"), STR("answer is '{:010G}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:-010G}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{:+010G}'"), nan_neg); - check(STR("answer is ' -NAN'"), STR("answer is '{: 010G}'"), 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(STR("answer is '0.03'"), STR("answer is '{:.0G}'"), 0.03125); - check(STR("answer is '0.03'"), STR("answer is '{:.1G}'"), 0.03125); - check(STR("answer is '0.031'"), STR("answer is '{:.2G}'"), 0.03125); - check(STR("answer is '0.0312'"), STR("answer is '{:.3G}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.4G}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.5G}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.10G}'"), 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); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2165,108 +2160,108 @@ void format_test_floating_point_default(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.25'"), STR("answer is '{:7}'"), F(0.25)); - check(STR("answer is ' 0.25'"), STR("answer is '{:>7}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<7}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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(SV("answer is ' 0.25 '"), SV("answer is '{:^7}'"), F(0.25)); - check(STR("answer is '---0.125'"), STR("answer is '{:->8}'"), F(125e-3)); - check(STR("answer is '0.125---'"), STR("answer is '{:-<8}'"), F(125e-3)); - check(STR("answer is '-0.125--'"), STR("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(SV("answer is '-0.125--'"), SV("answer is '{:-^8}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(STR("answer is '###-inf'"), STR("answer is '{:#>7}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(STR("answer is '000-nan'"), STR("answer is '{:0>7}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7}'"), 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(STR("answer is ' 0.25'"), STR("answer is '{:>07}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<07}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0'"), STR("answer is '{:}'"), F(0)); - check(STR("answer is '0'"), STR("answer is '{:-}'"), F(0)); - check(STR("answer is '+0'"), STR("answer is '{:+}'"), F(0)); - check(STR("answer is ' 0'"), STR("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(SV("answer is ' 0'"), SV("answer is '{: }'"), F(0)); - check(STR("answer is '-0'"), STR("answer is '{:}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:-}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:+}'"), F(-0.)); - check(STR("answer is '-0'"), STR("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(SV("answer is '-0'"), SV("answer is '{: }'"), F(-0.)); // [format.string.std]/5 The sign option applies to floating-point infinity and NaN. - check(STR("answer is 'inf'"), STR("answer is '{:}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: }'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: }'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: }'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: }'"), 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(STR("answer is '0.'"), STR("answer is '{:#}'"), F(0)); - check(STR("answer is '2.5'"), STR("answer is '{:#}'"), 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(STR("answer is 'inf'"), STR("answer is '{:#}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#}'"), 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(STR("answer is '0.03125'"), STR("answer is '{:07}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+07}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+08}'"), 0.03125); - check(STR("answer is '+00.03125'"), STR("answer is '{:+09}'"), 0.03125); - - check(STR("answer is '0000.03125'"), STR("answer is '{:010}'"), 0.03125); - check(STR("answer is '0000.03125'"), STR("answer is '{:-010}'"), 0.03125); - check(STR("answer is '+000.03125'"), STR("answer is '{:+010}'"), 0.03125); - check(STR("answer is ' 000.03125'"), STR("answer is '{: 010}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010}'"), 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 @@ -2282,121 +2277,121 @@ void format_test_floating_point_default_precision(TestFunction check) { auto nan_neg = std::copysign(nan_pos, -1.0); // "-nan" // *** align-fill & width *** - check(STR("answer is ' 0.25'"), STR("answer is '{:7.6}'"), F(0.25)); - check(STR("answer is ' 0.25'"), STR("answer is '{:>7.6}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<7.6}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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(SV("answer is ' 0.25 '"), SV("answer is '{:^7.6}'"), F(0.25)); - check(STR("answer is '---0.125'"), STR("answer is '{:->8.6}'"), F(125e-3)); - check(STR("answer is '0.125---'"), STR("answer is '{:-<8.6}'"), F(125e-3)); - check(STR("answer is '-0.125--'"), STR("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(SV("answer is '-0.125--'"), SV("answer is '{:-^8.6}'"), F(125e-3)); - check(STR("answer is '***inf'"), STR("answer is '{:*>6.6}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf***'"), STR("answer is '{:*<6.6}'"), std::numeric_limits::infinity()); - check(STR("answer is '*inf**'"), STR("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(SV("answer is '*inf**'"), SV("answer is '{:*^6.6}'"), std::numeric_limits::infinity()); - check(STR("answer is '###-inf'"), STR("answer is '{:#>7.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf###'"), STR("answer is '{:#<7.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '#-inf##'"), STR("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(SV("answer is '#-inf##'"), SV("answer is '{:#^7.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '^^^nan'"), STR("answer is '{:^>6.6}'"), nan_pos); - check(STR("answer is 'nan^^^'"), STR("answer is '{:^<6.6}'"), nan_pos); - check(STR("answer is '^nan^^'"), STR("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(SV("answer is '^nan^^'"), SV("answer is '{:^^6.6}'"), nan_pos); - check(STR("answer is '000-nan'"), STR("answer is '{:0>7.6}'"), nan_neg); - check(STR("answer is '-nan000'"), STR("answer is '{:0<7.6}'"), nan_neg); - check(STR("answer is '0-nan00'"), STR("answer is '{:0^7.6}'"), 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(STR("answer is ' 0.25'"), STR("answer is '{:>07.6}'"), F(0.25)); - check(STR("answer is '0.25 '"), STR("answer is '{:<07.6}'"), F(0.25)); - check(STR("answer is ' 0.25 '"), STR("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)); + check(SV("answer is ' 0.25 '"), SV("answer is '{:^07.6}'"), F(0.25)); // *** Sign *** - check(STR("answer is '0'"), STR("answer is '{:.6}'"), F(0)); - check(STR("answer is '0'"), STR("answer is '{:-.6}'"), F(0)); - check(STR("answer is '+0'"), STR("answer is '{:+.6}'"), F(0)); - check(STR("answer is ' 0'"), STR("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(SV("answer is ' 0'"), SV("answer is '{: .6}'"), F(0)); - check(STR("answer is '-0'"), STR("answer is '{:.6}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:-.6}'"), F(-0.)); - check(STR("answer is '-0'"), STR("answer is '{:+.6}'"), F(-0.)); - check(STR("answer is '-0'"), STR("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(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(STR("answer is 'inf'"), STR("answer is '{:.6}'"), std::numeric_limits::infinity()); - check(STR("answer is 'inf'"), STR("answer is '{:-.6}'"), std::numeric_limits::infinity()); - check(STR("answer is '+inf'"), STR("answer is '{:+.6}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: .6}'"), std::numeric_limits::infinity()); - - check(STR("answer is '-inf'"), STR("answer is '{:.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:-.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{:+.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("answer is '{: .6}'"), -std::numeric_limits::infinity()); - - check(STR("answer is 'nan'"), STR("answer is '{:.6}'"), nan_pos); - check(STR("answer is 'nan'"), STR("answer is '{:-.6}'"), nan_pos); - check(STR("answer is '+nan'"), STR("answer is '{:+.6}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: .6}'"), nan_pos); - - check(STR("answer is '-nan'"), STR("answer is '{:.6}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:-.6}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{:+.6}'"), nan_neg); - check(STR("answer is '-nan'"), STR("answer is '{: .6}'"), 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(STR("answer is '0'"), STR("answer is '{:.0}'"), F(0)); - check(STR("answer is '0.'"), STR("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(STR("answer is '0.'"), STR("answer is '{:#.6}'"), F(0)); - check(STR("answer is '2.5'"), STR("answer is '{:#.6}'"), 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(STR("answer is 'inf'"), STR("answer is '{:#.6}'"), std::numeric_limits::infinity()); - check(STR("answer is '-inf'"), STR("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(STR("answer is 'nan'"), STR("answer is '{:#.6}'"), nan_pos); - check(STR("answer is '-nan'"), STR("answer is '{:#.6}'"), 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(STR("answer is '0.03125'"), STR("answer is '{:06.6}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+06.6}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+07.6}'"), 0.03125); - check(STR("answer is '+0.03125'"), STR("answer is '{:+08.6}'"), 0.03125); - - check(STR("answer is '000.03125'"), STR("answer is '{:09.6}'"), 0.03125); - check(STR("answer is '000.03125'"), STR("answer is '{:-09.6}'"), 0.03125); - check(STR("answer is '+00.03125'"), STR("answer is '{:+09.6}'"), 0.03125); - check(STR("answer is ' 00.03125'"), STR("answer is '{: 09.6}'"), 0.03125); - - check(STR("answer is ' inf'"), STR("answer is '{:010.6}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{:-010.6}'"), std::numeric_limits::infinity()); - check(STR("answer is ' +inf'"), STR("answer is '{:+010.6}'"), std::numeric_limits::infinity()); - check(STR("answer is ' inf'"), STR("answer is '{: 010.6}'"), std::numeric_limits::infinity()); - - check(STR("answer is ' -inf'"), STR("answer is '{:010.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:-010.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{:+010.6}'"), -std::numeric_limits::infinity()); - check(STR("answer is ' -inf'"), STR("answer is '{: 010.6}'"), -std::numeric_limits::infinity()); - - check(STR("answer is ' nan'"), STR("answer is '{:010.6}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{:-010.6}'"), nan_pos); - check(STR("answer is ' +nan'"), STR("answer is '{:+010.6}'"), nan_pos); - check(STR("answer is ' nan'"), STR("answer is '{: 010.6}'"), nan_pos); - - check(STR("answer is ' -nan'"), STR("answer is '{:010.6}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:-010.6}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{:+010.6}'"), nan_neg); - check(STR("answer is ' -nan'"), STR("answer is '{: 010.6}'"), 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(STR("answer is '0.03'"), STR("answer is '{:.0}'"), 0.03125); - check(STR("answer is '0.03'"), STR("answer is '{:.1}'"), 0.03125); - check(STR("answer is '0.031'"), STR("answer is '{:.2}'"), 0.03125); - check(STR("answer is '0.0312'"), STR("answer is '{:.3}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.4}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.5}'"), 0.03125); - check(STR("answer is '0.03125'"), STR("answer is '{:.10}'"), 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); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -2436,31 +2431,31 @@ void format_test_floating_point(TestFunction check, ExceptionTest check_exceptio template void format_test_pointer(TestFunction check, ExceptionTest check_exception) { // *** align-fill & width *** - check(STR("answer is ' 0x0'"), STR("answer is '{:6}'"), P(nullptr)); - check(STR("answer is ' 0x0'"), STR("answer is '{:>6}'"), P(nullptr)); - check(STR("answer is '0x0 '"), STR("answer is '{:<6}'"), P(nullptr)); - check(STR("answer is ' 0x0 '"), STR("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(SV("answer is ' 0x0 '"), SV("answer is '{:^6}'"), P(nullptr)); - check(STR("answer is '---0x0'"), STR("answer is '{:->6}'"), P(nullptr)); - check(STR("answer is '0x0---'"), STR("answer is '{:-<6}'"), P(nullptr)); - check(STR("answer is '-0x0--'"), STR("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)); // *** Sign *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:-}"), P(nullptr)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{:+}"), P(nullptr)); - check_exception("The format-spec should consume the input or end with a '}'", STR("{: }"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), P(nullptr)); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:#}"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), P(nullptr)); // *** zero-padding *** - check_exception("A format-spec width field shouldn't have a leading zero", STR("{:0}"), P(nullptr)); + check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), P(nullptr)); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:.}"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), P(nullptr)); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", STR("{:L}"), P(nullptr)); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), P(nullptr)); // *** type *** for (const auto& fmt : invalid_types("p")) @@ -2470,20 +2465,20 @@ void format_test_pointer(TestFunction check, ExceptionTest check_exception) { template void format_test_handle(TestFunction check, ExceptionTest check_exception) { // *** Valid permuatations *** - check(STR("answer is '0xaaaa'"), STR("answer is '{}'"), status::foo); - check(STR("answer is '0xaaaa'"), STR("answer is '{:x}'"), status::foo); - check(STR("answer is '0XAAAA'"), STR("answer is '{:X}'"), status::foo); - check(STR("answer is 'foo'"), STR("answer is '{:s}'"), 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(STR("answer is '0x5555'"), STR("answer is '{}'"), status::bar); - check(STR("answer is '0x5555'"), STR("answer is '{:x}'"), status::bar); - check(STR("answer is '0X5555'"), STR("answer is '{:X}'"), status::bar); - check(STR("answer is 'bar'"), STR("answer is '{:s}'"), 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(STR("answer is '0xaa55'"), STR("answer is '{}'"), status::foobar); - check(STR("answer is '0xaa55'"), STR("answer is '{:x}'"), status::foobar); - check(STR("answer is '0XAA55'"), STR("answer is '{:X}'"), status::foobar); - check(STR("answer is 'foobar'"), STR("answer is '{:s}'"), 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); // *** type *** for (const auto& fmt : invalid_types("xXs")) @@ -2500,30 +2495,30 @@ void format_test_pointer(TestFunction check, ExceptionTest check_exception) { template void format_tests(TestFunction check, ExceptionTest check_exception) { // *** Test escaping *** - check(STR("{"), STR("{{")); - check(STR("}"), STR("}}")); + check(SV("{"), SV("{{")); + check(SV("}"), SV("}}")); // *** Test argument ID *** - check(STR("hello false true"), STR("hello {0:} {1:}"), false, true); - check(STR("hello true false"), STR("hello {1:} {0:}"), 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 invalid format strings *** - check_exception("The format string terminates at a '{'", STR("{")); - check_exception("The replacement field misses a terminating '}'", STR("{:"), 42); + check_exception("The format string terminates at a '{'", SV("{")); + check_exception("The replacement field misses a terminating '}'", SV("{:"), 42); - check_exception("The format string contains an invalid escape sequence", STR("}")); - check_exception("The format string contains an invalid escape sequence", STR("{:}-}"), 42); + check_exception("The format string contains an invalid escape sequence", SV("}")); + check_exception("The format string contains an invalid escape sequence", SV("{:}-}"), 42); - check_exception("The format string contains an invalid escape sequence", STR("} ")); + check_exception("The format string contains an invalid escape sequence", SV("} ")); - check_exception("The arg-id of the format-spec starts with an invalid character", STR("{-"), 42); - check_exception("Argument index out of bounds", STR("hello {}")); - check_exception("Argument index out of bounds", STR("hello {0}")); - check_exception("Argument index out of bounds", STR("hello {1}"), 42); + check_exception("The arg-id of the format-spec starts with an invalid character", SV("{-"), 42); + check_exception("Argument index out of bounds", SV("hello {}")); + check_exception("Argument index out of bounds", SV("hello {0}")); + check_exception("Argument index out of bounds", SV("hello {1}"), 42); // *** Test char format argument *** // The `char` to `wchar_t` formatting is tested separately. - check(STR("hello 09azAZ!"), STR("hello {}{}{}{}{}{}{}"), CharT('0'), CharT('9'), CharT('a'), CharT('z'), CharT('A'), + 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); @@ -2533,83 +2528,84 @@ void format_tests(TestFunction check, ExceptionTest check_exception) { { CharT buffer[] = {CharT('0'), CharT('9'), CharT('a'), CharT('z'), CharT('A'), CharT('Z'), CharT('!'), 0}; CharT* data = buffer; - check(STR("hello 09azAZ!"), STR("hello {}"), 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(STR("hello 09azAZ!"), STR("hello {}"), data); + check(SV("hello 09azAZ!"), SV("hello {}"), data); } { std::basic_string data = STR("world"); - check(STR("hello world"), STR("hello {}"), data); + check(SV("hello world"), SV("hello {}"), data); } { std::basic_string buffer = STR("world"); std::basic_string_view data = buffer; - check(STR("hello world"), STR("hello {}"), data); + check(SV("hello world"), SV("hello {}"), data); } format_string_tests(check, check_exception); // *** Test Boolean format argument *** - check(STR("hello false true"), STR("hello {} {}"), false, true); + check(SV("hello false true"), SV("hello {} {}"), false, true); format_test_bool(check, check_exception); format_test_bool_as_char(check, check_exception); format_test_bool_as_integer(check, check_exception); // *** Test signed integral format argument *** - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("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)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); #ifndef TEST_HAS_NO_INT128 - check(STR("hello 42"), STR("hello {}"), static_cast<__int128_t>(42)); + check(SV("hello 42"), SV("hello {}"), static_cast<__int128_t>(42)); { // Note 128-bit support is only partly implemented test the range // conditions here. std::basic_string min = std::format(STR("{}"), std::numeric_limits::min()); - check(min, STR("{}"), static_cast<__int128_t>(std::numeric_limits::min())); + check(std::basic_string_view(min), SV("{}"), static_cast<__int128_t>(std::numeric_limits::min())); std::basic_string max = std::format(STR("{}"), std::numeric_limits::max()); - check(max, STR("{}"), static_cast<__int128_t>(std::numeric_limits::max())); - check_exception("128-bit value is outside of implemented range", STR("{}"), + check(std::basic_string_view(max), SV("{}"), static_cast<__int128_t>(std::numeric_limits::max())); + check_exception("128-bit value is outside of implemented range", SV("{}"), static_cast<__int128_t>(std::numeric_limits::min()) - 1); - check_exception("128-bit value is outside of implemented range", STR("{}"), + check_exception("128-bit value is outside of implemented range", SV("{}"), static_cast<__int128_t>(std::numeric_limits::max()) + 1); } #endif format_test_signed_integer(check, check_exception); // ** Test unsigned integral format argument *** - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("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)); + check(SV("hello 42"), SV("hello {}"), static_cast(42)); #ifndef TEST_HAS_NO_INT128 - check(STR("hello 42"), STR("hello {}"), static_cast<__uint128_t>(42)); + check(SV("hello 42"), SV("hello {}"), static_cast<__uint128_t>(42)); { // Note 128-bit support is only partly implemented test the range // conditions here. std::basic_string max = std::format(STR("{}"), std::numeric_limits::max()); - check(max, STR("{}"), static_cast<__uint128_t>(std::numeric_limits::max())); - check_exception("128-bit value is outside of implemented range", STR("{}"), + check(std::basic_string_view(max), SV("{}"), + static_cast<__uint128_t>(std::numeric_limits::max())); + check_exception("128-bit value is outside of implemented range", SV("{}"), static_cast<__uint128_t>(std::numeric_limits::max()) + 1); } #endif format_test_unsigned_integer(check, check_exception); // *** Test floating point format argument *** - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("hello {}"), static_cast(42)); - check(STR("hello 42"), STR("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)); format_test_floating_point(check, check_exception); // *** Test pointer formater argument *** - check(STR("hello 0x0"), STR("hello {}"), nullptr); - check(STR("hello 0x42"), STR("hello {}"), reinterpret_cast(0x42)); - check(STR("hello 0x42"), STR("hello {}"), 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 *** @@ -2620,7 +2616,7 @@ void format_tests(TestFunction check, ExceptionTest check_exception) { template void format_tests_char_to_wchar_t(TestFunction check) { using CharT = wchar_t; - check(STR("hello 09azA"), STR("hello {}{}{}{}{}"), '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 index b403105..7f162d9 100644 --- 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 @@ -30,7 +30,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); @@ -58,14 +58,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; std::format_to(std::back_inserter(out), std::locale(), fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index cf46a00..89e38f5 100644 --- a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp @@ -31,7 +31,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); @@ -59,14 +59,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; std::format_to(std::back_inserter(out), fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index 1dc1745..f233c7d 100644 --- 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 @@ -32,7 +32,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::list out; @@ -92,14 +92,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; std::format_to_n(std::back_inserter(out), 0, std::locale(), fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index a964fc2..2db1664 100644 --- 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 @@ -29,7 +29,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::list out; @@ -89,14 +89,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::basic_string out; std::format_to_n(std::back_inserter(out), 0, fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index 34f1319..6949c6f 100644 --- 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 @@ -28,19 +28,19 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { size_t size = std::formatted_size(std::locale(), fmt, args...); assert(size == expected.size()); }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::formatted_size(std::locale(), fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index 4171573..0b8216f 100644 --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp @@ -25,19 +25,19 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { size_t size = std::formatted_size(fmt, args...); assert(size == expected.size()); }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { std::formatted_size(fmt, args...); assert(false); - } catch (std::format_error& e) { + } catch (const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index 6f21454..1350a00 100644 --- 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 @@ -99,6 +99,7 @@ #include "format_tests.h" #define STR(S) MAKE_STRING(CharT, S) +#define SV(S) MAKE_STRING_VIEW(CharT, S) template struct numpunct; @@ -126,7 +127,7 @@ struct numpunct : std::numpunct { #endif template -void test(std::basic_string expected, std::basic_string fmt, const Args&... args) { +void test(std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { // *** format *** { std::basic_string out = std::format(fmt, args...); @@ -174,7 +175,8 @@ void test(std::basic_string expected, std::basic_string fmt, const } template -void test(std::basic_string expected, std::locale loc, std::basic_string fmt, const Args&... args) { +void test(std::basic_string_view expected, std::locale loc, std::basic_string_view fmt, + const Args&... args) { // *** format *** { std::basic_string out = std::format(loc, fmt, args...); @@ -246,29 +248,29 @@ void test_bool() { std::locale::global(std::locale(LOCALE_en_US_UTF_8)); assert(std::locale().name() == LOCALE_en_US_UTF_8); - test(STR("true"), STR("{:L}"), true); - test(STR("false"), STR("{:L}"), false); + test(SV("true"), SV("{:L}"), true); + test(SV("false"), SV("{:L}"), false); - test(STR("yes"), loc, STR("{:L}"), true); - test(STR("no"), loc, STR("{:L}"), false); + test(SV("yes"), loc, SV("{:L}"), true); + test(SV("no"), loc, SV("{:L}"), false); std::locale::global(loc); - test(STR("yes"), STR("{:L}"), true); - test(STR("no"), STR("{:L}"), false); + test(SV("yes"), SV("{:L}"), true); + test(SV("no"), SV("{:L}"), false); - test(STR("true"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), true); - test(STR("false"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), 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(STR("gültig"), loc_unicode, STR("{:L}"), true); - test(STR("ungültig"), loc_unicode, STR("{:L}"), false); + test(SV("gültig"), loc_unicode, SV("{:L}"), true); + test(SV("ungültig"), loc_unicode, SV("{:L}"), false); - test(STR("gültig "), loc_unicode, STR("{:9L}"), true); - test(STR("gültig!!!"), loc_unicode, STR("{:!<9L}"), true); - test(STR("_gültig__"), loc_unicode, STR("{:_^9L}"), true); - test(STR(" gültig"), loc_unicode, STR("{:>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); + test(SV(" gültig"), loc_unicode, SV("{:>9L}"), true); #endif // TEST_HAS_NO_UNICODE } @@ -279,325 +281,325 @@ void test_integer() { // *** Decimal *** std::locale::global(en_US); - test(STR("0"), STR("{:L}"), 0); - test(STR("1"), STR("{:L}"), 1); - test(STR("10"), STR("{:L}"), 10); - test(STR("100"), STR("{:L}"), 100); - test(STR("1,000"), STR("{:L}"), 1'000); - test(STR("10,000"), STR("{:L}"), 10'000); - test(STR("100,000"), STR("{:L}"), 100'000); - test(STR("1,000,000"), STR("{:L}"), 1'000'000); - test(STR("10,000,000"), STR("{:L}"), 10'000'000); - test(STR("100,000,000"), STR("{:L}"), 100'000'000); - test(STR("1,000,000,000"), STR("{:L}"), 1'000'000'000); - - test(STR("-1"), STR("{:L}"), -1); - test(STR("-10"), STR("{:L}"), -10); - test(STR("-100"), STR("{:L}"), -100); - test(STR("-1,000"), STR("{:L}"), -1'000); - test(STR("-10,000"), STR("{:L}"), -10'000); - test(STR("-100,000"), STR("{:L}"), -100'000); - test(STR("-1,000,000"), STR("{:L}"), -1'000'000); - test(STR("-10,000,000"), STR("{:L}"), -10'000'000); - test(STR("-100,000,000"), STR("{:L}"), -100'000'000); - test(STR("-1,000,000,000"), STR("{:L}"), -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(STR("0"), STR("{:L}"), 0); - test(STR("1"), STR("{:L}"), 1); - test(STR("1_0"), STR("{:L}"), 10); - test(STR("10_0"), STR("{:L}"), 100); - test(STR("1_00_0"), STR("{:L}"), 1'000); - test(STR("10_00_0"), STR("{:L}"), 10'000); - test(STR("100_00_0"), STR("{:L}"), 100'000); - test(STR("1_000_00_0"), STR("{:L}"), 1'000'000); - test(STR("10_000_00_0"), STR("{:L}"), 10'000'000); - test(STR("1_00_000_00_0"), STR("{:L}"), 100'000'000); - test(STR("1_0_00_000_00_0"), STR("{:L}"), 1'000'000'000); - - test(STR("-1"), STR("{:L}"), -1); - test(STR("-1_0"), STR("{:L}"), -10); - test(STR("-10_0"), STR("{:L}"), -100); - test(STR("-1_00_0"), STR("{:L}"), -1'000); - test(STR("-10_00_0"), STR("{:L}"), -10'000); - test(STR("-100_00_0"), STR("{:L}"), -100'000); - test(STR("-1_000_00_0"), STR("{:L}"), -1'000'000); - test(STR("-10_000_00_0"), STR("{:L}"), -10'000'000); - test(STR("-1_00_000_00_0"), STR("{:L}"), -100'000'000); - test(STR("-1_0_00_000_00_0"), STR("{:L}"), -1'000'000'000); - - test(STR("0"), en_US, STR("{:L}"), 0); - test(STR("1"), en_US, STR("{:L}"), 1); - test(STR("10"), en_US, STR("{:L}"), 10); - test(STR("100"), en_US, STR("{:L}"), 100); - test(STR("1,000"), en_US, STR("{:L}"), 1'000); - test(STR("10,000"), en_US, STR("{:L}"), 10'000); - test(STR("100,000"), en_US, STR("{:L}"), 100'000); - test(STR("1,000,000"), en_US, STR("{:L}"), 1'000'000); - test(STR("10,000,000"), en_US, STR("{:L}"), 10'000'000); - test(STR("100,000,000"), en_US, STR("{:L}"), 100'000'000); - test(STR("1,000,000,000"), en_US, STR("{:L}"), 1'000'000'000); - - test(STR("-1"), en_US, STR("{:L}"), -1); - test(STR("-10"), en_US, STR("{:L}"), -10); - test(STR("-100"), en_US, STR("{:L}"), -100); - test(STR("-1,000"), en_US, STR("{:L}"), -1'000); - test(STR("-10,000"), en_US, STR("{:L}"), -10'000); - test(STR("-100,000"), en_US, STR("{:L}"), -100'000); - test(STR("-1,000,000"), en_US, STR("{:L}"), -1'000'000); - test(STR("-10,000,000"), en_US, STR("{:L}"), -10'000'000); - test(STR("-100,000,000"), en_US, STR("{:L}"), -100'000'000); - test(STR("-1,000,000,000"), en_US, STR("{:L}"), -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(STR("0"), loc, STR("{:L}"), 0); - test(STR("1"), loc, STR("{:L}"), 1); - test(STR("1_0"), loc, STR("{:L}"), 10); - test(STR("10_0"), loc, STR("{:L}"), 100); - test(STR("1_00_0"), loc, STR("{:L}"), 1'000); - test(STR("10_00_0"), loc, STR("{:L}"), 10'000); - test(STR("100_00_0"), loc, STR("{:L}"), 100'000); - test(STR("1_000_00_0"), loc, STR("{:L}"), 1'000'000); - test(STR("10_000_00_0"), loc, STR("{:L}"), 10'000'000); - test(STR("1_00_000_00_0"), loc, STR("{:L}"), 100'000'000); - test(STR("1_0_00_000_00_0"), loc, STR("{:L}"), 1'000'000'000); - - test(STR("-1"), loc, STR("{:L}"), -1); - test(STR("-1_0"), loc, STR("{:L}"), -10); - test(STR("-10_0"), loc, STR("{:L}"), -100); - test(STR("-1_00_0"), loc, STR("{:L}"), -1'000); - test(STR("-10_00_0"), loc, STR("{:L}"), -10'000); - test(STR("-100_00_0"), loc, STR("{:L}"), -100'000); - test(STR("-1_000_00_0"), loc, STR("{:L}"), -1'000'000); - test(STR("-10_000_00_0"), loc, STR("{:L}"), -10'000'000); - test(STR("-1_00_000_00_0"), loc, STR("{:L}"), -100'000'000); - test(STR("-1_0_00_000_00_0"), loc, STR("{:L}"), -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(STR("0"), STR("{:Lb}"), 0b0); - test(STR("1"), STR("{:Lb}"), 0b1); - test(STR("1,000,000,000"), STR("{:Lb}"), 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(STR("0b0"), STR("{:#Lb}"), 0b0); - test(STR("0b1"), STR("{:#Lb}"), 0b1); - test(STR("0b1,000,000,000"), STR("{:#Lb}"), 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(STR("-1"), STR("{:LB}"), -0b1); - test(STR("-1,000,000,000"), STR("{:LB}"), -0b1'000'000'000); + test(SV("-1"), SV("{:LB}"), -0b1); + test(SV("-1,000,000,000"), SV("{:LB}"), -0b1'000'000'000); - test(STR("-0B1"), STR("{:#LB}"), -0b1); - test(STR("-0B1,000,000,000"), STR("{:#LB}"), -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(STR("0"), STR("{:Lb}"), 0b0); - test(STR("1"), STR("{:Lb}"), 0b1); - test(STR("1_0_00_000_00_0"), STR("{:Lb}"), 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(STR("0b0"), STR("{:#Lb}"), 0b0); - test(STR("0b1"), STR("{:#Lb}"), 0b1); - test(STR("0b1_0_00_000_00_0"), STR("{:#Lb}"), 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(STR("-1"), STR("{:LB}"), -0b1); - test(STR("-1_0_00_000_00_0"), STR("{:LB}"), -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(STR("-0B1"), STR("{:#LB}"), -0b1); - test(STR("-0B1_0_00_000_00_0"), STR("{:#LB}"), -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(STR("0"), en_US, STR("{:Lb}"), 0b0); - test(STR("1"), en_US, STR("{:Lb}"), 0b1); - test(STR("1,000,000,000"), en_US, STR("{:Lb}"), 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(STR("0b0"), en_US, STR("{:#Lb}"), 0b0); - test(STR("0b1"), en_US, STR("{:#Lb}"), 0b1); - test(STR("0b1,000,000,000"), en_US, STR("{:#Lb}"), 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(STR("-1"), en_US, STR("{:LB}"), -0b1); - test(STR("-1,000,000,000"), en_US, STR("{:LB}"), -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(STR("-0B1"), en_US, STR("{:#LB}"), -0b1); - test(STR("-0B1,000,000,000"), en_US, STR("{:#LB}"), -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(STR("0"), loc, STR("{:Lb}"), 0b0); - test(STR("1"), loc, STR("{:Lb}"), 0b1); - test(STR("1_0_00_000_00_0"), loc, STR("{:Lb}"), 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(STR("0b0"), loc, STR("{:#Lb}"), 0b0); - test(STR("0b1"), loc, STR("{:#Lb}"), 0b1); - test(STR("0b1_0_00_000_00_0"), loc, STR("{:#Lb}"), 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(STR("-1"), loc, STR("{:LB}"), -0b1); - test(STR("-1_0_00_000_00_0"), loc, STR("{:LB}"), -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(STR("-0B1"), loc, STR("{:#LB}"), -0b1); - test(STR("-0B1_0_00_000_00_0"), loc, STR("{:#LB}"), -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(STR("0"), STR("{:Lo}"), 00); - test(STR("1"), STR("{:Lo}"), 01); - test(STR("1,000,000,000"), STR("{:Lo}"), 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(STR("0"), STR("{:#Lo}"), 00); - test(STR("01"), STR("{:#Lo}"), 01); - test(STR("01,000,000,000"), STR("{:#Lo}"), 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(STR("-1"), STR("{:Lo}"), -01); - test(STR("-1,000,000,000"), STR("{:Lo}"), -01'000'000'000); + test(SV("-1"), SV("{:Lo}"), -01); + test(SV("-1,000,000,000"), SV("{:Lo}"), -01'000'000'000); - test(STR("-01"), STR("{:#Lo}"), -01); - test(STR("-01,000,000,000"), STR("{:#Lo}"), -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(STR("0"), STR("{:Lo}"), 00); - test(STR("1"), STR("{:Lo}"), 01); - test(STR("1_0_00_000_00_0"), STR("{:Lo}"), 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(STR("0"), STR("{:#Lo}"), 00); - test(STR("01"), STR("{:#Lo}"), 01); - test(STR("01_0_00_000_00_0"), STR("{:#Lo}"), 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(STR("-1"), STR("{:Lo}"), -01); - test(STR("-1_0_00_000_00_0"), STR("{:Lo}"), -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(STR("-01"), STR("{:#Lo}"), -01); - test(STR("-01_0_00_000_00_0"), STR("{:#Lo}"), -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(STR("0"), en_US, STR("{:Lo}"), 00); - test(STR("1"), en_US, STR("{:Lo}"), 01); - test(STR("1,000,000,000"), en_US, STR("{:Lo}"), 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(STR("0"), en_US, STR("{:#Lo}"), 00); - test(STR("01"), en_US, STR("{:#Lo}"), 01); - test(STR("01,000,000,000"), en_US, STR("{:#Lo}"), 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(STR("-1"), en_US, STR("{:Lo}"), -01); - test(STR("-1,000,000,000"), en_US, STR("{:Lo}"), -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(STR("-01"), en_US, STR("{:#Lo}"), -01); - test(STR("-01,000,000,000"), en_US, STR("{:#Lo}"), -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(STR("0"), loc, STR("{:Lo}"), 00); - test(STR("1"), loc, STR("{:Lo}"), 01); - test(STR("1_0_00_000_00_0"), loc, STR("{:Lo}"), 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(STR("0"), loc, STR("{:#Lo}"), 00); - test(STR("01"), loc, STR("{:#Lo}"), 01); - test(STR("01_0_00_000_00_0"), loc, STR("{:#Lo}"), 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(STR("-1"), loc, STR("{:Lo}"), -01); - test(STR("-1_0_00_000_00_0"), loc, STR("{:Lo}"), -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(STR("-01"), loc, STR("{:#Lo}"), -01); - test(STR("-01_0_00_000_00_0"), loc, STR("{:#Lo}"), -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(STR("0"), STR("{:Lx}"), 0x0); - test(STR("1"), STR("{:Lx}"), 0x1); - test(STR("1,000,000,000"), STR("{:Lx}"), 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(STR("0x0"), STR("{:#Lx}"), 0x0); - test(STR("0x1"), STR("{:#Lx}"), 0x1); - test(STR("0x1,000,000,000"), STR("{:#Lx}"), 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(STR("-1"), STR("{:LX}"), -0x1); - test(STR("-1,000,000,000"), STR("{:LX}"), -0x1'000'000'000); + test(SV("-1"), SV("{:LX}"), -0x1); + test(SV("-1,000,000,000"), SV("{:LX}"), -0x1'000'000'000); - test(STR("-0X1"), STR("{:#LX}"), -0x1); - test(STR("-0X1,000,000,000"), STR("{:#LX}"), -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(STR("0"), STR("{:Lx}"), 0x0); - test(STR("1"), STR("{:Lx}"), 0x1); - test(STR("1_0_00_000_00_0"), STR("{:Lx}"), 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(STR("0x0"), STR("{:#Lx}"), 0x0); - test(STR("0x1"), STR("{:#Lx}"), 0x1); - test(STR("0x1_0_00_000_00_0"), STR("{:#Lx}"), 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(STR("-1"), STR("{:LX}"), -0x1); - test(STR("-1_0_00_000_00_0"), STR("{:LX}"), -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(STR("-0X1"), STR("{:#LX}"), -0x1); - test(STR("-0X1_0_00_000_00_0"), STR("{:#LX}"), -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(STR("0"), en_US, STR("{:Lx}"), 0x0); - test(STR("1"), en_US, STR("{:Lx}"), 0x1); - test(STR("1,000,000,000"), en_US, STR("{:Lx}"), 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(STR("0x0"), en_US, STR("{:#Lx}"), 0x0); - test(STR("0x1"), en_US, STR("{:#Lx}"), 0x1); - test(STR("0x1,000,000,000"), en_US, STR("{:#Lx}"), 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(STR("-1"), en_US, STR("{:LX}"), -0x1); - test(STR("-1,000,000,000"), en_US, STR("{:LX}"), -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(STR("-0X1"), en_US, STR("{:#LX}"), -0x1); - test(STR("-0X1,000,000,000"), en_US, STR("{:#LX}"), -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(STR("0"), loc, STR("{:Lx}"), 0x0); - test(STR("1"), loc, STR("{:Lx}"), 0x1); - test(STR("1_0_00_000_00_0"), loc, STR("{:Lx}"), 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(STR("0x0"), loc, STR("{:#Lx}"), 0x0); - test(STR("0x1"), loc, STR("{:#Lx}"), 0x1); - test(STR("0x1_0_00_000_00_0"), loc, STR("{:#Lx}"), 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(STR("-1"), loc, STR("{:LX}"), -0x1); - test(STR("-1_0_00_000_00_0"), loc, STR("{:LX}"), -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(STR("-0X1"), loc, STR("{:#LX}"), -0x1); - test(STR("-0X1_0_00_000_00_0"), loc, STR("{:#LX}"), -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(STR("4_2"), loc, STR("{:L}"), 42); + test(SV("4_2"), loc, SV("{:L}"), 42); - test(STR(" 4_2"), loc, STR("{:6L}"), 42); - test(STR("4_2 "), loc, STR("{:<6L}"), 42); - test(STR(" 4_2 "), loc, STR("{:^6L}"), 42); - test(STR(" 4_2"), loc, STR("{:>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(SV(" 4_2"), loc, SV("{:>6L}"), 42); - test(STR("4_2***"), loc, STR("{:*<6L}"), 42); - test(STR("*4_2**"), loc, STR("{:*^6L}"), 42); - test(STR("***4_2"), loc, STR("{:*>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(STR("4_a*****"), loc, STR("{:*<8Lx}"), 0x4a); - test(STR("**4_a***"), loc, STR("{:*^8Lx}"), 0x4a); - test(STR("*****4_a"), loc, STR("{:*>8Lx}"), 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(STR("0x4_a***"), loc, STR("{:*<#8Lx}"), 0x4a); - test(STR("*0x4_a**"), loc, STR("{:*^#8Lx}"), 0x4a); - test(STR("***0x4_a"), loc, STR("{:*>#8Lx}"), 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(STR("4_A*****"), loc, STR("{:*<8LX}"), 0x4a); - test(STR("**4_A***"), loc, STR("{:*^8LX}"), 0x4a); - test(STR("*****4_A"), loc, STR("{:*>8LX}"), 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(STR("0X4_A***"), loc, STR("{:*<#8LX}"), 0x4a); - test(STR("*0X4_A**"), loc, STR("{:*^#8LX}"), 0x4a); - test(STR("***0X4_A"), loc, STR("{:*>#8LX}"), 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(STR("4_2 "), loc, STR("{:<06L}"), 42); - test(STR(" 4_2 "), loc, STR("{:^06L}"), 42); - test(STR(" 4_2"), loc, STR("{:>06L}"), 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(STR(" 4_2"), loc, STR("{:6L}"), 42); - test(STR("0004_2"), loc, STR("{:06L}"), 42); - test(STR("-004_2"), loc, STR("{:06L}"), -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(STR("000004_a"), loc, STR("{:08Lx}"), 0x4a); - test(STR("0x0004_a"), loc, STR("{:#08Lx}"), 0x4a); - test(STR("0X0004_A"), loc, STR("{:#08LX}"), 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(STR("-00004_a"), loc, STR("{:08Lx}"), -0x4a); - test(STR("-0x004_a"), loc, STR("{:#08Lx}"), -0x4a); - test(STR("-0X004_A"), loc, STR("{:#08LX}"), -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 +609,83 @@ void test_floating_point_hex_lower_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.23456p-3"), STR("{:La}"), F(0x1.23456p-3)); - test(STR("1.23456p-2"), STR("{:La}"), F(0x1.23456p-2)); - test(STR("1.23456p-1"), STR("{:La}"), F(0x1.23456p-1)); - test(STR("1.23456p+0"), STR("{:La}"), F(0x1.23456p0)); - test(STR("1.23456p+1"), STR("{:La}"), F(0x1.23456p+1)); - test(STR("1.23456p+2"), STR("{:La}"), F(0x1.23456p+2)); - test(STR("1.23456p+3"), STR("{:La}"), F(0x1.23456p+3)); - test(STR("1.23456p+20"), STR("{:La}"), 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(STR("1#23456p-3"), STR("{:La}"), F(0x1.23456p-3)); - test(STR("1#23456p-2"), STR("{:La}"), F(0x1.23456p-2)); - test(STR("1#23456p-1"), STR("{:La}"), F(0x1.23456p-1)); - test(STR("1#23456p+0"), STR("{:La}"), F(0x1.23456p0)); - test(STR("1#23456p+1"), STR("{:La}"), F(0x1.23456p+1)); - test(STR("1#23456p+2"), STR("{:La}"), F(0x1.23456p+2)); - test(STR("1#23456p+3"), STR("{:La}"), F(0x1.23456p+3)); - test(STR("1#23456p+20"), STR("{:La}"), F(0x1.23456p+20)); - - test(STR("1.23456p-3"), en_US, STR("{:La}"), F(0x1.23456p-3)); - test(STR("1.23456p-2"), en_US, STR("{:La}"), F(0x1.23456p-2)); - test(STR("1.23456p-1"), en_US, STR("{:La}"), F(0x1.23456p-1)); - test(STR("1.23456p+0"), en_US, STR("{:La}"), F(0x1.23456p0)); - test(STR("1.23456p+1"), en_US, STR("{:La}"), F(0x1.23456p+1)); - test(STR("1.23456p+2"), en_US, STR("{:La}"), F(0x1.23456p+2)); - test(STR("1.23456p+3"), en_US, STR("{:La}"), F(0x1.23456p+3)); - test(STR("1.23456p+20"), en_US, STR("{:La}"), 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(STR("1#23456p-3"), loc, STR("{:La}"), F(0x1.23456p-3)); - test(STR("1#23456p-2"), loc, STR("{:La}"), F(0x1.23456p-2)); - test(STR("1#23456p-1"), loc, STR("{:La}"), F(0x1.23456p-1)); - test(STR("1#23456p+0"), loc, STR("{:La}"), F(0x1.23456p0)); - test(STR("1#23456p+1"), loc, STR("{:La}"), F(0x1.23456p+1)); - test(STR("1#23456p+2"), loc, STR("{:La}"), F(0x1.23456p+2)); - test(STR("1#23456p+3"), loc, STR("{:La}"), F(0x1.23456p+3)); - test(STR("1#23456p+20"), loc, STR("{:La}"), 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(STR("1.23456p+3$$$"), STR("{:$<13La}"), F(0x1.23456p3)); - test(STR("$$$1.23456p+3"), STR("{:$>13La}"), F(0x1.23456p3)); - test(STR("$1.23456p+3$$"), STR("{:$^13La}"), F(0x1.23456p3)); - test(STR("0001.23456p+3"), STR("{:013La}"), F(0x1.23456p3)); - test(STR("-1.23456p+3$$$"), STR("{:$<14La}"), F(-0x1.23456p3)); - test(STR("$$$-1.23456p+3"), STR("{:$>14La}"), F(-0x1.23456p3)); - test(STR("$-1.23456p+3$$"), STR("{:$^14La}"), F(-0x1.23456p3)); - test(STR("-0001.23456p+3"), STR("{:014La}"), 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(STR("1#23456p+3$$$"), STR("{:$<13La}"), F(0x1.23456p3)); - test(STR("$$$1#23456p+3"), STR("{:$>13La}"), F(0x1.23456p3)); - test(STR("$1#23456p+3$$"), STR("{:$^13La}"), F(0x1.23456p3)); - test(STR("0001#23456p+3"), STR("{:013La}"), F(0x1.23456p3)); - test(STR("-1#23456p+3$$$"), STR("{:$<14La}"), F(-0x1.23456p3)); - test(STR("$$$-1#23456p+3"), STR("{:$>14La}"), F(-0x1.23456p3)); - test(STR("$-1#23456p+3$$"), STR("{:$^14La}"), F(-0x1.23456p3)); - test(STR("-0001#23456p+3"), STR("{:014La}"), F(-0x1.23456p3)); - - test(STR("1.23456p+3$$$"), en_US, STR("{:$<13La}"), F(0x1.23456p3)); - test(STR("$$$1.23456p+3"), en_US, STR("{:$>13La}"), F(0x1.23456p3)); - test(STR("$1.23456p+3$$"), en_US, STR("{:$^13La}"), F(0x1.23456p3)); - test(STR("0001.23456p+3"), en_US, STR("{:013La}"), F(0x1.23456p3)); - test(STR("-1.23456p+3$$$"), en_US, STR("{:$<14La}"), F(-0x1.23456p3)); - test(STR("$$$-1.23456p+3"), en_US, STR("{:$>14La}"), F(-0x1.23456p3)); - test(STR("$-1.23456p+3$$"), en_US, STR("{:$^14La}"), F(-0x1.23456p3)); - test(STR("-0001.23456p+3"), en_US, STR("{:014La}"), 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(STR("1#23456p+3$$$"), loc, STR("{:$<13La}"), F(0x1.23456p3)); - test(STR("$$$1#23456p+3"), loc, STR("{:$>13La}"), F(0x1.23456p3)); - test(STR("$1#23456p+3$$"), loc, STR("{:$^13La}"), F(0x1.23456p3)); - test(STR("0001#23456p+3"), loc, STR("{:013La}"), F(0x1.23456p3)); - test(STR("-1#23456p+3$$$"), loc, STR("{:$<14La}"), F(-0x1.23456p3)); - test(STR("$$$-1#23456p+3"), loc, STR("{:$>14La}"), F(-0x1.23456p3)); - test(STR("$-1#23456p+3$$"), loc, STR("{:$^14La}"), F(-0x1.23456p3)); - test(STR("-0001#23456p+3"), loc, STR("{:014La}"), 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 +695,83 @@ void test_floating_point_hex_upper_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.23456P-3"), STR("{:LA}"), F(0x1.23456p-3)); - test(STR("1.23456P-2"), STR("{:LA}"), F(0x1.23456p-2)); - test(STR("1.23456P-1"), STR("{:LA}"), F(0x1.23456p-1)); - test(STR("1.23456P+0"), STR("{:LA}"), F(0x1.23456p0)); - test(STR("1.23456P+1"), STR("{:LA}"), F(0x1.23456p+1)); - test(STR("1.23456P+2"), STR("{:LA}"), F(0x1.23456p+2)); - test(STR("1.23456P+3"), STR("{:LA}"), F(0x1.23456p+3)); - test(STR("1.23456P+20"), STR("{:LA}"), 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(STR("1#23456P-3"), STR("{:LA}"), F(0x1.23456p-3)); - test(STR("1#23456P-2"), STR("{:LA}"), F(0x1.23456p-2)); - test(STR("1#23456P-1"), STR("{:LA}"), F(0x1.23456p-1)); - test(STR("1#23456P+0"), STR("{:LA}"), F(0x1.23456p0)); - test(STR("1#23456P+1"), STR("{:LA}"), F(0x1.23456p+1)); - test(STR("1#23456P+2"), STR("{:LA}"), F(0x1.23456p+2)); - test(STR("1#23456P+3"), STR("{:LA}"), F(0x1.23456p+3)); - test(STR("1#23456P+20"), STR("{:LA}"), F(0x1.23456p+20)); - - test(STR("1.23456P-3"), en_US, STR("{:LA}"), F(0x1.23456p-3)); - test(STR("1.23456P-2"), en_US, STR("{:LA}"), F(0x1.23456p-2)); - test(STR("1.23456P-1"), en_US, STR("{:LA}"), F(0x1.23456p-1)); - test(STR("1.23456P+0"), en_US, STR("{:LA}"), F(0x1.23456p0)); - test(STR("1.23456P+1"), en_US, STR("{:LA}"), F(0x1.23456p+1)); - test(STR("1.23456P+2"), en_US, STR("{:LA}"), F(0x1.23456p+2)); - test(STR("1.23456P+3"), en_US, STR("{:LA}"), F(0x1.23456p+3)); - test(STR("1.23456P+20"), en_US, STR("{:LA}"), 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(STR("1#23456P-3"), loc, STR("{:LA}"), F(0x1.23456p-3)); - test(STR("1#23456P-2"), loc, STR("{:LA}"), F(0x1.23456p-2)); - test(STR("1#23456P-1"), loc, STR("{:LA}"), F(0x1.23456p-1)); - test(STR("1#23456P+0"), loc, STR("{:LA}"), F(0x1.23456p0)); - test(STR("1#23456P+1"), loc, STR("{:LA}"), F(0x1.23456p+1)); - test(STR("1#23456P+2"), loc, STR("{:LA}"), F(0x1.23456p+2)); - test(STR("1#23456P+3"), loc, STR("{:LA}"), F(0x1.23456p+3)); - test(STR("1#23456P+20"), loc, STR("{:LA}"), 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(STR("1.23456P+3$$$"), STR("{:$<13LA}"), F(0x1.23456p3)); - test(STR("$$$1.23456P+3"), STR("{:$>13LA}"), F(0x1.23456p3)); - test(STR("$1.23456P+3$$"), STR("{:$^13LA}"), F(0x1.23456p3)); - test(STR("0001.23456P+3"), STR("{:013LA}"), F(0x1.23456p3)); - test(STR("-1.23456P+3$$$"), STR("{:$<14LA}"), F(-0x1.23456p3)); - test(STR("$$$-1.23456P+3"), STR("{:$>14LA}"), F(-0x1.23456p3)); - test(STR("$-1.23456P+3$$"), STR("{:$^14LA}"), F(-0x1.23456p3)); - test(STR("-0001.23456P+3"), STR("{:014LA}"), 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(STR("1#23456P+3$$$"), STR("{:$<13LA}"), F(0x1.23456p3)); - test(STR("$$$1#23456P+3"), STR("{:$>13LA}"), F(0x1.23456p3)); - test(STR("$1#23456P+3$$"), STR("{:$^13LA}"), F(0x1.23456p3)); - test(STR("0001#23456P+3"), STR("{:013LA}"), F(0x1.23456p3)); - test(STR("-1#23456P+3$$$"), STR("{:$<14LA}"), F(-0x1.23456p3)); - test(STR("$$$-1#23456P+3"), STR("{:$>14LA}"), F(-0x1.23456p3)); - test(STR("$-1#23456P+3$$"), STR("{:$^14LA}"), F(-0x1.23456p3)); - test(STR("-0001#23456P+3"), STR("{:014LA}"), F(-0x1.23456p3)); - - test(STR("1.23456P+3$$$"), en_US, STR("{:$<13LA}"), F(0x1.23456p3)); - test(STR("$$$1.23456P+3"), en_US, STR("{:$>13LA}"), F(0x1.23456p3)); - test(STR("$1.23456P+3$$"), en_US, STR("{:$^13LA}"), F(0x1.23456p3)); - test(STR("0001.23456P+3"), en_US, STR("{:013LA}"), F(0x1.23456p3)); - test(STR("-1.23456P+3$$$"), en_US, STR("{:$<14LA}"), F(-0x1.23456p3)); - test(STR("$$$-1.23456P+3"), en_US, STR("{:$>14LA}"), F(-0x1.23456p3)); - test(STR("$-1.23456P+3$$"), en_US, STR("{:$^14LA}"), F(-0x1.23456p3)); - test(STR("-0001.23456P+3"), en_US, STR("{:014LA}"), 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(STR("1#23456P+3$$$"), loc, STR("{:$<13LA}"), F(0x1.23456p3)); - test(STR("$$$1#23456P+3"), loc, STR("{:$>13LA}"), F(0x1.23456p3)); - test(STR("$1#23456P+3$$"), loc, STR("{:$^13LA}"), F(0x1.23456p3)); - test(STR("0001#23456P+3"), loc, STR("{:013LA}"), F(0x1.23456p3)); - test(STR("-1#23456P+3$$$"), loc, STR("{:$<14LA}"), F(-0x1.23456p3)); - test(STR("$$$-1#23456P+3"), loc, STR("{:$>14LA}"), F(-0x1.23456p3)); - test(STR("$-1#23456P+3$$"), loc, STR("{:$^14LA}"), F(-0x1.23456p3)); - test(STR("-0001#23456P+3"), loc, STR("{:014LA}"), 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 +781,83 @@ void test_floating_point_hex_lower_case_precision() { // *** Basic *** std::locale::global(en_US); - test(STR("1.234560p-3"), STR("{:.6La}"), F(0x1.23456p-3)); - test(STR("1.234560p-2"), STR("{:.6La}"), F(0x1.23456p-2)); - test(STR("1.234560p-1"), STR("{:.6La}"), F(0x1.23456p-1)); - test(STR("1.234560p+0"), STR("{:.6La}"), F(0x1.23456p0)); - test(STR("1.234560p+1"), STR("{:.6La}"), F(0x1.23456p+1)); - test(STR("1.234560p+2"), STR("{:.6La}"), F(0x1.23456p+2)); - test(STR("1.234560p+3"), STR("{:.6La}"), F(0x1.23456p+3)); - test(STR("1.234560p+20"), STR("{:.6La}"), 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(STR("1#234560p-3"), STR("{:.6La}"), F(0x1.23456p-3)); - test(STR("1#234560p-2"), STR("{:.6La}"), F(0x1.23456p-2)); - test(STR("1#234560p-1"), STR("{:.6La}"), F(0x1.23456p-1)); - test(STR("1#234560p+0"), STR("{:.6La}"), F(0x1.23456p0)); - test(STR("1#234560p+1"), STR("{:.6La}"), F(0x1.23456p+1)); - test(STR("1#234560p+2"), STR("{:.6La}"), F(0x1.23456p+2)); - test(STR("1#234560p+3"), STR("{:.6La}"), F(0x1.23456p+3)); - test(STR("1#234560p+20"), STR("{:.6La}"), F(0x1.23456p+20)); - - test(STR("1.234560p-3"), en_US, STR("{:.6La}"), F(0x1.23456p-3)); - test(STR("1.234560p-2"), en_US, STR("{:.6La}"), F(0x1.23456p-2)); - test(STR("1.234560p-1"), en_US, STR("{:.6La}"), F(0x1.23456p-1)); - test(STR("1.234560p+0"), en_US, STR("{:.6La}"), F(0x1.23456p0)); - test(STR("1.234560p+1"), en_US, STR("{:.6La}"), F(0x1.23456p+1)); - test(STR("1.234560p+2"), en_US, STR("{:.6La}"), F(0x1.23456p+2)); - test(STR("1.234560p+3"), en_US, STR("{:.6La}"), F(0x1.23456p+3)); - test(STR("1.234560p+20"), en_US, STR("{:.6La}"), 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(STR("1#234560p-3"), loc, STR("{:.6La}"), F(0x1.23456p-3)); - test(STR("1#234560p-2"), loc, STR("{:.6La}"), F(0x1.23456p-2)); - test(STR("1#234560p-1"), loc, STR("{:.6La}"), F(0x1.23456p-1)); - test(STR("1#234560p+0"), loc, STR("{:.6La}"), F(0x1.23456p0)); - test(STR("1#234560p+1"), loc, STR("{:.6La}"), F(0x1.23456p+1)); - test(STR("1#234560p+2"), loc, STR("{:.6La}"), F(0x1.23456p+2)); - test(STR("1#234560p+3"), loc, STR("{:.6La}"), F(0x1.23456p+3)); - test(STR("1#234560p+20"), loc, STR("{:.6La}"), 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(STR("1.234560p+3$$$"), STR("{:$<14.6La}"), F(0x1.23456p3)); - test(STR("$$$1.234560p+3"), STR("{:$>14.6La}"), F(0x1.23456p3)); - test(STR("$1.234560p+3$$"), STR("{:$^14.6La}"), F(0x1.23456p3)); - test(STR("0001.234560p+3"), STR("{:014.6La}"), F(0x1.23456p3)); - test(STR("-1.234560p+3$$$"), STR("{:$<15.6La}"), F(-0x1.23456p3)); - test(STR("$$$-1.234560p+3"), STR("{:$>15.6La}"), F(-0x1.23456p3)); - test(STR("$-1.234560p+3$$"), STR("{:$^15.6La}"), F(-0x1.23456p3)); - test(STR("-0001.234560p+3"), STR("{:015.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("$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(STR("1#234560p+3$$$"), STR("{:$<14.6La}"), F(0x1.23456p3)); - test(STR("$$$1#234560p+3"), STR("{:$>14.6La}"), F(0x1.23456p3)); - test(STR("$1#234560p+3$$"), STR("{:$^14.6La}"), F(0x1.23456p3)); - test(STR("0001#234560p+3"), STR("{:014.6La}"), F(0x1.23456p3)); - test(STR("-1#234560p+3$$$"), STR("{:$<15.6La}"), F(-0x1.23456p3)); - test(STR("$$$-1#234560p+3"), STR("{:$>15.6La}"), F(-0x1.23456p3)); - test(STR("$-1#234560p+3$$"), STR("{:$^15.6La}"), F(-0x1.23456p3)); - test(STR("-0001#234560p+3"), STR("{:015.6La}"), F(-0x1.23456p3)); - - test(STR("1.234560p+3$$$"), en_US, STR("{:$<14.6La}"), F(0x1.23456p3)); - test(STR("$$$1.234560p+3"), en_US, STR("{:$>14.6La}"), F(0x1.23456p3)); - test(STR("$1.234560p+3$$"), en_US, STR("{:$^14.6La}"), F(0x1.23456p3)); - test(STR("0001.234560p+3"), en_US, STR("{:014.6La}"), F(0x1.23456p3)); - test(STR("-1.234560p+3$$$"), en_US, STR("{:$<15.6La}"), F(-0x1.23456p3)); - test(STR("$$$-1.234560p+3"), en_US, STR("{:$>15.6La}"), F(-0x1.23456p3)); - test(STR("$-1.234560p+3$$"), en_US, STR("{:$^15.6La}"), F(-0x1.23456p3)); - test(STR("-0001.234560p+3"), en_US, STR("{:015.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("$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(STR("1#234560p+3$$$"), loc, STR("{:$<14.6La}"), F(0x1.23456p3)); - test(STR("$$$1#234560p+3"), loc, STR("{:$>14.6La}"), F(0x1.23456p3)); - test(STR("$1#234560p+3$$"), loc, STR("{:$^14.6La}"), F(0x1.23456p3)); - test(STR("0001#234560p+3"), loc, STR("{:014.6La}"), F(0x1.23456p3)); - test(STR("-1#234560p+3$$$"), loc, STR("{:$<15.6La}"), F(-0x1.23456p3)); - test(STR("$$$-1#234560p+3"), loc, STR("{:$>15.6La}"), F(-0x1.23456p3)); - test(STR("$-1#234560p+3$$"), loc, STR("{:$^15.6La}"), F(-0x1.23456p3)); - test(STR("-0001#234560p+3"), loc, STR("{:015.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("$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 +867,83 @@ void test_floating_point_hex_upper_case_precision() { // *** Basic *** std::locale::global(en_US); - test(STR("1.234560P-3"), STR("{:.6LA}"), F(0x1.23456p-3)); - test(STR("1.234560P-2"), STR("{:.6LA}"), F(0x1.23456p-2)); - test(STR("1.234560P-1"), STR("{:.6LA}"), F(0x1.23456p-1)); - test(STR("1.234560P+0"), STR("{:.6LA}"), F(0x1.23456p0)); - test(STR("1.234560P+1"), STR("{:.6LA}"), F(0x1.23456p+1)); - test(STR("1.234560P+2"), STR("{:.6LA}"), F(0x1.23456p+2)); - test(STR("1.234560P+3"), STR("{:.6LA}"), F(0x1.23456p+3)); - test(STR("1.234560P+20"), STR("{:.6LA}"), 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(STR("1#234560P-3"), STR("{:.6LA}"), F(0x1.23456p-3)); - test(STR("1#234560P-2"), STR("{:.6LA}"), F(0x1.23456p-2)); - test(STR("1#234560P-1"), STR("{:.6LA}"), F(0x1.23456p-1)); - test(STR("1#234560P+0"), STR("{:.6LA}"), F(0x1.23456p0)); - test(STR("1#234560P+1"), STR("{:.6LA}"), F(0x1.23456p+1)); - test(STR("1#234560P+2"), STR("{:.6LA}"), F(0x1.23456p+2)); - test(STR("1#234560P+3"), STR("{:.6LA}"), F(0x1.23456p+3)); - test(STR("1#234560P+20"), STR("{:.6LA}"), F(0x1.23456p+20)); - - test(STR("1.234560P-3"), en_US, STR("{:.6LA}"), F(0x1.23456p-3)); - test(STR("1.234560P-2"), en_US, STR("{:.6LA}"), F(0x1.23456p-2)); - test(STR("1.234560P-1"), en_US, STR("{:.6LA}"), F(0x1.23456p-1)); - test(STR("1.234560P+0"), en_US, STR("{:.6LA}"), F(0x1.23456p0)); - test(STR("1.234560P+1"), en_US, STR("{:.6LA}"), F(0x1.23456p+1)); - test(STR("1.234560P+2"), en_US, STR("{:.6LA}"), F(0x1.23456p+2)); - test(STR("1.234560P+3"), en_US, STR("{:.6LA}"), F(0x1.23456p+3)); - test(STR("1.234560P+20"), en_US, STR("{:.6LA}"), 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(STR("1#234560P-3"), loc, STR("{:.6LA}"), F(0x1.23456p-3)); - test(STR("1#234560P-2"), loc, STR("{:.6LA}"), F(0x1.23456p-2)); - test(STR("1#234560P-1"), loc, STR("{:.6LA}"), F(0x1.23456p-1)); - test(STR("1#234560P+0"), loc, STR("{:.6LA}"), F(0x1.23456p0)); - test(STR("1#234560P+1"), loc, STR("{:.6LA}"), F(0x1.23456p+1)); - test(STR("1#234560P+2"), loc, STR("{:.6LA}"), F(0x1.23456p+2)); - test(STR("1#234560P+3"), loc, STR("{:.6LA}"), F(0x1.23456p+3)); - test(STR("1#234560P+20"), loc, STR("{:.6LA}"), 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(STR("1.234560P+3$$$"), STR("{:$<14.6LA}"), F(0x1.23456p3)); - test(STR("$$$1.234560P+3"), STR("{:$>14.6LA}"), F(0x1.23456p3)); - test(STR("$1.234560P+3$$"), STR("{:$^14.6LA}"), F(0x1.23456p3)); - test(STR("0001.234560P+3"), STR("{:014.6LA}"), F(0x1.23456p3)); - test(STR("-1.234560P+3$$$"), STR("{:$<15.6LA}"), F(-0x1.23456p3)); - test(STR("$$$-1.234560P+3"), STR("{:$>15.6LA}"), F(-0x1.23456p3)); - test(STR("$-1.234560P+3$$"), STR("{:$^15.6LA}"), F(-0x1.23456p3)); - test(STR("-0001.234560P+3"), STR("{:015.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("$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(STR("1#234560P+3$$$"), STR("{:$<14.6LA}"), F(0x1.23456p3)); - test(STR("$$$1#234560P+3"), STR("{:$>14.6LA}"), F(0x1.23456p3)); - test(STR("$1#234560P+3$$"), STR("{:$^14.6LA}"), F(0x1.23456p3)); - test(STR("0001#234560P+3"), STR("{:014.6LA}"), F(0x1.23456p3)); - test(STR("-1#234560P+3$$$"), STR("{:$<15.6LA}"), F(-0x1.23456p3)); - test(STR("$$$-1#234560P+3"), STR("{:$>15.6LA}"), F(-0x1.23456p3)); - test(STR("$-1#234560P+3$$"), STR("{:$^15.6LA}"), F(-0x1.23456p3)); - test(STR("-0001#234560P+3"), STR("{:015.6LA}"), F(-0x1.23456p3)); - - test(STR("1.234560P+3$$$"), en_US, STR("{:$<14.6LA}"), F(0x1.23456p3)); - test(STR("$$$1.234560P+3"), en_US, STR("{:$>14.6LA}"), F(0x1.23456p3)); - test(STR("$1.234560P+3$$"), en_US, STR("{:$^14.6LA}"), F(0x1.23456p3)); - test(STR("0001.234560P+3"), en_US, STR("{:014.6LA}"), F(0x1.23456p3)); - test(STR("-1.234560P+3$$$"), en_US, STR("{:$<15.6LA}"), F(-0x1.23456p3)); - test(STR("$$$-1.234560P+3"), en_US, STR("{:$>15.6LA}"), F(-0x1.23456p3)); - test(STR("$-1.234560P+3$$"), en_US, STR("{:$^15.6LA}"), F(-0x1.23456p3)); - test(STR("-0001.234560P+3"), en_US, STR("{:015.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("$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(STR("1#234560P+3$$$"), loc, STR("{:$<14.6LA}"), F(0x1.23456p3)); - test(STR("$$$1#234560P+3"), loc, STR("{:$>14.6LA}"), F(0x1.23456p3)); - test(STR("$1#234560P+3$$"), loc, STR("{:$^14.6LA}"), F(0x1.23456p3)); - test(STR("0001#234560P+3"), loc, STR("{:014.6LA}"), F(0x1.23456p3)); - test(STR("-1#234560P+3$$$"), loc, STR("{:$<15.6LA}"), F(-0x1.23456p3)); - test(STR("$$$-1#234560P+3"), loc, STR("{:$>15.6LA}"), F(-0x1.23456p3)); - test(STR("$-1#234560P+3$$"), loc, STR("{:$^15.6LA}"), F(-0x1.23456p3)); - test(STR("-0001#234560P+3"), loc, STR("{:015.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("$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 +953,115 @@ void test_floating_point_scientific_lower_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.234567e-03"), STR("{:.6Le}"), F(1.234567e-3)); - test(STR("1.234567e-02"), STR("{:.6Le}"), F(1.234567e-2)); - test(STR("1.234567e-01"), STR("{:.6Le}"), F(1.234567e-1)); - test(STR("1.234567e+00"), STR("{:.6Le}"), F(1.234567e0)); - test(STR("1.234567e+01"), STR("{:.6Le}"), F(1.234567e1)); - test(STR("1.234567e+02"), STR("{:.6Le}"), F(1.234567e2)); - test(STR("1.234567e+03"), STR("{:.6Le}"), F(1.234567e3)); - test(STR("1.234567e+20"), STR("{:.6Le}"), F(1.234567e20)); - test(STR("-1.234567e-03"), STR("{:.6Le}"), F(-1.234567e-3)); - test(STR("-1.234567e-02"), STR("{:.6Le}"), F(-1.234567e-2)); - test(STR("-1.234567e-01"), STR("{:.6Le}"), F(-1.234567e-1)); - test(STR("-1.234567e+00"), STR("{:.6Le}"), F(-1.234567e0)); - test(STR("-1.234567e+01"), STR("{:.6Le}"), F(-1.234567e1)); - test(STR("-1.234567e+02"), STR("{:.6Le}"), F(-1.234567e2)); - test(STR("-1.234567e+03"), STR("{:.6Le}"), F(-1.234567e3)); - test(STR("-1.234567e+20"), STR("{:.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"), 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(STR("1#234567e-03"), STR("{:.6Le}"), F(1.234567e-3)); - test(STR("1#234567e-02"), STR("{:.6Le}"), F(1.234567e-2)); - test(STR("1#234567e-01"), STR("{:.6Le}"), F(1.234567e-1)); - test(STR("1#234567e+00"), STR("{:.6Le}"), F(1.234567e0)); - test(STR("1#234567e+01"), STR("{:.6Le}"), F(1.234567e1)); - test(STR("1#234567e+02"), STR("{:.6Le}"), F(1.234567e2)); - test(STR("1#234567e+03"), STR("{:.6Le}"), F(1.234567e3)); - test(STR("1#234567e+20"), STR("{:.6Le}"), F(1.234567e20)); - test(STR("-1#234567e-03"), STR("{:.6Le}"), F(-1.234567e-3)); - test(STR("-1#234567e-02"), STR("{:.6Le}"), F(-1.234567e-2)); - test(STR("-1#234567e-01"), STR("{:.6Le}"), F(-1.234567e-1)); - test(STR("-1#234567e+00"), STR("{:.6Le}"), F(-1.234567e0)); - test(STR("-1#234567e+01"), STR("{:.6Le}"), F(-1.234567e1)); - test(STR("-1#234567e+02"), STR("{:.6Le}"), F(-1.234567e2)); - test(STR("-1#234567e+03"), STR("{:.6Le}"), F(-1.234567e3)); - test(STR("-1#234567e+20"), STR("{:.6Le}"), F(-1.234567e20)); - - test(STR("1.234567e-03"), en_US, STR("{:.6Le}"), F(1.234567e-3)); - test(STR("1.234567e-02"), en_US, STR("{:.6Le}"), F(1.234567e-2)); - test(STR("1.234567e-01"), en_US, STR("{:.6Le}"), F(1.234567e-1)); - test(STR("1.234567e+00"), en_US, STR("{:.6Le}"), F(1.234567e0)); - test(STR("1.234567e+01"), en_US, STR("{:.6Le}"), F(1.234567e1)); - test(STR("1.234567e+02"), en_US, STR("{:.6Le}"), F(1.234567e2)); - test(STR("1.234567e+03"), en_US, STR("{:.6Le}"), F(1.234567e3)); - test(STR("1.234567e+20"), en_US, STR("{:.6Le}"), F(1.234567e20)); - test(STR("-1.234567e-03"), en_US, STR("{:.6Le}"), F(-1.234567e-3)); - test(STR("-1.234567e-02"), en_US, STR("{:.6Le}"), F(-1.234567e-2)); - test(STR("-1.234567e-01"), en_US, STR("{:.6Le}"), F(-1.234567e-1)); - test(STR("-1.234567e+00"), en_US, STR("{:.6Le}"), F(-1.234567e0)); - test(STR("-1.234567e+01"), en_US, STR("{:.6Le}"), F(-1.234567e1)); - test(STR("-1.234567e+02"), en_US, STR("{:.6Le}"), F(-1.234567e2)); - test(STR("-1.234567e+03"), en_US, STR("{:.6Le}"), F(-1.234567e3)); - test(STR("-1.234567e+20"), en_US, STR("{:.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"), 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(STR("1#234567e-03"), loc, STR("{:.6Le}"), F(1.234567e-3)); - test(STR("1#234567e-02"), loc, STR("{:.6Le}"), F(1.234567e-2)); - test(STR("1#234567e-01"), loc, STR("{:.6Le}"), F(1.234567e-1)); - test(STR("1#234567e+00"), loc, STR("{:.6Le}"), F(1.234567e0)); - test(STR("1#234567e+01"), loc, STR("{:.6Le}"), F(1.234567e1)); - test(STR("1#234567e+02"), loc, STR("{:.6Le}"), F(1.234567e2)); - test(STR("1#234567e+03"), loc, STR("{:.6Le}"), F(1.234567e3)); - test(STR("1#234567e+20"), loc, STR("{:.6Le}"), F(1.234567e20)); - test(STR("-1#234567e-03"), loc, STR("{:.6Le}"), F(-1.234567e-3)); - test(STR("-1#234567e-02"), loc, STR("{:.6Le}"), F(-1.234567e-2)); - test(STR("-1#234567e-01"), loc, STR("{:.6Le}"), F(-1.234567e-1)); - test(STR("-1#234567e+00"), loc, STR("{:.6Le}"), F(-1.234567e0)); - test(STR("-1#234567e+01"), loc, STR("{:.6Le}"), F(-1.234567e1)); - test(STR("-1#234567e+02"), loc, STR("{:.6Le}"), F(-1.234567e2)); - test(STR("-1#234567e+03"), loc, STR("{:.6Le}"), F(-1.234567e3)); - test(STR("-1#234567e+20"), loc, STR("{:.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)); + 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(STR("1.234567e+03$$$"), STR("{:$<15.6Le}"), F(1.234567e3)); - test(STR("$$$1.234567e+03"), STR("{:$>15.6Le}"), F(1.234567e3)); - test(STR("$1.234567e+03$$"), STR("{:$^15.6Le}"), F(1.234567e3)); - test(STR("0001.234567e+03"), STR("{:015.6Le}"), F(1.234567e3)); - test(STR("-1.234567e+03$$$"), STR("{:$<16.6Le}"), F(-1.234567e3)); - test(STR("$$$-1.234567e+03"), STR("{:$>16.6Le}"), F(-1.234567e3)); - test(STR("$-1.234567e+03$$"), STR("{:$^16.6Le}"), F(-1.234567e3)); - test(STR("-0001.234567e+03"), STR("{:016.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("$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(STR("1#234567e+03$$$"), STR("{:$<15.6Le}"), F(1.234567e3)); - test(STR("$$$1#234567e+03"), STR("{:$>15.6Le}"), F(1.234567e3)); - test(STR("$1#234567e+03$$"), STR("{:$^15.6Le}"), F(1.234567e3)); - test(STR("0001#234567e+03"), STR("{:015.6Le}"), F(1.234567e3)); - test(STR("-1#234567e+03$$$"), STR("{:$<16.6Le}"), F(-1.234567e3)); - test(STR("$$$-1#234567e+03"), STR("{:$>16.6Le}"), F(-1.234567e3)); - test(STR("$-1#234567e+03$$"), STR("{:$^16.6Le}"), F(-1.234567e3)); - test(STR("-0001#234567e+03"), STR("{:016.6Le}"), F(-1.234567e3)); - - test(STR("1.234567e+03$$$"), en_US, STR("{:$<15.6Le}"), F(1.234567e3)); - test(STR("$$$1.234567e+03"), en_US, STR("{:$>15.6Le}"), F(1.234567e3)); - test(STR("$1.234567e+03$$"), en_US, STR("{:$^15.6Le}"), F(1.234567e3)); - test(STR("0001.234567e+03"), en_US, STR("{:015.6Le}"), F(1.234567e3)); - test(STR("-1.234567e+03$$$"), en_US, STR("{:$<16.6Le}"), F(-1.234567e3)); - test(STR("$$$-1.234567e+03"), en_US, STR("{:$>16.6Le}"), F(-1.234567e3)); - test(STR("$-1.234567e+03$$"), en_US, STR("{:$^16.6Le}"), F(-1.234567e3)); - test(STR("-0001.234567e+03"), en_US, STR("{:016.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("$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(STR("1#234567e+03$$$"), loc, STR("{:$<15.6Le}"), F(1.234567e3)); - test(STR("$$$1#234567e+03"), loc, STR("{:$>15.6Le}"), F(1.234567e3)); - test(STR("$1#234567e+03$$"), loc, STR("{:$^15.6Le}"), F(1.234567e3)); - test(STR("0001#234567e+03"), loc, STR("{:015.6Le}"), F(1.234567e3)); - test(STR("-1#234567e+03$$$"), loc, STR("{:$<16.6Le}"), F(-1.234567e3)); - test(STR("$$$-1#234567e+03"), loc, STR("{:$>16.6Le}"), F(-1.234567e3)); - test(STR("$-1#234567e+03$$"), loc, STR("{:$^16.6Le}"), F(-1.234567e3)); - test(STR("-0001#234567e+03"), loc, STR("{:016.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("$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 +1071,115 @@ void test_floating_point_scientific_upper_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.234567E-03"), STR("{:.6LE}"), F(1.234567e-3)); - test(STR("1.234567E-02"), STR("{:.6LE}"), F(1.234567e-2)); - test(STR("1.234567E-01"), STR("{:.6LE}"), F(1.234567e-1)); - test(STR("1.234567E+00"), STR("{:.6LE}"), F(1.234567e0)); - test(STR("1.234567E+01"), STR("{:.6LE}"), F(1.234567e1)); - test(STR("1.234567E+02"), STR("{:.6LE}"), F(1.234567e2)); - test(STR("1.234567E+03"), STR("{:.6LE}"), F(1.234567e3)); - test(STR("1.234567E+20"), STR("{:.6LE}"), F(1.234567e20)); - test(STR("-1.234567E-03"), STR("{:.6LE}"), F(-1.234567e-3)); - test(STR("-1.234567E-02"), STR("{:.6LE}"), F(-1.234567e-2)); - test(STR("-1.234567E-01"), STR("{:.6LE}"), F(-1.234567e-1)); - test(STR("-1.234567E+00"), STR("{:.6LE}"), F(-1.234567e0)); - test(STR("-1.234567E+01"), STR("{:.6LE}"), F(-1.234567e1)); - test(STR("-1.234567E+02"), STR("{:.6LE}"), F(-1.234567e2)); - test(STR("-1.234567E+03"), STR("{:.6LE}"), F(-1.234567e3)); - test(STR("-1.234567E+20"), STR("{:.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"), 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(STR("1#234567E-03"), STR("{:.6LE}"), F(1.234567e-3)); - test(STR("1#234567E-02"), STR("{:.6LE}"), F(1.234567e-2)); - test(STR("1#234567E-01"), STR("{:.6LE}"), F(1.234567e-1)); - test(STR("1#234567E+00"), STR("{:.6LE}"), F(1.234567e0)); - test(STR("1#234567E+01"), STR("{:.6LE}"), F(1.234567e1)); - test(STR("1#234567E+02"), STR("{:.6LE}"), F(1.234567e2)); - test(STR("1#234567E+03"), STR("{:.6LE}"), F(1.234567e3)); - test(STR("1#234567E+20"), STR("{:.6LE}"), F(1.234567e20)); - test(STR("-1#234567E-03"), STR("{:.6LE}"), F(-1.234567e-3)); - test(STR("-1#234567E-02"), STR("{:.6LE}"), F(-1.234567e-2)); - test(STR("-1#234567E-01"), STR("{:.6LE}"), F(-1.234567e-1)); - test(STR("-1#234567E+00"), STR("{:.6LE}"), F(-1.234567e0)); - test(STR("-1#234567E+01"), STR("{:.6LE}"), F(-1.234567e1)); - test(STR("-1#234567E+02"), STR("{:.6LE}"), F(-1.234567e2)); - test(STR("-1#234567E+03"), STR("{:.6LE}"), F(-1.234567e3)); - test(STR("-1#234567E+20"), STR("{:.6LE}"), F(-1.234567e20)); - - test(STR("1.234567E-03"), en_US, STR("{:.6LE}"), F(1.234567e-3)); - test(STR("1.234567E-02"), en_US, STR("{:.6LE}"), F(1.234567e-2)); - test(STR("1.234567E-01"), en_US, STR("{:.6LE}"), F(1.234567e-1)); - test(STR("1.234567E+00"), en_US, STR("{:.6LE}"), F(1.234567e0)); - test(STR("1.234567E+01"), en_US, STR("{:.6LE}"), F(1.234567e1)); - test(STR("1.234567E+02"), en_US, STR("{:.6LE}"), F(1.234567e2)); - test(STR("1.234567E+03"), en_US, STR("{:.6LE}"), F(1.234567e3)); - test(STR("1.234567E+20"), en_US, STR("{:.6LE}"), F(1.234567e20)); - test(STR("-1.234567E-03"), en_US, STR("{:.6LE}"), F(-1.234567e-3)); - test(STR("-1.234567E-02"), en_US, STR("{:.6LE}"), F(-1.234567e-2)); - test(STR("-1.234567E-01"), en_US, STR("{:.6LE}"), F(-1.234567e-1)); - test(STR("-1.234567E+00"), en_US, STR("{:.6LE}"), F(-1.234567e0)); - test(STR("-1.234567E+01"), en_US, STR("{:.6LE}"), F(-1.234567e1)); - test(STR("-1.234567E+02"), en_US, STR("{:.6LE}"), F(-1.234567e2)); - test(STR("-1.234567E+03"), en_US, STR("{:.6LE}"), F(-1.234567e3)); - test(STR("-1.234567E+20"), en_US, STR("{:.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"), 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(STR("1#234567E-03"), loc, STR("{:.6LE}"), F(1.234567e-3)); - test(STR("1#234567E-02"), loc, STR("{:.6LE}"), F(1.234567e-2)); - test(STR("1#234567E-01"), loc, STR("{:.6LE}"), F(1.234567e-1)); - test(STR("1#234567E+00"), loc, STR("{:.6LE}"), F(1.234567e0)); - test(STR("1#234567E+01"), loc, STR("{:.6LE}"), F(1.234567e1)); - test(STR("1#234567E+02"), loc, STR("{:.6LE}"), F(1.234567e2)); - test(STR("1#234567E+03"), loc, STR("{:.6LE}"), F(1.234567e3)); - test(STR("1#234567E+20"), loc, STR("{:.6LE}"), F(1.234567e20)); - test(STR("-1#234567E-03"), loc, STR("{:.6LE}"), F(-1.234567e-3)); - test(STR("-1#234567E-02"), loc, STR("{:.6LE}"), F(-1.234567e-2)); - test(STR("-1#234567E-01"), loc, STR("{:.6LE}"), F(-1.234567e-1)); - test(STR("-1#234567E+00"), loc, STR("{:.6LE}"), F(-1.234567e0)); - test(STR("-1#234567E+01"), loc, STR("{:.6LE}"), F(-1.234567e1)); - test(STR("-1#234567E+02"), loc, STR("{:.6LE}"), F(-1.234567e2)); - test(STR("-1#234567E+03"), loc, STR("{:.6LE}"), F(-1.234567e3)); - test(STR("-1#234567E+20"), loc, STR("{:.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)); + 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(STR("1.234567E+03$$$"), STR("{:$<15.6LE}"), F(1.234567e3)); - test(STR("$$$1.234567E+03"), STR("{:$>15.6LE}"), F(1.234567e3)); - test(STR("$1.234567E+03$$"), STR("{:$^15.6LE}"), F(1.234567e3)); - test(STR("0001.234567E+03"), STR("{:015.6LE}"), F(1.234567e3)); - test(STR("-1.234567E+03$$$"), STR("{:$<16.6LE}"), F(-1.234567e3)); - test(STR("$$$-1.234567E+03"), STR("{:$>16.6LE}"), F(-1.234567e3)); - test(STR("$-1.234567E+03$$"), STR("{:$^16.6LE}"), F(-1.234567e3)); - test(STR("-0001.234567E+03"), STR("{:016.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("$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(STR("1#234567E+03$$$"), STR("{:$<15.6LE}"), F(1.234567e3)); - test(STR("$$$1#234567E+03"), STR("{:$>15.6LE}"), F(1.234567e3)); - test(STR("$1#234567E+03$$"), STR("{:$^15.6LE}"), F(1.234567e3)); - test(STR("0001#234567E+03"), STR("{:015.6LE}"), F(1.234567e3)); - test(STR("-1#234567E+03$$$"), STR("{:$<16.6LE}"), F(-1.234567e3)); - test(STR("$$$-1#234567E+03"), STR("{:$>16.6LE}"), F(-1.234567e3)); - test(STR("$-1#234567E+03$$"), STR("{:$^16.6LE}"), F(-1.234567e3)); - test(STR("-0001#234567E+03"), STR("{:016.6LE}"), F(-1.234567e3)); - - test(STR("1.234567E+03$$$"), en_US, STR("{:$<15.6LE}"), F(1.234567e3)); - test(STR("$$$1.234567E+03"), en_US, STR("{:$>15.6LE}"), F(1.234567e3)); - test(STR("$1.234567E+03$$"), en_US, STR("{:$^15.6LE}"), F(1.234567e3)); - test(STR("0001.234567E+03"), en_US, STR("{:015.6LE}"), F(1.234567e3)); - test(STR("-1.234567E+03$$$"), en_US, STR("{:$<16.6LE}"), F(-1.234567e3)); - test(STR("$$$-1.234567E+03"), en_US, STR("{:$>16.6LE}"), F(-1.234567e3)); - test(STR("$-1.234567E+03$$"), en_US, STR("{:$^16.6LE}"), F(-1.234567e3)); - test(STR("-0001.234567E+03"), en_US, STR("{:016.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("$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(STR("1#234567E+03$$$"), loc, STR("{:$<15.6LE}"), F(1.234567e3)); - test(STR("$$$1#234567E+03"), loc, STR("{:$>15.6LE}"), F(1.234567e3)); - test(STR("$1#234567E+03$$"), loc, STR("{:$^15.6LE}"), F(1.234567e3)); - test(STR("0001#234567E+03"), loc, STR("{:015.6LE}"), F(1.234567e3)); - test(STR("-1#234567E+03$$$"), loc, STR("{:$<16.6LE}"), F(-1.234567e3)); - test(STR("$$$-1#234567E+03"), loc, STR("{:$>16.6LE}"), F(-1.234567e3)); - test(STR("$-1#234567E+03$$"), loc, STR("{:$^16.6LE}"), F(-1.234567e3)); - test(STR("-0001#234567E+03"), loc, STR("{:016.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("$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 +1189,188 @@ void test_floating_point_fixed_lower_case() { // *** Basic *** std::locale::global(en_US); - test(STR("0.000001"), STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0.000012"), STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0.000123"), STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0.001235"), STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0.012346"), STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0.123457"), STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1.234567"), STR("{:.6Lf}"), F(1.234567e0)); - test(STR("12.345670"), STR("{:.6Lf}"), 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(STR("123.456700"), STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1,234.567000"), STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12,345.670000"), STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123,456.700000"), STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1,234,567.000000"), STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12,345,670.000000"), STR("{:.6Lf}"), F(1.234567e7)); - test(STR("123,456,700,000,000,000,000.000000"), STR("{:.6Lf}"), 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(STR("-0.000001"), STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0.000012"), STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0.000123"), STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0.001235"), STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0.012346"), STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0.123457"), STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1.234567"), STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-12.345670"), STR("{:.6Lf}"), 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(STR("-123.456700"), STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1,234.567000"), STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12,345.670000"), STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123,456.700000"), STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1,234,567.000000"), STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12,345,670.000000"), STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-123,456,700,000,000,000,000.000000"), STR("{:.6Lf}"), 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(STR("0#000001"), STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0#000012"), STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0#000123"), STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0#001235"), STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0#012346"), STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0#123457"), STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1#234567"), STR("{:.6Lf}"), F(1.234567e0)); - test(STR("1_2#345670"), STR("{:.6Lf}"), 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(STR("12_3#456700"), STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1_23_4#567000"), STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12_34_5#670000"), STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123_45_6#700000"), STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1_234_56_7#000000"), STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12_345_67_0#000000"), STR("{:.6Lf}"), F(1.234567e7)); - test(STR("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), STR("{:.6Lf}"), 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(STR("-0#000001"), STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0#000012"), STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0#000123"), STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0#001235"), STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0#012346"), STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0#123457"), STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1#234567"), STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-1_2#345670"), STR("{:.6Lf}"), 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(STR("-12_3#456700"), STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1_23_4#567000"), STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12_34_5#670000"), STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123_45_6#700000"), STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1_234_56_7#000000"), STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12_345_67_0#000000"), STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), STR("{:.6Lf}"), 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(STR("0.000001"), en_US, STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0.000012"), en_US, STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0.000123"), en_US, STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0.001235"), en_US, STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0.012346"), en_US, STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0.123457"), en_US, STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1.234567"), en_US, STR("{:.6Lf}"), F(1.234567e0)); - test(STR("12.345670"), en_US, STR("{:.6Lf}"), 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(STR("123.456700"), en_US, STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1,234.567000"), en_US, STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12,345.670000"), en_US, STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123,456.700000"), en_US, STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1,234,567.000000"), en_US, STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12,345,670.000000"), en_US, STR("{:.6Lf}"), F(1.234567e7)); - test(STR("123,456,700,000,000,000,000.000000"), en_US, STR("{:.6Lf}"), 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(STR("-0.000001"), en_US, STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0.000012"), en_US, STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0.000123"), en_US, STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0.001235"), en_US, STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0.012346"), en_US, STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0.123457"), en_US, STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1.234567"), en_US, STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-12.345670"), en_US, STR("{:.6Lf}"), 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(STR("-123.456700"), en_US, STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1,234.567000"), en_US, STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12,345.670000"), en_US, STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123,456.700000"), en_US, STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1,234,567.000000"), en_US, STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12,345,670.000000"), en_US, STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-123,456,700,000,000,000,000.000000"), en_US, STR("{:.6Lf}"), 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(STR("0#000001"), loc, STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0#000012"), loc, STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0#000123"), loc, STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0#001235"), loc, STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0#012346"), loc, STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0#123457"), loc, STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1#234567"), loc, STR("{:.6Lf}"), F(1.234567e0)); - test(STR("1_2#345670"), loc, STR("{:.6Lf}"), 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(STR("12_3#456700"), loc, STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1_23_4#567000"), loc, STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12_34_5#670000"), loc, STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123_45_6#700000"), loc, STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1_234_56_7#000000"), loc, STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12_345_67_0#000000"), loc, STR("{:.6Lf}"), F(1.234567e7)); - test(STR("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, STR("{:.6Lf}"), 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(STR("-0#000001"), loc, STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0#000012"), loc, STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0#000123"), loc, STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0#001235"), loc, STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0#012346"), loc, STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0#123457"), loc, STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1#234567"), loc, STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-1_2#345670"), loc, STR("{:.6Lf}"), 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(STR("-12_3#456700"), loc, STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1_23_4#567000"), loc, STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12_34_5#670000"), loc, STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123_45_6#700000"), loc, STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1_234_56_7#000000"), loc, STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12_345_67_0#000000"), loc, STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, STR("{:.6Lf}"), 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(STR("1,234.567000$$$"), STR("{:$<15.6Lf}"), F(1.234567e3)); - test(STR("$$$1,234.567000"), STR("{:$>15.6Lf}"), F(1.234567e3)); - test(STR("$1,234.567000$$"), STR("{:$^15.6Lf}"), F(1.234567e3)); - test(STR("0001,234.567000"), STR("{:015.6Lf}"), F(1.234567e3)); - test(STR("-1,234.567000$$$"), STR("{:$<16.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1,234.567000"), STR("{:$>16.6Lf}"), F(-1.234567e3)); - test(STR("$-1,234.567000$$"), STR("{:$^16.6Lf}"), F(-1.234567e3)); - test(STR("-0001,234.567000"), STR("{:016.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("$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(STR("1_23_4#567000$$$"), STR("{:$<16.6Lf}"), F(1.234567e3)); - test(STR("$$$1_23_4#567000"), STR("{:$>16.6Lf}"), F(1.234567e3)); - test(STR("$1_23_4#567000$$"), STR("{:$^16.6Lf}"), F(1.234567e3)); - test(STR("0001_23_4#567000"), STR("{:016.6Lf}"), F(1.234567e3)); - test(STR("-1_23_4#567000$$$"), STR("{:$<17.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567000"), STR("{:$>17.6Lf}"), F(-1.234567e3)); - test(STR("$-1_23_4#567000$$"), STR("{:$^17.6Lf}"), F(-1.234567e3)); - test(STR("-0001_23_4#567000"), STR("{:017.6Lf}"), F(-1.234567e3)); - - test(STR("1,234.567000$$$"), en_US, STR("{:$<15.6Lf}"), F(1.234567e3)); - test(STR("$$$1,234.567000"), en_US, STR("{:$>15.6Lf}"), F(1.234567e3)); - test(STR("$1,234.567000$$"), en_US, STR("{:$^15.6Lf}"), F(1.234567e3)); - test(STR("0001,234.567000"), en_US, STR("{:015.6Lf}"), F(1.234567e3)); - test(STR("-1,234.567000$$$"), en_US, STR("{:$<16.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1,234.567000"), en_US, STR("{:$>16.6Lf}"), F(-1.234567e3)); - test(STR("$-1,234.567000$$"), en_US, STR("{:$^16.6Lf}"), F(-1.234567e3)); - test(STR("-0001,234.567000"), en_US, STR("{:016.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("$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(STR("1_23_4#567000$$$"), loc, STR("{:$<16.6Lf}"), F(1.234567e3)); - test(STR("$$$1_23_4#567000"), loc, STR("{:$>16.6Lf}"), F(1.234567e3)); - test(STR("$1_23_4#567000$$"), loc, STR("{:$^16.6Lf}"), F(1.234567e3)); - test(STR("0001_23_4#567000"), loc, STR("{:016.6Lf}"), F(1.234567e3)); - test(STR("-1_23_4#567000$$$"), loc, STR("{:$<17.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567000"), loc, STR("{:$>17.6Lf}"), F(-1.234567e3)); - test(STR("$-1_23_4#567000$$"), loc, STR("{:$^17.6Lf}"), F(-1.234567e3)); - test(STR("-0001_23_4#567000"), loc, STR("{:017.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("$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 +1381,188 @@ void test_floating_point_fixed_upper_case() { // *** Basic *** std::locale::global(en_US); - test(STR("0.000001"), STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0.000012"), STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0.000123"), STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0.001235"), STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0.012346"), STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0.123457"), STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1.234567"), STR("{:.6Lf}"), F(1.234567e0)); - test(STR("12.345670"), STR("{:.6Lf}"), 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(STR("123.456700"), STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1,234.567000"), STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12,345.670000"), STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123,456.700000"), STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1,234,567.000000"), STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12,345,670.000000"), STR("{:.6Lf}"), F(1.234567e7)); - test(STR("123,456,700,000,000,000,000.000000"), STR("{:.6Lf}"), 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(STR("-0.000001"), STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0.000012"), STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0.000123"), STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0.001235"), STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0.012346"), STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0.123457"), STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1.234567"), STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-12.345670"), STR("{:.6Lf}"), 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(STR("-123.456700"), STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1,234.567000"), STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12,345.670000"), STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123,456.700000"), STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1,234,567.000000"), STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12,345,670.000000"), STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-123,456,700,000,000,000,000.000000"), STR("{:.6Lf}"), 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(STR("0#000001"), STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0#000012"), STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0#000123"), STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0#001235"), STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0#012346"), STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0#123457"), STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1#234567"), STR("{:.6Lf}"), F(1.234567e0)); - test(STR("1_2#345670"), STR("{:.6Lf}"), 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(STR("12_3#456700"), STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1_23_4#567000"), STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12_34_5#670000"), STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123_45_6#700000"), STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1_234_56_7#000000"), STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12_345_67_0#000000"), STR("{:.6Lf}"), F(1.234567e7)); - test(STR("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), STR("{:.6Lf}"), 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(STR("-0#000001"), STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0#000012"), STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0#000123"), STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0#001235"), STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0#012346"), STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0#123457"), STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1#234567"), STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-1_2#345670"), STR("{:.6Lf}"), 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(STR("-12_3#456700"), STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1_23_4#567000"), STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12_34_5#670000"), STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123_45_6#700000"), STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1_234_56_7#000000"), STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12_345_67_0#000000"), STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), STR("{:.6Lf}"), 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(STR("0.000001"), en_US, STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0.000012"), en_US, STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0.000123"), en_US, STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0.001235"), en_US, STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0.012346"), en_US, STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0.123457"), en_US, STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1.234567"), en_US, STR("{:.6Lf}"), F(1.234567e0)); - test(STR("12.345670"), en_US, STR("{:.6Lf}"), 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(STR("123.456700"), en_US, STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1,234.567000"), en_US, STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12,345.670000"), en_US, STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123,456.700000"), en_US, STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1,234,567.000000"), en_US, STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12,345,670.000000"), en_US, STR("{:.6Lf}"), F(1.234567e7)); - test(STR("123,456,700,000,000,000,000.000000"), en_US, STR("{:.6Lf}"), 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(STR("-0.000001"), en_US, STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0.000012"), en_US, STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0.000123"), en_US, STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0.001235"), en_US, STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0.012346"), en_US, STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0.123457"), en_US, STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1.234567"), en_US, STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-12.345670"), en_US, STR("{:.6Lf}"), 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(STR("-123.456700"), en_US, STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1,234.567000"), en_US, STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12,345.670000"), en_US, STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123,456.700000"), en_US, STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1,234,567.000000"), en_US, STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12,345,670.000000"), en_US, STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-123,456,700,000,000,000,000.000000"), en_US, STR("{:.6Lf}"), 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(STR("0#000001"), loc, STR("{:.6Lf}"), F(1.234567e-6)); - test(STR("0#000012"), loc, STR("{:.6Lf}"), F(1.234567e-5)); - test(STR("0#000123"), loc, STR("{:.6Lf}"), F(1.234567e-4)); - test(STR("0#001235"), loc, STR("{:.6Lf}"), F(1.234567e-3)); - test(STR("0#012346"), loc, STR("{:.6Lf}"), F(1.234567e-2)); - test(STR("0#123457"), loc, STR("{:.6Lf}"), F(1.234567e-1)); - test(STR("1#234567"), loc, STR("{:.6Lf}"), F(1.234567e0)); - test(STR("1_2#345670"), loc, STR("{:.6Lf}"), 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(STR("12_3#456700"), loc, STR("{:.6Lf}"), F(1.234567e2)); - test(STR("1_23_4#567000"), loc, STR("{:.6Lf}"), F(1.234567e3)); - test(STR("12_34_5#670000"), loc, STR("{:.6Lf}"), F(1.234567e4)); - test(STR("123_45_6#700000"), loc, STR("{:.6Lf}"), F(1.234567e5)); - test(STR("1_234_56_7#000000"), loc, STR("{:.6Lf}"), F(1.234567e6)); - test(STR("12_345_67_0#000000"), loc, STR("{:.6Lf}"), F(1.234567e7)); - test(STR("1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, STR("{:.6Lf}"), 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(STR("-0#000001"), loc, STR("{:.6Lf}"), F(-1.234567e-6)); - test(STR("-0#000012"), loc, STR("{:.6Lf}"), F(-1.234567e-5)); - test(STR("-0#000123"), loc, STR("{:.6Lf}"), F(-1.234567e-4)); - test(STR("-0#001235"), loc, STR("{:.6Lf}"), F(-1.234567e-3)); - test(STR("-0#012346"), loc, STR("{:.6Lf}"), F(-1.234567e-2)); - test(STR("-0#123457"), loc, STR("{:.6Lf}"), F(-1.234567e-1)); - test(STR("-1#234567"), loc, STR("{:.6Lf}"), F(-1.234567e0)); - test(STR("-1_2#345670"), loc, STR("{:.6Lf}"), 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(STR("-12_3#456700"), loc, STR("{:.6Lf}"), F(-1.234567e2)); - test(STR("-1_23_4#567000"), loc, STR("{:.6Lf}"), F(-1.234567e3)); - test(STR("-12_34_5#670000"), loc, STR("{:.6Lf}"), F(-1.234567e4)); - test(STR("-123_45_6#700000"), loc, STR("{:.6Lf}"), F(-1.234567e5)); - test(STR("-1_234_56_7#000000"), loc, STR("{:.6Lf}"), F(-1.234567e6)); - test(STR("-12_345_67_0#000000"), loc, STR("{:.6Lf}"), F(-1.234567e7)); - test(STR("-1_2_3_4_5_6_7_0_0_0_0_0_0_00_000_00_0#000000"), loc, STR("{:.6Lf}"), 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(STR("1,234.567000$$$"), STR("{:$<15.6Lf}"), F(1.234567e3)); - test(STR("$$$1,234.567000"), STR("{:$>15.6Lf}"), F(1.234567e3)); - test(STR("$1,234.567000$$"), STR("{:$^15.6Lf}"), F(1.234567e3)); - test(STR("0001,234.567000"), STR("{:015.6Lf}"), F(1.234567e3)); - test(STR("-1,234.567000$$$"), STR("{:$<16.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1,234.567000"), STR("{:$>16.6Lf}"), F(-1.234567e3)); - test(STR("$-1,234.567000$$"), STR("{:$^16.6Lf}"), F(-1.234567e3)); - test(STR("-0001,234.567000"), STR("{:016.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("$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(STR("1_23_4#567000$$$"), STR("{:$<16.6Lf}"), F(1.234567e3)); - test(STR("$$$1_23_4#567000"), STR("{:$>16.6Lf}"), F(1.234567e3)); - test(STR("$1_23_4#567000$$"), STR("{:$^16.6Lf}"), F(1.234567e3)); - test(STR("0001_23_4#567000"), STR("{:016.6Lf}"), F(1.234567e3)); - test(STR("-1_23_4#567000$$$"), STR("{:$<17.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567000"), STR("{:$>17.6Lf}"), F(-1.234567e3)); - test(STR("$-1_23_4#567000$$"), STR("{:$^17.6Lf}"), F(-1.234567e3)); - test(STR("-0001_23_4#567000"), STR("{:017.6Lf}"), F(-1.234567e3)); - - test(STR("1,234.567000$$$"), en_US, STR("{:$<15.6Lf}"), F(1.234567e3)); - test(STR("$$$1,234.567000"), en_US, STR("{:$>15.6Lf}"), F(1.234567e3)); - test(STR("$1,234.567000$$"), en_US, STR("{:$^15.6Lf}"), F(1.234567e3)); - test(STR("0001,234.567000"), en_US, STR("{:015.6Lf}"), F(1.234567e3)); - test(STR("-1,234.567000$$$"), en_US, STR("{:$<16.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1,234.567000"), en_US, STR("{:$>16.6Lf}"), F(-1.234567e3)); - test(STR("$-1,234.567000$$"), en_US, STR("{:$^16.6Lf}"), F(-1.234567e3)); - test(STR("-0001,234.567000"), en_US, STR("{:016.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("$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(STR("1_23_4#567000$$$"), loc, STR("{:$<16.6Lf}"), F(1.234567e3)); - test(STR("$$$1_23_4#567000"), loc, STR("{:$>16.6Lf}"), F(1.234567e3)); - test(STR("$1_23_4#567000$$"), loc, STR("{:$^16.6Lf}"), F(1.234567e3)); - test(STR("0001_23_4#567000"), loc, STR("{:016.6Lf}"), F(1.234567e3)); - test(STR("-1_23_4#567000$$$"), loc, STR("{:$<17.6Lf}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567000"), loc, STR("{:$>17.6Lf}"), F(-1.234567e3)); - test(STR("$-1_23_4#567000$$"), loc, STR("{:$^17.6Lf}"), F(-1.234567e3)); - test(STR("-0001_23_4#567000"), loc, STR("{:017.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("$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 +1573,163 @@ void test_floating_point_general_lower_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.23457e-06"), STR("{:.6Lg}"), F(1.234567e-6)); - test(STR("1.23457e-05"), STR("{:.6Lg}"), F(1.234567e-5)); - test(STR("0.000123457"), STR("{:.6Lg}"), F(1.234567e-4)); - test(STR("0.00123457"), STR("{:.6Lg}"), F(1.234567e-3)); - test(STR("0.0123457"), STR("{:.6Lg}"), F(1.234567e-2)); - test(STR("0.123457"), STR("{:.6Lg}"), F(1.234567e-1)); - test(STR("1.23457"), STR("{:.6Lg}"), F(1.234567e0)); - test(STR("12.3457"), STR("{:.6Lg}"), F(1.234567e1)); - test(STR("123.457"), STR("{:.6Lg}"), F(1.234567e2)); - test(STR("1,234.57"), STR("{:.6Lg}"), F(1.234567e3)); - test(STR("12,345.7"), STR("{:.6Lg}"), F(1.234567e4)); - test(STR("123,457"), STR("{:.6Lg}"), F(1.234567e5)); - test(STR("1.23457e+06"), STR("{:.6Lg}"), F(1.234567e6)); - test(STR("1.23457e+07"), STR("{:.6Lg}"), F(1.234567e7)); - test(STR("-1.23457e-06"), STR("{:.6Lg}"), F(-1.234567e-6)); - test(STR("-1.23457e-05"), STR("{:.6Lg}"), F(-1.234567e-5)); - test(STR("-0.000123457"), STR("{:.6Lg}"), F(-1.234567e-4)); - test(STR("-0.00123457"), STR("{:.6Lg}"), F(-1.234567e-3)); - test(STR("-0.0123457"), STR("{:.6Lg}"), F(-1.234567e-2)); - test(STR("-0.123457"), STR("{:.6Lg}"), F(-1.234567e-1)); - test(STR("-1.23457"), STR("{:.6Lg}"), F(-1.234567e0)); - test(STR("-12.3457"), STR("{:.6Lg}"), F(-1.234567e1)); - test(STR("-123.457"), STR("{:.6Lg}"), F(-1.234567e2)); - test(STR("-1,234.57"), STR("{:.6Lg}"), F(-1.234567e3)); - test(STR("-12,345.7"), STR("{:.6Lg}"), F(-1.234567e4)); - test(STR("-123,457"), STR("{:.6Lg}"), F(-1.234567e5)); - test(STR("-1.23457e+06"), STR("{:.6Lg}"), F(-1.234567e6)); - test(STR("-1.23457e+07"), STR("{:.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)); + 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(STR("1#23457e-06"), STR("{:.6Lg}"), F(1.234567e-6)); - test(STR("1#23457e-05"), STR("{:.6Lg}"), F(1.234567e-5)); - test(STR("0#000123457"), STR("{:.6Lg}"), F(1.234567e-4)); - test(STR("0#00123457"), STR("{:.6Lg}"), F(1.234567e-3)); - test(STR("0#0123457"), STR("{:.6Lg}"), F(1.234567e-2)); - test(STR("0#123457"), STR("{:.6Lg}"), F(1.234567e-1)); - test(STR("1#23457"), STR("{:.6Lg}"), F(1.234567e0)); - test(STR("1_2#3457"), STR("{:.6Lg}"), F(1.234567e1)); - test(STR("12_3#457"), STR("{:.6Lg}"), F(1.234567e2)); - test(STR("1_23_4#57"), STR("{:.6Lg}"), F(1.234567e3)); - test(STR("12_34_5#7"), STR("{:.6Lg}"), F(1.234567e4)); - test(STR("123_45_7"), STR("{:.6Lg}"), F(1.234567e5)); - test(STR("1#23457e+06"), STR("{:.6Lg}"), F(1.234567e6)); - test(STR("1#23457e+07"), STR("{:.6Lg}"), F(1.234567e7)); - test(STR("-1#23457e-06"), STR("{:.6Lg}"), F(-1.234567e-6)); - test(STR("-1#23457e-05"), STR("{:.6Lg}"), F(-1.234567e-5)); - test(STR("-0#000123457"), STR("{:.6Lg}"), F(-1.234567e-4)); - test(STR("-0#00123457"), STR("{:.6Lg}"), F(-1.234567e-3)); - test(STR("-0#0123457"), STR("{:.6Lg}"), F(-1.234567e-2)); - test(STR("-0#123457"), STR("{:.6Lg}"), F(-1.234567e-1)); - test(STR("-1#23457"), STR("{:.6Lg}"), F(-1.234567e0)); - test(STR("-1_2#3457"), STR("{:.6Lg}"), F(-1.234567e1)); - test(STR("-12_3#457"), STR("{:.6Lg}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), STR("{:.6Lg}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), STR("{:.6Lg}"), F(-1.234567e4)); - test(STR("-123_45_7"), STR("{:.6Lg}"), F(-1.234567e5)); - test(STR("-1#23457e+06"), STR("{:.6Lg}"), F(-1.234567e6)); - test(STR("-1#23457e+07"), STR("{:.6Lg}"), F(-1.234567e7)); - - test(STR("1.23457e-06"), en_US, STR("{:.6Lg}"), F(1.234567e-6)); - test(STR("1.23457e-05"), en_US, STR("{:.6Lg}"), F(1.234567e-5)); - test(STR("0.000123457"), en_US, STR("{:.6Lg}"), F(1.234567e-4)); - test(STR("0.00123457"), en_US, STR("{:.6Lg}"), F(1.234567e-3)); - test(STR("0.0123457"), en_US, STR("{:.6Lg}"), F(1.234567e-2)); - test(STR("0.123457"), en_US, STR("{:.6Lg}"), F(1.234567e-1)); - test(STR("1.23457"), en_US, STR("{:.6Lg}"), F(1.234567e0)); - test(STR("12.3457"), en_US, STR("{:.6Lg}"), F(1.234567e1)); - test(STR("123.457"), en_US, STR("{:.6Lg}"), F(1.234567e2)); - test(STR("1,234.57"), en_US, STR("{:.6Lg}"), F(1.234567e3)); - test(STR("12,345.7"), en_US, STR("{:.6Lg}"), F(1.234567e4)); - test(STR("123,457"), en_US, STR("{:.6Lg}"), F(1.234567e5)); - test(STR("1.23457e+06"), en_US, STR("{:.6Lg}"), F(1.234567e6)); - test(STR("1.23457e+07"), en_US, STR("{:.6Lg}"), F(1.234567e7)); - test(STR("-1.23457e-06"), en_US, STR("{:.6Lg}"), F(-1.234567e-6)); - test(STR("-1.23457e-05"), en_US, STR("{:.6Lg}"), F(-1.234567e-5)); - test(STR("-0.000123457"), en_US, STR("{:.6Lg}"), F(-1.234567e-4)); - test(STR("-0.00123457"), en_US, STR("{:.6Lg}"), F(-1.234567e-3)); - test(STR("-0.0123457"), en_US, STR("{:.6Lg}"), F(-1.234567e-2)); - test(STR("-0.123457"), en_US, STR("{:.6Lg}"), F(-1.234567e-1)); - test(STR("-1.23457"), en_US, STR("{:.6Lg}"), F(-1.234567e0)); - test(STR("-12.3457"), en_US, STR("{:.6Lg}"), F(-1.234567e1)); - test(STR("-123.457"), en_US, STR("{:.6Lg}"), F(-1.234567e2)); - test(STR("-1,234.57"), en_US, STR("{:.6Lg}"), F(-1.234567e3)); - test(STR("-12,345.7"), en_US, STR("{:.6Lg}"), F(-1.234567e4)); - test(STR("-123,457"), en_US, STR("{:.6Lg}"), F(-1.234567e5)); - test(STR("-1.23457e+06"), en_US, STR("{:.6Lg}"), F(-1.234567e6)); - test(STR("-1.23457e+07"), en_US, STR("{:.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"), 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(STR("1#23457e-06"), loc, STR("{:.6Lg}"), F(1.234567e-6)); - test(STR("1#23457e-05"), loc, STR("{:.6Lg}"), F(1.234567e-5)); - test(STR("0#000123457"), loc, STR("{:.6Lg}"), F(1.234567e-4)); - test(STR("0#00123457"), loc, STR("{:.6Lg}"), F(1.234567e-3)); - test(STR("0#0123457"), loc, STR("{:.6Lg}"), F(1.234567e-2)); - test(STR("0#123457"), loc, STR("{:.6Lg}"), F(1.234567e-1)); - test(STR("1#23457"), loc, STR("{:.6Lg}"), F(1.234567e0)); - test(STR("1_2#3457"), loc, STR("{:.6Lg}"), F(1.234567e1)); - test(STR("12_3#457"), loc, STR("{:.6Lg}"), F(1.234567e2)); - test(STR("1_23_4#57"), loc, STR("{:.6Lg}"), F(1.234567e3)); - test(STR("12_34_5#7"), loc, STR("{:.6Lg}"), F(1.234567e4)); - test(STR("123_45_7"), loc, STR("{:.6Lg}"), F(1.234567e5)); - test(STR("1#23457e+06"), loc, STR("{:.6Lg}"), F(1.234567e6)); - test(STR("1#23457e+07"), loc, STR("{:.6Lg}"), F(1.234567e7)); - test(STR("-1#23457e-06"), loc, STR("{:.6Lg}"), F(-1.234567e-6)); - test(STR("-1#23457e-05"), loc, STR("{:.6Lg}"), F(-1.234567e-5)); - test(STR("-0#000123457"), loc, STR("{:.6Lg}"), F(-1.234567e-4)); - test(STR("-0#00123457"), loc, STR("{:.6Lg}"), F(-1.234567e-3)); - test(STR("-0#0123457"), loc, STR("{:.6Lg}"), F(-1.234567e-2)); - test(STR("-0#123457"), loc, STR("{:.6Lg}"), F(-1.234567e-1)); - test(STR("-1#23457"), loc, STR("{:.6Lg}"), F(-1.234567e0)); - test(STR("-1_2#3457"), loc, STR("{:.6Lg}"), F(-1.234567e1)); - test(STR("-12_3#457"), loc, STR("{:.6Lg}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), loc, STR("{:.6Lg}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), loc, STR("{:.6Lg}"), F(-1.234567e4)); - test(STR("-123_45_7"), loc, STR("{:.6Lg}"), F(-1.234567e5)); - test(STR("-1#23457e+06"), loc, STR("{:.6Lg}"), F(-1.234567e6)); - test(STR("-1#23457e+07"), loc, STR("{:.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)); + 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(STR("1,234.57$$$"), STR("{:$<11.6Lg}"), F(1.234567e3)); - test(STR("$$$1,234.57"), STR("{:$>11.6Lg}"), F(1.234567e3)); - test(STR("$1,234.57$$"), STR("{:$^11.6Lg}"), F(1.234567e3)); - test(STR("0001,234.57"), STR("{:011.6Lg}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), STR("{:$<12.6Lg}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), STR("{:$>12.6Lg}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), STR("{:$^12.6Lg}"), F(-1.234567e3)); - test(STR("-0001,234.57"), STR("{:012.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("$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(STR("1_23_4#57$$$"), STR("{:$<12.6Lg}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), STR("{:$>12.6Lg}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), STR("{:$^12.6Lg}"), F(1.234567e3)); - test(STR("0001_23_4#57"), STR("{:012.6Lg}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), STR("{:$<13.6Lg}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), STR("{:$>13.6Lg}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), STR("{:$^13.6Lg}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), STR("{:013.6Lg}"), F(-1.234567e3)); - - test(STR("1,234.57$$$"), en_US, STR("{:$<11.6Lg}"), F(1.234567e3)); - test(STR("$$$1,234.57"), en_US, STR("{:$>11.6Lg}"), F(1.234567e3)); - test(STR("$1,234.57$$"), en_US, STR("{:$^11.6Lg}"), F(1.234567e3)); - test(STR("0001,234.57"), en_US, STR("{:011.6Lg}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), en_US, STR("{:$<12.6Lg}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), en_US, STR("{:$>12.6Lg}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), en_US, STR("{:$^12.6Lg}"), F(-1.234567e3)); - test(STR("-0001,234.57"), en_US, STR("{:012.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("$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(STR("1_23_4#57$$$"), loc, STR("{:$<12.6Lg}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), loc, STR("{:$>12.6Lg}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), loc, STR("{:$^12.6Lg}"), F(1.234567e3)); - test(STR("0001_23_4#57"), loc, STR("{:012.6Lg}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), loc, STR("{:$<13.6Lg}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), loc, STR("{:$>13.6Lg}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), loc, STR("{:$^13.6Lg}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), loc, STR("{:013.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("$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 +1739,163 @@ void test_floating_point_general_upper_case() { // *** Basic *** std::locale::global(en_US); - test(STR("1.23457E-06"), STR("{:.6LG}"), F(1.234567e-6)); - test(STR("1.23457E-05"), STR("{:.6LG}"), F(1.234567e-5)); - test(STR("0.000123457"), STR("{:.6LG}"), F(1.234567e-4)); - test(STR("0.00123457"), STR("{:.6LG}"), F(1.234567e-3)); - test(STR("0.0123457"), STR("{:.6LG}"), F(1.234567e-2)); - test(STR("0.123457"), STR("{:.6LG}"), F(1.234567e-1)); - test(STR("1.23457"), STR("{:.6LG}"), F(1.234567e0)); - test(STR("12.3457"), STR("{:.6LG}"), F(1.234567e1)); - test(STR("123.457"), STR("{:.6LG}"), F(1.234567e2)); - test(STR("1,234.57"), STR("{:.6LG}"), F(1.234567e3)); - test(STR("12,345.7"), STR("{:.6LG}"), F(1.234567e4)); - test(STR("123,457"), STR("{:.6LG}"), F(1.234567e5)); - test(STR("1.23457E+06"), STR("{:.6LG}"), F(1.234567e6)); - test(STR("1.23457E+07"), STR("{:.6LG}"), F(1.234567e7)); - test(STR("-1.23457E-06"), STR("{:.6LG}"), F(-1.234567e-6)); - test(STR("-1.23457E-05"), STR("{:.6LG}"), F(-1.234567e-5)); - test(STR("-0.000123457"), STR("{:.6LG}"), F(-1.234567e-4)); - test(STR("-0.00123457"), STR("{:.6LG}"), F(-1.234567e-3)); - test(STR("-0.0123457"), STR("{:.6LG}"), F(-1.234567e-2)); - test(STR("-0.123457"), STR("{:.6LG}"), F(-1.234567e-1)); - test(STR("-1.23457"), STR("{:.6LG}"), F(-1.234567e0)); - test(STR("-12.3457"), STR("{:.6LG}"), F(-1.234567e1)); - test(STR("-123.457"), STR("{:.6LG}"), F(-1.234567e2)); - test(STR("-1,234.57"), STR("{:.6LG}"), F(-1.234567e3)); - test(STR("-12,345.7"), STR("{:.6LG}"), F(-1.234567e4)); - test(STR("-123,457"), STR("{:.6LG}"), F(-1.234567e5)); - test(STR("-1.23457E+06"), STR("{:.6LG}"), F(-1.234567e6)); - test(STR("-1.23457E+07"), STR("{:.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)); + 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(STR("1#23457E-06"), STR("{:.6LG}"), F(1.234567e-6)); - test(STR("1#23457E-05"), STR("{:.6LG}"), F(1.234567e-5)); - test(STR("0#000123457"), STR("{:.6LG}"), F(1.234567e-4)); - test(STR("0#00123457"), STR("{:.6LG}"), F(1.234567e-3)); - test(STR("0#0123457"), STR("{:.6LG}"), F(1.234567e-2)); - test(STR("0#123457"), STR("{:.6LG}"), F(1.234567e-1)); - test(STR("1#23457"), STR("{:.6LG}"), F(1.234567e0)); - test(STR("1_2#3457"), STR("{:.6LG}"), F(1.234567e1)); - test(STR("12_3#457"), STR("{:.6LG}"), F(1.234567e2)); - test(STR("1_23_4#57"), STR("{:.6LG}"), F(1.234567e3)); - test(STR("12_34_5#7"), STR("{:.6LG}"), F(1.234567e4)); - test(STR("123_45_7"), STR("{:.6LG}"), F(1.234567e5)); - test(STR("1#23457E+06"), STR("{:.6LG}"), F(1.234567e6)); - test(STR("1#23457E+07"), STR("{:.6LG}"), F(1.234567e7)); - test(STR("-1#23457E-06"), STR("{:.6LG}"), F(-1.234567e-6)); - test(STR("-1#23457E-05"), STR("{:.6LG}"), F(-1.234567e-5)); - test(STR("-0#000123457"), STR("{:.6LG}"), F(-1.234567e-4)); - test(STR("-0#00123457"), STR("{:.6LG}"), F(-1.234567e-3)); - test(STR("-0#0123457"), STR("{:.6LG}"), F(-1.234567e-2)); - test(STR("-0#123457"), STR("{:.6LG}"), F(-1.234567e-1)); - test(STR("-1#23457"), STR("{:.6LG}"), F(-1.234567e0)); - test(STR("-1_2#3457"), STR("{:.6LG}"), F(-1.234567e1)); - test(STR("-12_3#457"), STR("{:.6LG}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), STR("{:.6LG}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), STR("{:.6LG}"), F(-1.234567e4)); - test(STR("-123_45_7"), STR("{:.6LG}"), F(-1.234567e5)); - test(STR("-1#23457E+06"), STR("{:.6LG}"), F(-1.234567e6)); - test(STR("-1#23457E+07"), STR("{:.6LG}"), F(-1.234567e7)); - - test(STR("1.23457E-06"), en_US, STR("{:.6LG}"), F(1.234567e-6)); - test(STR("1.23457E-05"), en_US, STR("{:.6LG}"), F(1.234567e-5)); - test(STR("0.000123457"), en_US, STR("{:.6LG}"), F(1.234567e-4)); - test(STR("0.00123457"), en_US, STR("{:.6LG}"), F(1.234567e-3)); - test(STR("0.0123457"), en_US, STR("{:.6LG}"), F(1.234567e-2)); - test(STR("0.123457"), en_US, STR("{:.6LG}"), F(1.234567e-1)); - test(STR("1.23457"), en_US, STR("{:.6LG}"), F(1.234567e0)); - test(STR("12.3457"), en_US, STR("{:.6LG}"), F(1.234567e1)); - test(STR("123.457"), en_US, STR("{:.6LG}"), F(1.234567e2)); - test(STR("1,234.57"), en_US, STR("{:.6LG}"), F(1.234567e3)); - test(STR("12,345.7"), en_US, STR("{:.6LG}"), F(1.234567e4)); - test(STR("123,457"), en_US, STR("{:.6LG}"), F(1.234567e5)); - test(STR("1.23457E+06"), en_US, STR("{:.6LG}"), F(1.234567e6)); - test(STR("1.23457E+07"), en_US, STR("{:.6LG}"), F(1.234567e7)); - test(STR("-1.23457E-06"), en_US, STR("{:.6LG}"), F(-1.234567e-6)); - test(STR("-1.23457E-05"), en_US, STR("{:.6LG}"), F(-1.234567e-5)); - test(STR("-0.000123457"), en_US, STR("{:.6LG}"), F(-1.234567e-4)); - test(STR("-0.00123457"), en_US, STR("{:.6LG}"), F(-1.234567e-3)); - test(STR("-0.0123457"), en_US, STR("{:.6LG}"), F(-1.234567e-2)); - test(STR("-0.123457"), en_US, STR("{:.6LG}"), F(-1.234567e-1)); - test(STR("-1.23457"), en_US, STR("{:.6LG}"), F(-1.234567e0)); - test(STR("-12.3457"), en_US, STR("{:.6LG}"), F(-1.234567e1)); - test(STR("-123.457"), en_US, STR("{:.6LG}"), F(-1.234567e2)); - test(STR("-1,234.57"), en_US, STR("{:.6LG}"), F(-1.234567e3)); - test(STR("-12,345.7"), en_US, STR("{:.6LG}"), F(-1.234567e4)); - test(STR("-123,457"), en_US, STR("{:.6LG}"), F(-1.234567e5)); - test(STR("-1.23457E+06"), en_US, STR("{:.6LG}"), F(-1.234567e6)); - test(STR("-1.23457E+07"), en_US, STR("{:.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"), 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(STR("1#23457E-06"), loc, STR("{:.6LG}"), F(1.234567e-6)); - test(STR("1#23457E-05"), loc, STR("{:.6LG}"), F(1.234567e-5)); - test(STR("0#000123457"), loc, STR("{:.6LG}"), F(1.234567e-4)); - test(STR("0#00123457"), loc, STR("{:.6LG}"), F(1.234567e-3)); - test(STR("0#0123457"), loc, STR("{:.6LG}"), F(1.234567e-2)); - test(STR("0#123457"), loc, STR("{:.6LG}"), F(1.234567e-1)); - test(STR("1#23457"), loc, STR("{:.6LG}"), F(1.234567e0)); - test(STR("1_2#3457"), loc, STR("{:.6LG}"), F(1.234567e1)); - test(STR("12_3#457"), loc, STR("{:.6LG}"), F(1.234567e2)); - test(STR("1_23_4#57"), loc, STR("{:.6LG}"), F(1.234567e3)); - test(STR("12_34_5#7"), loc, STR("{:.6LG}"), F(1.234567e4)); - test(STR("123_45_7"), loc, STR("{:.6LG}"), F(1.234567e5)); - test(STR("1#23457E+06"), loc, STR("{:.6LG}"), F(1.234567e6)); - test(STR("1#23457E+07"), loc, STR("{:.6LG}"), F(1.234567e7)); - test(STR("-1#23457E-06"), loc, STR("{:.6LG}"), F(-1.234567e-6)); - test(STR("-1#23457E-05"), loc, STR("{:.6LG}"), F(-1.234567e-5)); - test(STR("-0#000123457"), loc, STR("{:.6LG}"), F(-1.234567e-4)); - test(STR("-0#00123457"), loc, STR("{:.6LG}"), F(-1.234567e-3)); - test(STR("-0#0123457"), loc, STR("{:.6LG}"), F(-1.234567e-2)); - test(STR("-0#123457"), loc, STR("{:.6LG}"), F(-1.234567e-1)); - test(STR("-1#23457"), loc, STR("{:.6LG}"), F(-1.234567e0)); - test(STR("-1_2#3457"), loc, STR("{:.6LG}"), F(-1.234567e1)); - test(STR("-12_3#457"), loc, STR("{:.6LG}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), loc, STR("{:.6LG}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), loc, STR("{:.6LG}"), F(-1.234567e4)); - test(STR("-123_45_7"), loc, STR("{:.6LG}"), F(-1.234567e5)); - test(STR("-1#23457E+06"), loc, STR("{:.6LG}"), F(-1.234567e6)); - test(STR("-1#23457E+07"), loc, STR("{:.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)); + 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(STR("1,234.57$$$"), STR("{:$<11.6LG}"), F(1.234567e3)); - test(STR("$$$1,234.57"), STR("{:$>11.6LG}"), F(1.234567e3)); - test(STR("$1,234.57$$"), STR("{:$^11.6LG}"), F(1.234567e3)); - test(STR("0001,234.57"), STR("{:011.6LG}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), STR("{:$<12.6LG}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), STR("{:$>12.6LG}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), STR("{:$^12.6LG}"), F(-1.234567e3)); - test(STR("-0001,234.57"), STR("{:012.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("$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(STR("1_23_4#57$$$"), STR("{:$<12.6LG}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), STR("{:$>12.6LG}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), STR("{:$^12.6LG}"), F(1.234567e3)); - test(STR("0001_23_4#57"), STR("{:012.6LG}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), STR("{:$<13.6LG}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), STR("{:$>13.6LG}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), STR("{:$^13.6LG}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), STR("{:013.6LG}"), F(-1.234567e3)); - - test(STR("1,234.57$$$"), en_US, STR("{:$<11.6LG}"), F(1.234567e3)); - test(STR("$$$1,234.57"), en_US, STR("{:$>11.6LG}"), F(1.234567e3)); - test(STR("$1,234.57$$"), en_US, STR("{:$^11.6LG}"), F(1.234567e3)); - test(STR("0001,234.57"), en_US, STR("{:011.6LG}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), en_US, STR("{:$<12.6LG}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), en_US, STR("{:$>12.6LG}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), en_US, STR("{:$^12.6LG}"), F(-1.234567e3)); - test(STR("-0001,234.57"), en_US, STR("{:012.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("$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(STR("1_23_4#57$$$"), loc, STR("{:$<12.6LG}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), loc, STR("{:$>12.6LG}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), loc, STR("{:$^12.6LG}"), F(1.234567e3)); - test(STR("0001_23_4#57"), loc, STR("{:012.6LG}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), loc, STR("{:$<13.6LG}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), loc, STR("{:$>13.6LG}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), loc, STR("{:$^13.6LG}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), loc, STR("{:013.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("$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 +1905,227 @@ void test_floating_point_default() { // *** Basic *** std::locale::global(en_US); - test(STR("1.234567e-06"), STR("{:L}"), F(1.234567e-6)); - test(STR("1.234567e-05"), STR("{:L}"), F(1.234567e-5)); - test(STR("0.0001234567"), STR("{:L}"), F(1.234567e-4)); - test(STR("0.001234567"), STR("{:L}"), F(1.234567e-3)); - test(STR("0.01234567"), STR("{:L}"), F(1.234567e-2)); - test(STR("0.1234567"), STR("{:L}"), F(1.234567e-1)); - test(STR("1.234567"), STR("{:L}"), F(1.234567e0)); - test(STR("12.34567"), STR("{:L}"), F(1.234567e1)); - test(STR("123.4567"), STR("{:L}"), F(1.234567e2)); - test(STR("1,234.567"), STR("{:L}"), F(1.234567e3)); - test(STR("12,345.67"), STR("{:L}"), F(1.234567e4)); - test(STR("123,456.7"), STR("{:L}"), F(1.234567e5)); - test(STR("1,234,567"), STR("{:L}"), F(1.234567e6)); - test(STR("12,345,670"), STR("{:L}"), 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(STR("123,456,700"), STR("{:L}"), F(1.234567e8)); - test(STR("1,234,567,000"), STR("{:L}"), F(1.234567e9)); - test(STR("12,345,670,000"), STR("{:L}"), F(1.234567e10)); - test(STR("123,456,700,000"), STR("{:L}"), F(1.234567e11)); - test(STR("1.234567e+12"), STR("{:L}"), F(1.234567e12)); - test(STR("1.234567e+13"), STR("{:L}"), 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(STR("-1.234567e-06"), STR("{:L}"), F(-1.234567e-6)); - test(STR("-1.234567e-05"), STR("{:L}"), F(-1.234567e-5)); - test(STR("-0.0001234567"), STR("{:L}"), F(-1.234567e-4)); - test(STR("-0.001234567"), STR("{:L}"), F(-1.234567e-3)); - test(STR("-0.01234567"), STR("{:L}"), F(-1.234567e-2)); - test(STR("-0.1234567"), STR("{:L}"), F(-1.234567e-1)); - test(STR("-1.234567"), STR("{:L}"), F(-1.234567e0)); - test(STR("-12.34567"), STR("{:L}"), F(-1.234567e1)); - test(STR("-123.4567"), STR("{:L}"), F(-1.234567e2)); - test(STR("-1,234.567"), STR("{:L}"), F(-1.234567e3)); - test(STR("-12,345.67"), STR("{:L}"), F(-1.234567e4)); - test(STR("-123,456.7"), STR("{:L}"), F(-1.234567e5)); - test(STR("-1,234,567"), STR("{:L}"), F(-1.234567e6)); - test(STR("-12,345,670"), STR("{:L}"), 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(STR("-123,456,700"), STR("{:L}"), F(-1.234567e8)); - test(STR("-1,234,567,000"), STR("{:L}"), F(-1.234567e9)); - test(STR("-12,345,670,000"), STR("{:L}"), F(-1.234567e10)); - test(STR("-123,456,700,000"), STR("{:L}"), F(-1.234567e11)); - test(STR("-1.234567e+12"), STR("{:L}"), F(-1.234567e12)); - test(STR("-1.234567e+13"), STR("{:L}"), 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(STR("1#234567e-06"), STR("{:L}"), F(1.234567e-6)); - test(STR("1#234567e-05"), STR("{:L}"), F(1.234567e-5)); - test(STR("0#0001234567"), STR("{:L}"), F(1.234567e-4)); - test(STR("0#001234567"), STR("{:L}"), F(1.234567e-3)); - test(STR("0#01234567"), STR("{:L}"), F(1.234567e-2)); - test(STR("0#1234567"), STR("{:L}"), F(1.234567e-1)); - test(STR("1#234567"), STR("{:L}"), F(1.234567e0)); - test(STR("1_2#34567"), STR("{:L}"), F(1.234567e1)); - test(STR("12_3#4567"), STR("{:L}"), F(1.234567e2)); - test(STR("1_23_4#567"), STR("{:L}"), F(1.234567e3)); - test(STR("12_34_5#67"), STR("{:L}"), F(1.234567e4)); - test(STR("123_45_6#7"), STR("{:L}"), F(1.234567e5)); - test(STR("1_234_56_7"), STR("{:L}"), F(1.234567e6)); - test(STR("12_345_67_0"), STR("{:L}"), 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(STR("1_23_456_70_0"), STR("{:L}"), F(1.234567e8)); - test(STR("1_2_34_567_00_0"), STR("{:L}"), F(1.234567e9)); - test(STR("1_2_3_45_670_00_0"), STR("{:L}"), F(1.234567e10)); - test(STR("1_2_3_4_56_700_00_0"), STR("{:L}"), F(1.234567e11)); - test(STR("1#234567e+12"), STR("{:L}"), F(1.234567e12)); - test(STR("1#234567e+13"), STR("{:L}"), 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(STR("-1#234567e-06"), STR("{:L}"), F(-1.234567e-6)); - test(STR("-1#234567e-05"), STR("{:L}"), F(-1.234567e-5)); - test(STR("-0#0001234567"), STR("{:L}"), F(-1.234567e-4)); - test(STR("-0#001234567"), STR("{:L}"), F(-1.234567e-3)); - test(STR("-0#01234567"), STR("{:L}"), F(-1.234567e-2)); - test(STR("-0#1234567"), STR("{:L}"), F(-1.234567e-1)); - test(STR("-1#234567"), STR("{:L}"), F(-1.234567e0)); - test(STR("-1_2#34567"), STR("{:L}"), F(-1.234567e1)); - test(STR("-12_3#4567"), STR("{:L}"), F(-1.234567e2)); - test(STR("-1_23_4#567"), STR("{:L}"), F(-1.234567e3)); - test(STR("-12_34_5#67"), STR("{:L}"), F(-1.234567e4)); - test(STR("-123_45_6#7"), STR("{:L}"), F(-1.234567e5)); - test(STR("-1_234_56_7"), STR("{:L}"), F(-1.234567e6)); - test(STR("-12_345_67_0"), STR("{:L}"), 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(STR("-1_23_456_70_0"), STR("{:L}"), F(-1.234567e8)); - test(STR("-1_2_34_567_00_0"), STR("{:L}"), F(-1.234567e9)); - test(STR("-1_2_3_45_670_00_0"), STR("{:L}"), F(-1.234567e10)); - test(STR("-1_2_3_4_56_700_00_0"), STR("{:L}"), F(-1.234567e11)); - test(STR("-1#234567e+12"), STR("{:L}"), F(-1.234567e12)); - test(STR("-1#234567e+13"), STR("{:L}"), 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(STR("1.234567e-06"), en_US, STR("{:L}"), F(1.234567e-6)); - test(STR("1.234567e-05"), en_US, STR("{:L}"), F(1.234567e-5)); - test(STR("0.0001234567"), en_US, STR("{:L}"), F(1.234567e-4)); - test(STR("0.001234567"), en_US, STR("{:L}"), F(1.234567e-3)); - test(STR("0.01234567"), en_US, STR("{:L}"), F(1.234567e-2)); - test(STR("0.1234567"), en_US, STR("{:L}"), F(1.234567e-1)); - test(STR("1.234567"), en_US, STR("{:L}"), F(1.234567e0)); - test(STR("12.34567"), en_US, STR("{:L}"), F(1.234567e1)); - test(STR("123.4567"), en_US, STR("{:L}"), F(1.234567e2)); - test(STR("1,234.567"), en_US, STR("{:L}"), F(1.234567e3)); - test(STR("12,345.67"), en_US, STR("{:L}"), F(1.234567e4)); - test(STR("123,456.7"), en_US, STR("{:L}"), F(1.234567e5)); - test(STR("1,234,567"), en_US, STR("{:L}"), F(1.234567e6)); - test(STR("12,345,670"), en_US, STR("{:L}"), 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(STR("123,456,700"), en_US, STR("{:L}"), F(1.234567e8)); - test(STR("1,234,567,000"), en_US, STR("{:L}"), F(1.234567e9)); - test(STR("12,345,670,000"), en_US, STR("{:L}"), F(1.234567e10)); - test(STR("123,456,700,000"), en_US, STR("{:L}"), F(1.234567e11)); - test(STR("1.234567e+12"), en_US, STR("{:L}"), F(1.234567e12)); - test(STR("1.234567e+13"), en_US, STR("{:L}"), 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(STR("-1.234567e-06"), en_US, STR("{:L}"), F(-1.234567e-6)); - test(STR("-1.234567e-05"), en_US, STR("{:L}"), F(-1.234567e-5)); - test(STR("-0.0001234567"), en_US, STR("{:L}"), F(-1.234567e-4)); - test(STR("-0.001234567"), en_US, STR("{:L}"), F(-1.234567e-3)); - test(STR("-0.01234567"), en_US, STR("{:L}"), F(-1.234567e-2)); - test(STR("-0.1234567"), en_US, STR("{:L}"), F(-1.234567e-1)); - test(STR("-1.234567"), en_US, STR("{:L}"), F(-1.234567e0)); - test(STR("-12.34567"), en_US, STR("{:L}"), F(-1.234567e1)); - test(STR("-123.4567"), en_US, STR("{:L}"), F(-1.234567e2)); - test(STR("-1,234.567"), en_US, STR("{:L}"), F(-1.234567e3)); - test(STR("-12,345.67"), en_US, STR("{:L}"), F(-1.234567e4)); - test(STR("-123,456.7"), en_US, STR("{:L}"), F(-1.234567e5)); - test(STR("-1,234,567"), en_US, STR("{:L}"), F(-1.234567e6)); - test(STR("-12,345,670"), en_US, STR("{:L}"), 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(STR("-123,456,700"), en_US, STR("{:L}"), F(-1.234567e8)); - test(STR("-1,234,567,000"), en_US, STR("{:L}"), F(-1.234567e9)); - test(STR("-12,345,670,000"), en_US, STR("{:L}"), F(-1.234567e10)); - test(STR("-123,456,700,000"), en_US, STR("{:L}"), F(-1.234567e11)); - test(STR("-1.234567e+12"), en_US, STR("{:L}"), F(-1.234567e12)); - test(STR("-1.234567e+13"), en_US, STR("{:L}"), 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(STR("1#234567e-06"), loc, STR("{:L}"), F(1.234567e-6)); - test(STR("1#234567e-05"), loc, STR("{:L}"), F(1.234567e-5)); - test(STR("0#0001234567"), loc, STR("{:L}"), F(1.234567e-4)); - test(STR("0#001234567"), loc, STR("{:L}"), F(1.234567e-3)); - test(STR("0#01234567"), loc, STR("{:L}"), F(1.234567e-2)); - test(STR("0#1234567"), loc, STR("{:L}"), F(1.234567e-1)); - test(STR("1#234567"), loc, STR("{:L}"), F(1.234567e0)); - test(STR("1_2#34567"), loc, STR("{:L}"), F(1.234567e1)); - test(STR("12_3#4567"), loc, STR("{:L}"), F(1.234567e2)); - test(STR("1_23_4#567"), loc, STR("{:L}"), F(1.234567e3)); - test(STR("12_34_5#67"), loc, STR("{:L}"), F(1.234567e4)); - test(STR("123_45_6#7"), loc, STR("{:L}"), F(1.234567e5)); - test(STR("1_234_56_7"), loc, STR("{:L}"), F(1.234567e6)); - test(STR("12_345_67_0"), loc, STR("{:L}"), 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(STR("1_23_456_70_0"), loc, STR("{:L}"), F(1.234567e8)); - test(STR("1_2_34_567_00_0"), loc, STR("{:L}"), F(1.234567e9)); - test(STR("1_2_3_45_670_00_0"), loc, STR("{:L}"), F(1.234567e10)); - test(STR("1_2_3_4_56_700_00_0"), loc, STR("{:L}"), F(1.234567e11)); - test(STR("1#234567e+12"), loc, STR("{:L}"), F(1.234567e12)); - test(STR("1#234567e+13"), loc, STR("{:L}"), 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(STR("-1#234567e-06"), loc, STR("{:L}"), F(-1.234567e-6)); - test(STR("-1#234567e-05"), loc, STR("{:L}"), F(-1.234567e-5)); - test(STR("-0#0001234567"), loc, STR("{:L}"), F(-1.234567e-4)); - test(STR("-0#001234567"), loc, STR("{:L}"), F(-1.234567e-3)); - test(STR("-0#01234567"), loc, STR("{:L}"), F(-1.234567e-2)); - test(STR("-0#1234567"), loc, STR("{:L}"), F(-1.234567e-1)); - test(STR("-1#234567"), loc, STR("{:L}"), F(-1.234567e0)); - test(STR("-1_2#34567"), loc, STR("{:L}"), F(-1.234567e1)); - test(STR("-12_3#4567"), loc, STR("{:L}"), F(-1.234567e2)); - test(STR("-1_23_4#567"), loc, STR("{:L}"), F(-1.234567e3)); - test(STR("-12_34_5#67"), loc, STR("{:L}"), F(-1.234567e4)); - test(STR("-123_45_6#7"), loc, STR("{:L}"), F(-1.234567e5)); - test(STR("-1_234_56_7"), loc, STR("{:L}"), F(-1.234567e6)); - test(STR("-12_345_67_0"), loc, STR("{:L}"), 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(STR("-1_23_456_70_0"), loc, STR("{:L}"), F(-1.234567e8)); - test(STR("-1_2_34_567_00_0"), loc, STR("{:L}"), F(-1.234567e9)); - test(STR("-1_2_3_45_670_00_0"), loc, STR("{:L}"), F(-1.234567e10)); - test(STR("-1_2_3_4_56_700_00_0"), loc, STR("{:L}"), F(-1.234567e11)); - test(STR("-1#234567e+12"), loc, STR("{:L}"), F(-1.234567e12)); - test(STR("-1#234567e+13"), loc, STR("{:L}"), 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(STR("1,234.567$$$"), STR("{:$<12L}"), F(1.234567e3)); - test(STR("$$$1,234.567"), STR("{:$>12L}"), F(1.234567e3)); - test(STR("$1,234.567$$"), STR("{:$^12L}"), F(1.234567e3)); - test(STR("0001,234.567"), STR("{:012L}"), F(1.234567e3)); - test(STR("-1,234.567$$$"), STR("{:$<13L}"), F(-1.234567e3)); - test(STR("$$$-1,234.567"), STR("{:$>13L}"), F(-1.234567e3)); - test(STR("$-1,234.567$$"), STR("{:$^13L}"), F(-1.234567e3)); - test(STR("-0001,234.567"), STR("{:013L}"), 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(STR("1_23_4#567$$$"), STR("{:$<13L}"), F(1.234567e3)); - test(STR("$$$1_23_4#567"), STR("{:$>13L}"), F(1.234567e3)); - test(STR("$1_23_4#567$$"), STR("{:$^13L}"), F(1.234567e3)); - test(STR("0001_23_4#567"), STR("{:013L}"), F(1.234567e3)); - test(STR("-1_23_4#567$$$"), STR("{:$<14L}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567"), STR("{:$>14L}"), F(-1.234567e3)); - test(STR("$-1_23_4#567$$"), STR("{:$^14L}"), F(-1.234567e3)); - test(STR("-0001_23_4#567"), STR("{:014L}"), F(-1.234567e3)); - - test(STR("1,234.567$$$"), en_US, STR("{:$<12L}"), F(1.234567e3)); - test(STR("$$$1,234.567"), en_US, STR("{:$>12L}"), F(1.234567e3)); - test(STR("$1,234.567$$"), en_US, STR("{:$^12L}"), F(1.234567e3)); - test(STR("0001,234.567"), en_US, STR("{:012L}"), F(1.234567e3)); - test(STR("-1,234.567$$$"), en_US, STR("{:$<13L}"), F(-1.234567e3)); - test(STR("$$$-1,234.567"), en_US, STR("{:$>13L}"), F(-1.234567e3)); - test(STR("$-1,234.567$$"), en_US, STR("{:$^13L}"), F(-1.234567e3)); - test(STR("-0001,234.567"), en_US, STR("{:013L}"), 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(STR("1_23_4#567$$$"), loc, STR("{:$<13L}"), F(1.234567e3)); - test(STR("$$$1_23_4#567"), loc, STR("{:$>13L}"), F(1.234567e3)); - test(STR("$1_23_4#567$$"), loc, STR("{:$^13L}"), F(1.234567e3)); - test(STR("0001_23_4#567"), loc, STR("{:013L}"), F(1.234567e3)); - test(STR("-1_23_4#567$$$"), loc, STR("{:$<14L}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#567"), loc, STR("{:$>14L}"), F(-1.234567e3)); - test(STR("$-1_23_4#567$$"), loc, STR("{:$^14L}"), F(-1.234567e3)); - test(STR("-0001_23_4#567"), loc, STR("{:014L}"), 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 +2135,163 @@ void test_floating_point_default_precision() { // *** Basic *** std::locale::global(en_US); - test(STR("1.23457e-06"), STR("{:.6L}"), F(1.234567e-6)); - test(STR("1.23457e-05"), STR("{:.6L}"), F(1.234567e-5)); - test(STR("0.000123457"), STR("{:.6L}"), F(1.234567e-4)); - test(STR("0.00123457"), STR("{:.6L}"), F(1.234567e-3)); - test(STR("0.0123457"), STR("{:.6L}"), F(1.234567e-2)); - test(STR("0.123457"), STR("{:.6L}"), F(1.234567e-1)); - test(STR("1.23457"), STR("{:.6L}"), F(1.234567e0)); - test(STR("12.3457"), STR("{:.6L}"), F(1.234567e1)); - test(STR("123.457"), STR("{:.6L}"), F(1.234567e2)); - test(STR("1,234.57"), STR("{:.6L}"), F(1.234567e3)); - test(STR("12,345.7"), STR("{:.6L}"), F(1.234567e4)); - test(STR("123,457"), STR("{:.6L}"), F(1.234567e5)); - test(STR("1.23457e+06"), STR("{:.6L}"), F(1.234567e6)); - test(STR("1.23457e+07"), STR("{:.6L}"), F(1.234567e7)); - test(STR("-1.23457e-06"), STR("{:.6L}"), F(-1.234567e-6)); - test(STR("-1.23457e-05"), STR("{:.6L}"), F(-1.234567e-5)); - test(STR("-0.000123457"), STR("{:.6L}"), F(-1.234567e-4)); - test(STR("-0.00123457"), STR("{:.6L}"), F(-1.234567e-3)); - test(STR("-0.0123457"), STR("{:.6L}"), F(-1.234567e-2)); - test(STR("-0.123457"), STR("{:.6L}"), F(-1.234567e-1)); - test(STR("-1.23457"), STR("{:.6L}"), F(-1.234567e0)); - test(STR("-12.3457"), STR("{:.6L}"), F(-1.234567e1)); - test(STR("-123.457"), STR("{:.6L}"), F(-1.234567e2)); - test(STR("-1,234.57"), STR("{:.6L}"), F(-1.234567e3)); - test(STR("-12,345.7"), STR("{:.6L}"), F(-1.234567e4)); - test(STR("-123,457"), STR("{:.6L}"), F(-1.234567e5)); - test(STR("-1.23457e+06"), STR("{:.6L}"), F(-1.234567e6)); - test(STR("-1.23457e+07"), STR("{:.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)); + 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(STR("1#23457e-06"), STR("{:.6L}"), F(1.234567e-6)); - test(STR("1#23457e-05"), STR("{:.6L}"), F(1.234567e-5)); - test(STR("0#000123457"), STR("{:.6L}"), F(1.234567e-4)); - test(STR("0#00123457"), STR("{:.6L}"), F(1.234567e-3)); - test(STR("0#0123457"), STR("{:.6L}"), F(1.234567e-2)); - test(STR("0#123457"), STR("{:.6L}"), F(1.234567e-1)); - test(STR("1#23457"), STR("{:.6L}"), F(1.234567e0)); - test(STR("1_2#3457"), STR("{:.6L}"), F(1.234567e1)); - test(STR("12_3#457"), STR("{:.6L}"), F(1.234567e2)); - test(STR("1_23_4#57"), STR("{:.6L}"), F(1.234567e3)); - test(STR("12_34_5#7"), STR("{:.6L}"), F(1.234567e4)); - test(STR("123_45_7"), STR("{:.6L}"), F(1.234567e5)); - test(STR("1#23457e+06"), STR("{:.6L}"), F(1.234567e6)); - test(STR("1#23457e+07"), STR("{:.6L}"), F(1.234567e7)); - test(STR("-1#23457e-06"), STR("{:.6L}"), F(-1.234567e-6)); - test(STR("-1#23457e-05"), STR("{:.6L}"), F(-1.234567e-5)); - test(STR("-0#000123457"), STR("{:.6L}"), F(-1.234567e-4)); - test(STR("-0#00123457"), STR("{:.6L}"), F(-1.234567e-3)); - test(STR("-0#0123457"), STR("{:.6L}"), F(-1.234567e-2)); - test(STR("-0#123457"), STR("{:.6L}"), F(-1.234567e-1)); - test(STR("-1#23457"), STR("{:.6L}"), F(-1.234567e0)); - test(STR("-1_2#3457"), STR("{:.6L}"), F(-1.234567e1)); - test(STR("-12_3#457"), STR("{:.6L}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), STR("{:.6L}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), STR("{:.6L}"), F(-1.234567e4)); - test(STR("-123_45_7"), STR("{:.6L}"), F(-1.234567e5)); - test(STR("-1#23457e+06"), STR("{:.6L}"), F(-1.234567e6)); - test(STR("-1#23457e+07"), STR("{:.6L}"), F(-1.234567e7)); - - test(STR("1.23457e-06"), en_US, STR("{:.6L}"), F(1.234567e-6)); - test(STR("1.23457e-05"), en_US, STR("{:.6L}"), F(1.234567e-5)); - test(STR("0.000123457"), en_US, STR("{:.6L}"), F(1.234567e-4)); - test(STR("0.00123457"), en_US, STR("{:.6L}"), F(1.234567e-3)); - test(STR("0.0123457"), en_US, STR("{:.6L}"), F(1.234567e-2)); - test(STR("0.123457"), en_US, STR("{:.6L}"), F(1.234567e-1)); - test(STR("1.23457"), en_US, STR("{:.6L}"), F(1.234567e0)); - test(STR("12.3457"), en_US, STR("{:.6L}"), F(1.234567e1)); - test(STR("123.457"), en_US, STR("{:.6L}"), F(1.234567e2)); - test(STR("1,234.57"), en_US, STR("{:.6L}"), F(1.234567e3)); - test(STR("12,345.7"), en_US, STR("{:.6L}"), F(1.234567e4)); - test(STR("123,457"), en_US, STR("{:.6L}"), F(1.234567e5)); - test(STR("1.23457e+06"), en_US, STR("{:.6L}"), F(1.234567e6)); - test(STR("1.23457e+07"), en_US, STR("{:.6L}"), F(1.234567e7)); - test(STR("-1.23457e-06"), en_US, STR("{:.6L}"), F(-1.234567e-6)); - test(STR("-1.23457e-05"), en_US, STR("{:.6L}"), F(-1.234567e-5)); - test(STR("-0.000123457"), en_US, STR("{:.6L}"), F(-1.234567e-4)); - test(STR("-0.00123457"), en_US, STR("{:.6L}"), F(-1.234567e-3)); - test(STR("-0.0123457"), en_US, STR("{:.6L}"), F(-1.234567e-2)); - test(STR("-0.123457"), en_US, STR("{:.6L}"), F(-1.234567e-1)); - test(STR("-1.23457"), en_US, STR("{:.6L}"), F(-1.234567e0)); - test(STR("-12.3457"), en_US, STR("{:.6L}"), F(-1.234567e1)); - test(STR("-123.457"), en_US, STR("{:.6L}"), F(-1.234567e2)); - test(STR("-1,234.57"), en_US, STR("{:.6L}"), F(-1.234567e3)); - test(STR("-12,345.7"), en_US, STR("{:.6L}"), F(-1.234567e4)); - test(STR("-123,457"), en_US, STR("{:.6L}"), F(-1.234567e5)); - test(STR("-1.23457e+06"), en_US, STR("{:.6L}"), F(-1.234567e6)); - test(STR("-1.23457e+07"), en_US, STR("{:.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"), 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(STR("1#23457e-06"), loc, STR("{:.6L}"), F(1.234567e-6)); - test(STR("1#23457e-05"), loc, STR("{:.6L}"), F(1.234567e-5)); - test(STR("0#000123457"), loc, STR("{:.6L}"), F(1.234567e-4)); - test(STR("0#00123457"), loc, STR("{:.6L}"), F(1.234567e-3)); - test(STR("0#0123457"), loc, STR("{:.6L}"), F(1.234567e-2)); - test(STR("0#123457"), loc, STR("{:.6L}"), F(1.234567e-1)); - test(STR("1#23457"), loc, STR("{:.6L}"), F(1.234567e0)); - test(STR("1_2#3457"), loc, STR("{:.6L}"), F(1.234567e1)); - test(STR("12_3#457"), loc, STR("{:.6L}"), F(1.234567e2)); - test(STR("1_23_4#57"), loc, STR("{:.6L}"), F(1.234567e3)); - test(STR("12_34_5#7"), loc, STR("{:.6L}"), F(1.234567e4)); - test(STR("123_45_7"), loc, STR("{:.6L}"), F(1.234567e5)); - test(STR("1#23457e+06"), loc, STR("{:.6L}"), F(1.234567e6)); - test(STR("1#23457e+07"), loc, STR("{:.6L}"), F(1.234567e7)); - test(STR("-1#23457e-06"), loc, STR("{:.6L}"), F(-1.234567e-6)); - test(STR("-1#23457e-05"), loc, STR("{:.6L}"), F(-1.234567e-5)); - test(STR("-0#000123457"), loc, STR("{:.6L}"), F(-1.234567e-4)); - test(STR("-0#00123457"), loc, STR("{:.6L}"), F(-1.234567e-3)); - test(STR("-0#0123457"), loc, STR("{:.6L}"), F(-1.234567e-2)); - test(STR("-0#123457"), loc, STR("{:.6L}"), F(-1.234567e-1)); - test(STR("-1#23457"), loc, STR("{:.6L}"), F(-1.234567e0)); - test(STR("-1_2#3457"), loc, STR("{:.6L}"), F(-1.234567e1)); - test(STR("-12_3#457"), loc, STR("{:.6L}"), F(-1.234567e2)); - test(STR("-1_23_4#57"), loc, STR("{:.6L}"), F(-1.234567e3)); - test(STR("-12_34_5#7"), loc, STR("{:.6L}"), F(-1.234567e4)); - test(STR("-123_45_7"), loc, STR("{:.6L}"), F(-1.234567e5)); - test(STR("-1#23457e+06"), loc, STR("{:.6L}"), F(-1.234567e6)); - test(STR("-1#23457e+07"), loc, STR("{:.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)); + 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(STR("1,234.57$$$"), STR("{:$<11.6L}"), F(1.234567e3)); - test(STR("$$$1,234.57"), STR("{:$>11.6L}"), F(1.234567e3)); - test(STR("$1,234.57$$"), STR("{:$^11.6L}"), F(1.234567e3)); - test(STR("0001,234.57"), STR("{:011.6L}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), STR("{:$<12.6L}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), STR("{:$>12.6L}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), STR("{:$^12.6L}"), F(-1.234567e3)); - test(STR("-0001,234.57"), STR("{:012.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("$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(STR("1_23_4#57$$$"), STR("{:$<12.6L}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), STR("{:$>12.6L}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), STR("{:$^12.6L}"), F(1.234567e3)); - test(STR("0001_23_4#57"), STR("{:012.6L}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), STR("{:$<13.6L}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), STR("{:$>13.6L}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), STR("{:$^13.6L}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), STR("{:013.6L}"), F(-1.234567e3)); - - test(STR("1,234.57$$$"), en_US, STR("{:$<11.6L}"), F(1.234567e3)); - test(STR("$$$1,234.57"), en_US, STR("{:$>11.6L}"), F(1.234567e3)); - test(STR("$1,234.57$$"), en_US, STR("{:$^11.6L}"), F(1.234567e3)); - test(STR("0001,234.57"), en_US, STR("{:011.6L}"), F(1.234567e3)); - test(STR("-1,234.57$$$"), en_US, STR("{:$<12.6L}"), F(-1.234567e3)); - test(STR("$$$-1,234.57"), en_US, STR("{:$>12.6L}"), F(-1.234567e3)); - test(STR("$-1,234.57$$"), en_US, STR("{:$^12.6L}"), F(-1.234567e3)); - test(STR("-0001,234.57"), en_US, STR("{:012.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("$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(STR("1_23_4#57$$$"), loc, STR("{:$<12.6L}"), F(1.234567e3)); - test(STR("$$$1_23_4#57"), loc, STR("{:$>12.6L}"), F(1.234567e3)); - test(STR("$1_23_4#57$$"), loc, STR("{:$^12.6L}"), F(1.234567e3)); - test(STR("0001_23_4#57"), loc, STR("{:012.6L}"), F(1.234567e3)); - test(STR("-1_23_4#57$$$"), loc, STR("{:$<13.6L}"), F(-1.234567e3)); - test(STR("$$$-1_23_4#57"), loc, STR("{:$>13.6L}"), F(-1.234567e3)); - test(STR("$-1_23_4#57$$"), loc, STR("{:$^13.6L}"), F(-1.234567e3)); - test(STR("-0001_23_4#57"), loc, STR("{:013.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("$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/vformat.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp index 3bad47d..9401948 100644 --- a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp @@ -24,19 +24,19 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { 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 fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { (void)std::vformat(std::locale(), fmt, std::make_format_args>(args...)); assert(false); - } catch ([[maybe_unused]] std::format_error& e) { + } catch ([[maybe_unused]] const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp index effcd72..f236831 100644 --- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp @@ -23,19 +23,19 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { 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 fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const Args&... args) { #ifndef TEST_HAS_NO_EXCEPTIONS try { TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args>(args...)); assert(false); - } catch ([[maybe_unused]] std::format_error& e) { + } catch ([[maybe_unused]] const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index b441656..c5e2bbc 100644 --- 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 @@ -30,7 +30,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); @@ -58,14 +58,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const 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]] std::format_error& e) { + } catch ([[maybe_unused]] const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } 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 index e6880d7..3f39fe2 100644 --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp @@ -31,7 +31,7 @@ #include "test_macros.h" #include "format_tests.h" -auto test = [](std::basic_string expected, std::basic_string fmt, +auto test = [](std::basic_string_view expected, std::basic_string_view fmt, const Args&... args) { { std::basic_string out(expected.size(), CharT(' ')); @@ -59,14 +59,14 @@ auto test = [](std::basic_string expected, st } }; -auto test_exception = - [](std::string_view what, std::basic_string fmt, const Args&... args) { +auto test_exception = [](std::string_view what, std::basic_string_view fmt, + const 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]] std::format_error& e) { + } catch ([[maybe_unused]] const std::format_error& e) { LIBCPP_ASSERT(e.what() == what); return; } -- 2.7.4