1 //===----------------------------------------------------------------------===//
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
9 // UNSUPPORTED: no-localization
10 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
12 // XFAIL: availability-fp_to_chars-missing
14 // Bionic has minimal locale support, investigate this later.
15 // XFAIL: LIBCXX-ANDROID-FIXME
17 // REQUIRES: locale.en_US.UTF-8
21 // This test the locale-specific form for these formatting functions:
23 // // [format.functions], formatting functions
24 // template<class... Args>
25 // string format(string_view fmt, const Args&... args);
26 // template<class... Args>
27 // wstring format(wstring_view fmt, const Args&... args);
28 // template<class... Args>
29 // string format(const locale& loc, string_view fmt, const Args&... args);
30 // template<class... Args>
31 // wstring format(const locale& loc, wstring_view fmt, const Args&... args);
33 // string vformat(string_view fmt, format_args args);
34 // wstring vformat(wstring_view fmt, wformat_args args);
35 // string vformat(const locale& loc, string_view fmt, format_args args);
36 // wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
38 // template<class Out, class... Args>
39 // Out format_to(Out out, string_view fmt, const Args&... args);
40 // template<class Out, class... Args>
41 // Out format_to(Out out, wstring_view fmt, const Args&... args);
42 // template<class Out, class... Args>
43 // Out format_to(Out out, const locale& loc, string_view fmt, const Args&... args);
44 // template<class Out, class... Args>
45 // Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args);
47 // template<class Out>
48 // Out vformat_to(Out out, string_view fmt, format_args args);
49 // template<class Out>
50 // Out vformat_to(Out out, wstring_view fmt, wformat_args args);
51 // template<class Out>
52 // Out vformat_to(Out out, const locale& loc, string_view fmt,
54 // template<class Out>
55 // Out vformat_to(Out out, const locale& loc, wstring_view fmt,
58 // template<class Out> struct format_to_n_result {
60 // iter_difference_t<Out> size;
63 // template<class Out, class... Args>
64 // format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
65 // string_view fmt, const Args&... args);
66 // template<class Out, class... Args>
67 // format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
68 // wstring_view fmt, const Args&... args);
69 // template<class Out, class... Args>
70 // format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
71 // const locale& loc, string_view fmt,
72 // const Args&... args);
73 // template<class Out, class... Args>
74 // format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
75 // const locale& loc, wstring_view fmt,
76 // const Args&... args);
78 // template<class... Args>
79 // size_t formatted_size(string_view fmt, const Args&... args);
80 // template<class... Args>
81 // size_t formatted_size(wstring_view fmt, const Args&... args);
82 // template<class... Args>
83 // size_t formatted_size(const locale& loc, string_view fmt, const Args&... args);
84 // template<class... Args>
85 // size_t formatted_size(const locale& loc, wstring_view fmt, const Args&... args);
92 #include "test_macros.h"
93 #include "make_string.h"
94 #include "platform_support.h" // locale name macros
95 #include "format_tests.h"
96 #include "string_literal.h"
97 #include "test_format_string.h"
98 #include "assert_macros.h"
99 #include "concat_macros.h"
101 #define STR(S) MAKE_STRING(CharT, S)
102 #define SV(S) MAKE_STRING_VIEW(CharT, S)
104 template <class CharT
>
108 struct numpunct
<char> : std::numpunct
<char> {
109 string_type
do_truename() const override
{ return "yes"; }
110 string_type
do_falsename() const override
{ return "no"; }
112 std::string
do_grouping() const override
{ return "\1\2\3\2\1"; };
113 char do_thousands_sep() const override
{ return '_'; }
114 char do_decimal_point() const override
{ return '#'; }
117 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
119 struct numpunct
<wchar_t> : std::numpunct
<wchar_t> {
120 string_type
do_truename() const override
{ return L
"yes"; }
121 string_type
do_falsename() const override
{ return L
"no"; }
123 std::string
do_grouping() const override
{ return "\1\2\3\2\1"; };
124 wchar_t do_thousands_sep() const override
{ return L
'_'; }
125 wchar_t do_decimal_point() const override
{ return L
'#'; }
129 template <class CharT
, class... Args
>
130 void test(std::basic_string_view
<CharT
> expected
, test_format_string
<CharT
, Args
...> fmt
, Args
&&... args
) {
133 std::basic_string
<CharT
> out
= std::format(fmt
, std::forward
<Args
>(args
)...);
134 TEST_REQUIRE(out
== expected
,
135 TEST_WRITE_CONCATENATED(
136 "\nFormat string ", fmt
.get(), "\nExpected output ", expected
, "\nActual output ", out
, '\n'));
140 std::basic_string
<CharT
> out
= std::vformat(fmt
.get(), std::make_format_args
<context_t
<CharT
>>(args
...));
141 assert(out
== expected
);
145 std::basic_string
<CharT
> out(expected
.size(), CharT(' '));
146 auto it
= std::format_to(out
.begin(), fmt
, std::forward
<Args
>(args
)...);
147 assert(it
== out
.end());
148 assert(out
== expected
);
150 // *** vformat_to ***
152 std::basic_string
<CharT
> out(expected
.size(), CharT(' '));
153 auto it
= std::vformat_to(out
.begin(), fmt
.get(), std::make_format_args
<context_t
<CharT
>>(args
...));
154 assert(it
== out
.end());
155 assert(out
== expected
);
157 // *** format_to_n ***
159 std::basic_string
<CharT
> out
;
160 std::format_to_n_result result
= std::format_to_n(std::back_inserter(out
), 1000, fmt
, std::forward
<Args
>(args
)...);
161 using diff_type
= decltype(result
.size
);
162 diff_type formatted_size
= std::formatted_size(fmt
, std::forward
<Args
>(args
)...);
163 diff_type size
= std::min
<diff_type
>(1000, formatted_size
);
165 assert(result
.size
== formatted_size
);
166 assert(out
== expected
.substr(0, size
));
168 // *** formatted_size ***
170 std::size_t size
= std::formatted_size(fmt
, std::forward
<Args
>(args
)...);
171 assert(size
== expected
.size());
175 template <class CharT
, class... Args
>
177 std::basic_string_view
<CharT
> expected
, std::locale loc
, test_format_string
<CharT
, Args
...> fmt
, Args
&&... args
) {
180 std::basic_string
<CharT
> out
= std::format(loc
, fmt
, std::forward
<Args
>(args
)...);
181 if constexpr (std::same_as
<CharT
, char>)
183 std::cerr
<< "\nFormat string " << fmt
.get() << "\nExpected output " << expected
<< "\nActual output "
185 assert(out
== expected
);
189 std::basic_string
<CharT
> out
= std::vformat(loc
, fmt
.get(), std::make_format_args
<context_t
<CharT
>>(args
...));
190 assert(out
== expected
);
194 std::basic_string
<CharT
> out(expected
.size(), CharT(' '));
195 auto it
= std::format_to(out
.begin(), loc
, fmt
, std::forward
<Args
>(args
)...);
196 assert(it
== out
.end());
197 assert(out
== expected
);
199 // *** vformat_to ***
201 std::basic_string
<CharT
> out(expected
.size(), CharT(' '));
202 auto it
= std::vformat_to(out
.begin(), loc
, fmt
.get(), std::make_format_args
<context_t
<CharT
>>(args
...));
203 assert(it
== out
.end());
204 assert(out
== expected
);
206 // *** format_to_n ***
208 std::basic_string
<CharT
> out
;
209 std::format_to_n_result result
=
210 std::format_to_n(std::back_inserter(out
), 1000, loc
, fmt
, std::forward
<Args
>(args
)...);
211 using diff_type
= decltype(result
.size
);
212 diff_type formatted_size
= std::formatted_size(loc
, fmt
, std::forward
<Args
>(args
)...);
213 diff_type size
= std::min
<diff_type
>(1000, formatted_size
);
215 assert(result
.size
== formatted_size
);
216 assert(out
== expected
.substr(0, size
));
218 // *** formatted_size ***
220 std::size_t size
= std::formatted_size(loc
, fmt
, std::forward
<Args
>(args
)...);
221 assert(size
== expected
.size());
225 #ifndef TEST_HAS_NO_UNICODE
226 template <class CharT
>
227 struct numpunct_unicode
;
230 struct numpunct_unicode
<char> : std::numpunct
<char> {
231 string_type
do_truename() const override
{ return "gültig"; }
232 string_type
do_falsename() const override
{ return "ungültig"; }
235 # ifndef TEST_HAS_NO_WIDE_CHARACTERS
237 struct numpunct_unicode
<wchar_t> : std::numpunct
<wchar_t> {
238 string_type
do_truename() const override
{ return L
"gültig"; }
239 string_type
do_falsename() const override
{ return L
"ungültig"; }
242 #endif // TEST_HAS_NO_UNICODE
244 template <class CharT
>
246 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
248 std::locale::global(std::locale(LOCALE_en_US_UTF_8
));
249 assert(std::locale().name() == LOCALE_en_US_UTF_8
);
250 test(SV("true"), SV("{:L}"), true);
251 test(SV("false"), SV("{:L}"), false);
253 test(SV("yes"), loc
, SV("{:L}"), true);
254 test(SV("no"), loc
, SV("{:L}"), false);
256 std::locale::global(loc
);
257 test(SV("yes"), SV("{:L}"), true);
258 test(SV("no"), SV("{:L}"), false);
260 test(SV("true"), std::locale(LOCALE_en_US_UTF_8
), SV("{:L}"), true);
261 test(SV("false"), std::locale(LOCALE_en_US_UTF_8
), SV("{:L}"), false);
263 #ifndef TEST_HAS_NO_UNICODE
264 std::locale loc_unicode
= std::locale(std::locale(), new numpunct_unicode
<CharT
>());
266 test(SV("gültig"), loc_unicode
, SV("{:L}"), true);
267 test(SV("ungültig"), loc_unicode
, SV("{:L}"), false);
269 test(SV("gültig "), loc_unicode
, SV("{:9L}"), true);
270 test(SV("gültig!!!"), loc_unicode
, SV("{:!<9L}"), true);
271 test(SV("_gültig__"), loc_unicode
, SV("{:_^9L}"), true);
272 test(SV(" gültig"), loc_unicode
, SV("{:>9L}"), true);
273 #endif // TEST_HAS_NO_UNICODE
276 template <class CharT
>
277 void test_integer() {
278 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
279 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
282 std::locale::global(en_US
);
283 test(SV("0"), SV("{:L}"), 0);
284 test(SV("1"), SV("{:L}"), 1);
285 test(SV("10"), SV("{:L}"), 10);
286 test(SV("100"), SV("{:L}"), 100);
287 test(SV("1,000"), SV("{:L}"), 1'000);
288 test(SV("10,000"), SV("{:L}"), 10'000);
289 test(SV("100,000"), SV("{:L}"), 100'000);
290 test(SV("1,000,000"), SV("{:L}"), 1'000'000);
291 test(SV("10,000,000"), SV("{:L}"), 10'000'000);
292 test(SV("100,000,000"), SV("{:L}"), 100'000'000);
293 test(SV("1,000,000,000"), SV("{:L}"), 1'000'000'000);
295 test(SV("-1"), SV("{:L}"), -1);
296 test(SV("-10"), SV("{:L}"), -10);
297 test(SV("-100"), SV("{:L}"), -100);
298 test(SV("-1,000"), SV("{:L}"), -1'000);
299 test(SV("-10,000"), SV("{:L}"), -10'000);
300 test(SV("-100,000"), SV("{:L}"), -100'000);
301 test(SV("-1,000,000"), SV("{:L}"), -1'000'000);
302 test(SV("-10,000,000"), SV("{:L}"), -10'000'000);
303 test(SV("-100,000,000"), SV("{:L}"), -100'000'000);
304 test(SV("-1,000,000,000"), SV("{:L}"), -1'000'000'000);
306 std::locale::global(loc
);
307 test(SV("0"), SV("{:L}"), 0);
308 test(SV("1"), SV("{:L}"), 1);
309 test(SV("1_0"), SV("{:L}"), 10);
310 test(SV("10_0"), SV("{:L}"), 100);
311 test(SV("1_00_0"), SV("{:L}"), 1'000);
312 test(SV("10_00_0"), SV("{:L}"), 10'000);
313 test(SV("100_00_0"), SV("{:L}"), 100'000);
314 test(SV("1_000_00_0"), SV("{:L}"), 1'000'000);
315 test(SV("10_000_00_0"), SV("{:L}"), 10'000'000);
316 test(SV("1_00_000_00_0"), SV("{:L}"), 100'000'000);
317 test(SV("1_0_00_000_00_0"), SV("{:L}"), 1'000'000'000);
319 test(SV("-1"), SV("{:L}"), -1);
320 test(SV("-1_0"), SV("{:L}"), -10);
321 test(SV("-10_0"), SV("{:L}"), -100);
322 test(SV("-1_00_0"), SV("{:L}"), -1'000);
323 test(SV("-10_00_0"), SV("{:L}"), -10'000);
324 test(SV("-100_00_0"), SV("{:L}"), -100'000);
325 test(SV("-1_000_00_0"), SV("{:L}"), -1'000'000);
326 test(SV("-10_000_00_0"), SV("{:L}"), -10'000'000);
327 test(SV("-1_00_000_00_0"), SV("{:L}"), -100'000'000);
328 test(SV("-1_0_00_000_00_0"), SV("{:L}"), -1'000'000'000);
330 test(SV("0"), en_US
, SV("{:L}"), 0);
331 test(SV("1"), en_US
, SV("{:L}"), 1);
332 test(SV("10"), en_US
, SV("{:L}"), 10);
333 test(SV("100"), en_US
, SV("{:L}"), 100);
334 test(SV("1,000"), en_US
, SV("{:L}"), 1'000);
335 test(SV("10,000"), en_US
, SV("{:L}"), 10'000);
336 test(SV("100,000"), en_US
, SV("{:L}"), 100'000);
337 test(SV("1,000,000"), en_US
, SV("{:L}"), 1'000'000);
338 test(SV("10,000,000"), en_US
, SV("{:L}"), 10'000'000);
339 test(SV("100,000,000"), en_US
, SV("{:L}"), 100'000'000);
340 test(SV("1,000,000,000"), en_US
, SV("{:L}"), 1'000'000'000);
342 test(SV("-1"), en_US
, SV("{:L}"), -1);
343 test(SV("-10"), en_US
, SV("{:L}"), -10);
344 test(SV("-100"), en_US
, SV("{:L}"), -100);
345 test(SV("-1,000"), en_US
, SV("{:L}"), -1'000);
346 test(SV("-10,000"), en_US
, SV("{:L}"), -10'000);
347 test(SV("-100,000"), en_US
, SV("{:L}"), -100'000);
348 test(SV("-1,000,000"), en_US
, SV("{:L}"), -1'000'000);
349 test(SV("-10,000,000"), en_US
, SV("{:L}"), -10'000'000);
350 test(SV("-100,000,000"), en_US
, SV("{:L}"), -100'000'000);
351 test(SV("-1,000,000,000"), en_US
, SV("{:L}"), -1'000'000'000);
353 std::locale::global(en_US
);
354 test(SV("0"), loc
, SV("{:L}"), 0);
355 test(SV("1"), loc
, SV("{:L}"), 1);
356 test(SV("1_0"), loc
, SV("{:L}"), 10);
357 test(SV("10_0"), loc
, SV("{:L}"), 100);
358 test(SV("1_00_0"), loc
, SV("{:L}"), 1'000);
359 test(SV("10_00_0"), loc
, SV("{:L}"), 10'000);
360 test(SV("100_00_0"), loc
, SV("{:L}"), 100'000);
361 test(SV("1_000_00_0"), loc
, SV("{:L}"), 1'000'000);
362 test(SV("10_000_00_0"), loc
, SV("{:L}"), 10'000'000);
363 test(SV("1_00_000_00_0"), loc
, SV("{:L}"), 100'000'000);
364 test(SV("1_0_00_000_00_0"), loc
, SV("{:L}"), 1'000'000'000);
366 test(SV("-1"), loc
, SV("{:L}"), -1);
367 test(SV("-1_0"), loc
, SV("{:L}"), -10);
368 test(SV("-10_0"), loc
, SV("{:L}"), -100);
369 test(SV("-1_00_0"), loc
, SV("{:L}"), -1'000);
370 test(SV("-10_00_0"), loc
, SV("{:L}"), -10'000);
371 test(SV("-100_00_0"), loc
, SV("{:L}"), -100'000);
372 test(SV("-1_000_00_0"), loc
, SV("{:L}"), -1'000'000);
373 test(SV("-10_000_00_0"), loc
, SV("{:L}"), -10'000'000);
374 test(SV("-1_00_000_00_0"), loc
, SV("{:L}"), -100'000'000);
375 test(SV("-1_0_00_000_00_0"), loc
, SV("{:L}"), -1'000'000'000);
378 std::locale::global(en_US
);
379 test(SV("0"), SV("{:Lb}"), 0b0);
380 test(SV("1"), SV("{:Lb}"), 0b1);
381 test(SV("1,000,000,000"), SV("{:Lb}"), 0b1'000'000'000);
383 test(SV("0b0"), SV("{:#Lb}"), 0b0);
384 test(SV("0b1"), SV("{:#Lb}"), 0b1);
385 test(SV("0b1,000,000,000"), SV("{:#Lb}"), 0b1'000'000'000);
387 test(SV("-1"), SV("{:LB}"), -0b1);
388 test(SV("-1,000,000,000"), SV("{:LB}"), -0b1'000'000'000);
390 test(SV("-0B1"), SV("{:#LB}"), -0b1);
391 test(SV("-0B1,000,000,000"), SV("{:#LB}"), -0b1'000'000'000);
393 std::locale::global(loc
);
394 test(SV("0"), SV("{:Lb}"), 0b0);
395 test(SV("1"), SV("{:Lb}"), 0b1);
396 test(SV("1_0_00_000_00_0"), SV("{:Lb}"), 0b1'000'000'000);
398 test(SV("0b0"), SV("{:#Lb}"), 0b0);
399 test(SV("0b1"), SV("{:#Lb}"), 0b1);
400 test(SV("0b1_0_00_000_00_0"), SV("{:#Lb}"), 0b1'000'000'000);
402 test(SV("-1"), SV("{:LB}"), -0b1);
403 test(SV("-1_0_00_000_00_0"), SV("{:LB}"), -0b1'000'000'000);
405 test(SV("-0B1"), SV("{:#LB}"), -0b1);
406 test(SV("-0B1_0_00_000_00_0"), SV("{:#LB}"), -0b1'000'000'000);
408 test(SV("0"), en_US
, SV("{:Lb}"), 0b0);
409 test(SV("1"), en_US
, SV("{:Lb}"), 0b1);
410 test(SV("1,000,000,000"), en_US
, SV("{:Lb}"), 0b1'000'000'000);
412 test(SV("0b0"), en_US
, SV("{:#Lb}"), 0b0);
413 test(SV("0b1"), en_US
, SV("{:#Lb}"), 0b1);
414 test(SV("0b1,000,000,000"), en_US
, SV("{:#Lb}"), 0b1'000'000'000);
416 test(SV("-1"), en_US
, SV("{:LB}"), -0b1);
417 test(SV("-1,000,000,000"), en_US
, SV("{:LB}"), -0b1'000'000'000);
419 test(SV("-0B1"), en_US
, SV("{:#LB}"), -0b1);
420 test(SV("-0B1,000,000,000"), en_US
, SV("{:#LB}"), -0b1'000'000'000);
422 std::locale::global(en_US
);
423 test(SV("0"), loc
, SV("{:Lb}"), 0b0);
424 test(SV("1"), loc
, SV("{:Lb}"), 0b1);
425 test(SV("1_0_00_000_00_0"), loc
, SV("{:Lb}"), 0b1'000'000'000);
427 test(SV("0b0"), loc
, SV("{:#Lb}"), 0b0);
428 test(SV("0b1"), loc
, SV("{:#Lb}"), 0b1);
429 test(SV("0b1_0_00_000_00_0"), loc
, SV("{:#Lb}"), 0b1'000'000'000);
431 test(SV("-1"), loc
, SV("{:LB}"), -0b1);
432 test(SV("-1_0_00_000_00_0"), loc
, SV("{:LB}"), -0b1'000'000'000);
434 test(SV("-0B1"), loc
, SV("{:#LB}"), -0b1);
435 test(SV("-0B1_0_00_000_00_0"), loc
, SV("{:#LB}"), -0b1'000'000'000);
438 std::locale::global(en_US
);
439 test(SV("0"), SV("{:Lo}"), 00);
440 test(SV("1"), SV("{:Lo}"), 01);
441 test(SV("1,000,000,000"), SV("{:Lo}"), 01'000'000'000);
443 test(SV("0"), SV("{:#Lo}"), 00);
444 test(SV("01"), SV("{:#Lo}"), 01);
445 test(SV("01,000,000,000"), SV("{:#Lo}"), 01'000'000'000);
447 test(SV("-1"), SV("{:Lo}"), -01);
448 test(SV("-1,000,000,000"), SV("{:Lo}"), -01'000'000'000);
450 test(SV("-01"), SV("{:#Lo}"), -01);
451 test(SV("-01,000,000,000"), SV("{:#Lo}"), -01'000'000'000);
453 std::locale::global(loc
);
454 test(SV("0"), SV("{:Lo}"), 00);
455 test(SV("1"), SV("{:Lo}"), 01);
456 test(SV("1_0_00_000_00_0"), SV("{:Lo}"), 01'000'000'000);
458 test(SV("0"), SV("{:#Lo}"), 00);
459 test(SV("01"), SV("{:#Lo}"), 01);
460 test(SV("01_0_00_000_00_0"), SV("{:#Lo}"), 01'000'000'000);
462 test(SV("-1"), SV("{:Lo}"), -01);
463 test(SV("-1_0_00_000_00_0"), SV("{:Lo}"), -01'000'000'000);
465 test(SV("-01"), SV("{:#Lo}"), -01);
466 test(SV("-01_0_00_000_00_0"), SV("{:#Lo}"), -01'000'000'000);
468 test(SV("0"), en_US
, SV("{:Lo}"), 00);
469 test(SV("1"), en_US
, SV("{:Lo}"), 01);
470 test(SV("1,000,000,000"), en_US
, SV("{:Lo}"), 01'000'000'000);
472 test(SV("0"), en_US
, SV("{:#Lo}"), 00);
473 test(SV("01"), en_US
, SV("{:#Lo}"), 01);
474 test(SV("01,000,000,000"), en_US
, SV("{:#Lo}"), 01'000'000'000);
476 test(SV("-1"), en_US
, SV("{:Lo}"), -01);
477 test(SV("-1,000,000,000"), en_US
, SV("{:Lo}"), -01'000'000'000);
479 test(SV("-01"), en_US
, SV("{:#Lo}"), -01);
480 test(SV("-01,000,000,000"), en_US
, SV("{:#Lo}"), -01'000'000'000);
482 std::locale::global(en_US
);
483 test(SV("0"), loc
, SV("{:Lo}"), 00);
484 test(SV("1"), loc
, SV("{:Lo}"), 01);
485 test(SV("1_0_00_000_00_0"), loc
, SV("{:Lo}"), 01'000'000'000);
487 test(SV("0"), loc
, SV("{:#Lo}"), 00);
488 test(SV("01"), loc
, SV("{:#Lo}"), 01);
489 test(SV("01_0_00_000_00_0"), loc
, SV("{:#Lo}"), 01'000'000'000);
491 test(SV("-1"), loc
, SV("{:Lo}"), -01);
492 test(SV("-1_0_00_000_00_0"), loc
, SV("{:Lo}"), -01'000'000'000);
494 test(SV("-01"), loc
, SV("{:#Lo}"), -01);
495 test(SV("-01_0_00_000_00_0"), loc
, SV("{:#Lo}"), -01'000'000'000);
497 // *** Hexadecimal ***
498 std::locale::global(en_US
);
499 test(SV("0"), SV("{:Lx}"), 0x0);
500 test(SV("1"), SV("{:Lx}"), 0x1);
501 test(SV("1,000,000,000"), SV("{:Lx}"), 0x1'000'000'000);
503 test(SV("0x0"), SV("{:#Lx}"), 0x0);
504 test(SV("0x1"), SV("{:#Lx}"), 0x1);
505 test(SV("0x1,000,000,000"), SV("{:#Lx}"), 0x1'000'000'000);
507 test(SV("-1"), SV("{:LX}"), -0x1);
508 test(SV("-1,000,000,000"), SV("{:LX}"), -0x1'000'000'000);
510 test(SV("-0X1"), SV("{:#LX}"), -0x1);
511 test(SV("-0X1,000,000,000"), SV("{:#LX}"), -0x1'000'000'000);
513 std::locale::global(loc
);
514 test(SV("0"), SV("{:Lx}"), 0x0);
515 test(SV("1"), SV("{:Lx}"), 0x1);
516 test(SV("1_0_00_000_00_0"), SV("{:Lx}"), 0x1'000'000'000);
518 test(SV("0x0"), SV("{:#Lx}"), 0x0);
519 test(SV("0x1"), SV("{:#Lx}"), 0x1);
520 test(SV("0x1_0_00_000_00_0"), SV("{:#Lx}"), 0x1'000'000'000);
522 test(SV("-1"), SV("{:LX}"), -0x1);
523 test(SV("-1_0_00_000_00_0"), SV("{:LX}"), -0x1'000'000'000);
525 test(SV("-0X1"), SV("{:#LX}"), -0x1);
526 test(SV("-0X1_0_00_000_00_0"), SV("{:#LX}"), -0x1'000'000'000);
528 test(SV("0"), en_US
, SV("{:Lx}"), 0x0);
529 test(SV("1"), en_US
, SV("{:Lx}"), 0x1);
530 test(SV("1,000,000,000"), en_US
, SV("{:Lx}"), 0x1'000'000'000);
532 test(SV("0x0"), en_US
, SV("{:#Lx}"), 0x0);
533 test(SV("0x1"), en_US
, SV("{:#Lx}"), 0x1);
534 test(SV("0x1,000,000,000"), en_US
, SV("{:#Lx}"), 0x1'000'000'000);
536 test(SV("-1"), en_US
, SV("{:LX}"), -0x1);
537 test(SV("-1,000,000,000"), en_US
, SV("{:LX}"), -0x1'000'000'000);
539 test(SV("-0X1"), en_US
, SV("{:#LX}"), -0x1);
540 test(SV("-0X1,000,000,000"), en_US
, SV("{:#LX}"), -0x1'000'000'000);
542 std::locale::global(en_US
);
543 test(SV("0"), loc
, SV("{:Lx}"), 0x0);
544 test(SV("1"), loc
, SV("{:Lx}"), 0x1);
545 test(SV("1_0_00_000_00_0"), loc
, SV("{:Lx}"), 0x1'000'000'000);
547 test(SV("0x0"), loc
, SV("{:#Lx}"), 0x0);
548 test(SV("0x1"), loc
, SV("{:#Lx}"), 0x1);
549 test(SV("0x1_0_00_000_00_0"), loc
, SV("{:#Lx}"), 0x1'000'000'000);
551 test(SV("-1"), loc
, SV("{:LX}"), -0x1);
552 test(SV("-1_0_00_000_00_0"), loc
, SV("{:LX}"), -0x1'000'000'000);
554 test(SV("-0X1"), loc
, SV("{:#LX}"), -0x1);
555 test(SV("-0X1_0_00_000_00_0"), loc
, SV("{:#LX}"), -0x1'000'000'000);
557 // *** align-fill & width ***
558 test(SV("4_2"), loc
, SV("{:L}"), 42);
560 test(SV(" 4_2"), loc
, SV("{:6L}"), 42);
561 test(SV("4_2 "), loc
, SV("{:<6L}"), 42);
562 test(SV(" 4_2 "), loc
, SV("{:^6L}"), 42);
563 test(SV(" 4_2"), loc
, SV("{:>6L}"), 42);
565 test(SV("4_2***"), loc
, SV("{:*<6L}"), 42);
566 test(SV("*4_2**"), loc
, SV("{:*^6L}"), 42);
567 test(SV("***4_2"), loc
, SV("{:*>6L}"), 42);
569 test(SV("4_a*****"), loc
, SV("{:*<8Lx}"), 0x4a);
570 test(SV("**4_a***"), loc
, SV("{:*^8Lx}"), 0x4a);
571 test(SV("*****4_a"), loc
, SV("{:*>8Lx}"), 0x4a);
573 test(SV("0x4_a***"), loc
, SV("{:*<#8Lx}"), 0x4a);
574 test(SV("*0x4_a**"), loc
, SV("{:*^#8Lx}"), 0x4a);
575 test(SV("***0x4_a"), loc
, SV("{:*>#8Lx}"), 0x4a);
577 test(SV("4_A*****"), loc
, SV("{:*<8LX}"), 0x4a);
578 test(SV("**4_A***"), loc
, SV("{:*^8LX}"), 0x4a);
579 test(SV("*****4_A"), loc
, SV("{:*>8LX}"), 0x4a);
581 test(SV("0X4_A***"), loc
, SV("{:*<#8LX}"), 0x4a);
582 test(SV("*0X4_A**"), loc
, SV("{:*^#8LX}"), 0x4a);
583 test(SV("***0X4_A"), loc
, SV("{:*>#8LX}"), 0x4a);
585 // Test whether zero padding is ignored
586 test(SV("4_2 "), loc
, SV("{:<06L}"), 42);
587 test(SV(" 4_2 "), loc
, SV("{:^06L}"), 42);
588 test(SV(" 4_2"), loc
, SV("{:>06L}"), 42);
590 // *** zero-padding & width ***
591 test(SV(" 4_2"), loc
, SV("{:6L}"), 42);
592 test(SV("0004_2"), loc
, SV("{:06L}"), 42);
593 test(SV("-004_2"), loc
, SV("{:06L}"), -42);
595 test(SV("000004_a"), loc
, SV("{:08Lx}"), 0x4a);
596 test(SV("0x0004_a"), loc
, SV("{:#08Lx}"), 0x4a);
597 test(SV("0X0004_A"), loc
, SV("{:#08LX}"), 0x4a);
599 test(SV("-00004_a"), loc
, SV("{:08Lx}"), -0x4a);
600 test(SV("-0x004_a"), loc
, SV("{:#08Lx}"), -0x4a);
601 test(SV("-0X004_A"), loc
, SV("{:#08LX}"), -0x4a);
604 template <class F
, class CharT
>
605 void test_floating_point_hex_lower_case() {
606 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
607 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
610 std::locale::global(en_US
);
611 test(SV("1.23456p-3"), SV("{:La}"), F(0x1.23456p
-3));
612 test(SV("1.23456p-2"), SV("{:La}"), F(0x1.23456p
-2));
613 test(SV("1.23456p-1"), SV("{:La}"), F(0x1.23456p
-1));
614 test(SV("1.23456p+0"), SV("{:La}"), F(0x1.23456p0
));
615 test(SV("1.23456p+1"), SV("{:La}"), F(0x1.23456p
+1));
616 test(SV("1.23456p+2"), SV("{:La}"), F(0x1.23456p
+2));
617 test(SV("1.23456p+3"), SV("{:La}"), F(0x1.23456p
+3));
618 test(SV("1.23456p+20"), SV("{:La}"), F(0x1.23456p
+20));
620 std::locale::global(loc
);
621 test(SV("1#23456p-3"), SV("{:La}"), F(0x1.23456p
-3));
622 test(SV("1#23456p-2"), SV("{:La}"), F(0x1.23456p
-2));
623 test(SV("1#23456p-1"), SV("{:La}"), F(0x1.23456p
-1));
624 test(SV("1#23456p+0"), SV("{:La}"), F(0x1.23456p0
));
625 test(SV("1#23456p+1"), SV("{:La}"), F(0x1.23456p
+1));
626 test(SV("1#23456p+2"), SV("{:La}"), F(0x1.23456p
+2));
627 test(SV("1#23456p+3"), SV("{:La}"), F(0x1.23456p
+3));
628 test(SV("1#23456p+20"), SV("{:La}"), F(0x1.23456p
+20));
630 test(SV("1.23456p-3"), en_US
, SV("{:La}"), F(0x1.23456p
-3));
631 test(SV("1.23456p-2"), en_US
, SV("{:La}"), F(0x1.23456p
-2));
632 test(SV("1.23456p-1"), en_US
, SV("{:La}"), F(0x1.23456p
-1));
633 test(SV("1.23456p+0"), en_US
, SV("{:La}"), F(0x1.23456p0
));
634 test(SV("1.23456p+1"), en_US
, SV("{:La}"), F(0x1.23456p
+1));
635 test(SV("1.23456p+2"), en_US
, SV("{:La}"), F(0x1.23456p
+2));
636 test(SV("1.23456p+3"), en_US
, SV("{:La}"), F(0x1.23456p
+3));
637 test(SV("1.23456p+20"), en_US
, SV("{:La}"), F(0x1.23456p
+20));
639 std::locale::global(en_US
);
640 test(SV("1#23456p-3"), loc
, SV("{:La}"), F(0x1.23456p
-3));
641 test(SV("1#23456p-2"), loc
, SV("{:La}"), F(0x1.23456p
-2));
642 test(SV("1#23456p-1"), loc
, SV("{:La}"), F(0x1.23456p
-1));
643 test(SV("1#23456p+0"), loc
, SV("{:La}"), F(0x1.23456p0
));
644 test(SV("1#23456p+1"), loc
, SV("{:La}"), F(0x1.23456p
+1));
645 test(SV("1#23456p+2"), loc
, SV("{:La}"), F(0x1.23456p
+2));
646 test(SV("1#23456p+3"), loc
, SV("{:La}"), F(0x1.23456p
+3));
647 test(SV("1#23456p+20"), loc
, SV("{:La}"), F(0x1.23456p
+20));
649 // *** Fill, align, zero padding ***
650 std::locale::global(en_US
);
651 test(SV("1.23456p+3$$$"), SV("{:$<13La}"), F(0x1.23456p3
));
652 test(SV("$$$1.23456p+3"), SV("{:$>13La}"), F(0x1.23456p3
));
653 test(SV("$1.23456p+3$$"), SV("{:$^13La}"), F(0x1.23456p3
));
654 test(SV("0001.23456p+3"), SV("{:013La}"), F(0x1.23456p3
));
655 test(SV("-1.23456p+3$$$"), SV("{:$<14La}"), F(-0x1.23456p3
));
656 test(SV("$$$-1.23456p+3"), SV("{:$>14La}"), F(-0x1.23456p3
));
657 test(SV("$-1.23456p+3$$"), SV("{:$^14La}"), F(-0x1.23456p3
));
658 test(SV("-0001.23456p+3"), SV("{:014La}"), F(-0x1.23456p3
));
660 std::locale::global(loc
);
661 test(SV("1#23456p+3$$$"), SV("{:$<13La}"), F(0x1.23456p3
));
662 test(SV("$$$1#23456p+3"), SV("{:$>13La}"), F(0x1.23456p3
));
663 test(SV("$1#23456p+3$$"), SV("{:$^13La}"), F(0x1.23456p3
));
664 test(SV("0001#23456p+3"), SV("{:013La}"), F(0x1.23456p3
));
665 test(SV("-1#23456p+3$$$"), SV("{:$<14La}"), F(-0x1.23456p3
));
666 test(SV("$$$-1#23456p+3"), SV("{:$>14La}"), F(-0x1.23456p3
));
667 test(SV("$-1#23456p+3$$"), SV("{:$^14La}"), F(-0x1.23456p3
));
668 test(SV("-0001#23456p+3"), SV("{:014La}"), F(-0x1.23456p3
));
670 test(SV("1.23456p+3$$$"), en_US
, SV("{:$<13La}"), F(0x1.23456p3
));
671 test(SV("$$$1.23456p+3"), en_US
, SV("{:$>13La}"), F(0x1.23456p3
));
672 test(SV("$1.23456p+3$$"), en_US
, SV("{:$^13La}"), F(0x1.23456p3
));
673 test(SV("0001.23456p+3"), en_US
, SV("{:013La}"), F(0x1.23456p3
));
674 test(SV("-1.23456p+3$$$"), en_US
, SV("{:$<14La}"), F(-0x1.23456p3
));
675 test(SV("$$$-1.23456p+3"), en_US
, SV("{:$>14La}"), F(-0x1.23456p3
));
676 test(SV("$-1.23456p+3$$"), en_US
, SV("{:$^14La}"), F(-0x1.23456p3
));
677 test(SV("-0001.23456p+3"), en_US
, SV("{:014La}"), F(-0x1.23456p3
));
679 std::locale::global(en_US
);
680 test(SV("1#23456p+3$$$"), loc
, SV("{:$<13La}"), F(0x1.23456p3
));
681 test(SV("$$$1#23456p+3"), loc
, SV("{:$>13La}"), F(0x1.23456p3
));
682 test(SV("$1#23456p+3$$"), loc
, SV("{:$^13La}"), F(0x1.23456p3
));
683 test(SV("0001#23456p+3"), loc
, SV("{:013La}"), F(0x1.23456p3
));
684 test(SV("-1#23456p+3$$$"), loc
, SV("{:$<14La}"), F(-0x1.23456p3
));
685 test(SV("$$$-1#23456p+3"), loc
, SV("{:$>14La}"), F(-0x1.23456p3
));
686 test(SV("$-1#23456p+3$$"), loc
, SV("{:$^14La}"), F(-0x1.23456p3
));
687 test(SV("-0001#23456p+3"), loc
, SV("{:014La}"), F(-0x1.23456p3
));
690 template <class F
, class CharT
>
691 void test_floating_point_hex_upper_case() {
692 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
693 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
696 std::locale::global(en_US
);
697 test(SV("1.23456P-3"), SV("{:LA}"), F(0x1.23456p
-3));
698 test(SV("1.23456P-2"), SV("{:LA}"), F(0x1.23456p
-2));
699 test(SV("1.23456P-1"), SV("{:LA}"), F(0x1.23456p
-1));
700 test(SV("1.23456P+0"), SV("{:LA}"), F(0x1.23456p0
));
701 test(SV("1.23456P+1"), SV("{:LA}"), F(0x1.23456p
+1));
702 test(SV("1.23456P+2"), SV("{:LA}"), F(0x1.23456p
+2));
703 test(SV("1.23456P+3"), SV("{:LA}"), F(0x1.23456p
+3));
704 test(SV("1.23456P+20"), SV("{:LA}"), F(0x1.23456p
+20));
706 std::locale::global(loc
);
707 test(SV("1#23456P-3"), SV("{:LA}"), F(0x1.23456p
-3));
708 test(SV("1#23456P-2"), SV("{:LA}"), F(0x1.23456p
-2));
709 test(SV("1#23456P-1"), SV("{:LA}"), F(0x1.23456p
-1));
710 test(SV("1#23456P+0"), SV("{:LA}"), F(0x1.23456p0
));
711 test(SV("1#23456P+1"), SV("{:LA}"), F(0x1.23456p
+1));
712 test(SV("1#23456P+2"), SV("{:LA}"), F(0x1.23456p
+2));
713 test(SV("1#23456P+3"), SV("{:LA}"), F(0x1.23456p
+3));
714 test(SV("1#23456P+20"), SV("{:LA}"), F(0x1.23456p
+20));
716 test(SV("1.23456P-3"), en_US
, SV("{:LA}"), F(0x1.23456p
-3));
717 test(SV("1.23456P-2"), en_US
, SV("{:LA}"), F(0x1.23456p
-2));
718 test(SV("1.23456P-1"), en_US
, SV("{:LA}"), F(0x1.23456p
-1));
719 test(SV("1.23456P+0"), en_US
, SV("{:LA}"), F(0x1.23456p0
));
720 test(SV("1.23456P+1"), en_US
, SV("{:LA}"), F(0x1.23456p
+1));
721 test(SV("1.23456P+2"), en_US
, SV("{:LA}"), F(0x1.23456p
+2));
722 test(SV("1.23456P+3"), en_US
, SV("{:LA}"), F(0x1.23456p
+3));
723 test(SV("1.23456P+20"), en_US
, SV("{:LA}"), F(0x1.23456p
+20));
725 std::locale::global(en_US
);
726 test(SV("1#23456P-3"), loc
, SV("{:LA}"), F(0x1.23456p
-3));
727 test(SV("1#23456P-2"), loc
, SV("{:LA}"), F(0x1.23456p
-2));
728 test(SV("1#23456P-1"), loc
, SV("{:LA}"), F(0x1.23456p
-1));
729 test(SV("1#23456P+0"), loc
, SV("{:LA}"), F(0x1.23456p0
));
730 test(SV("1#23456P+1"), loc
, SV("{:LA}"), F(0x1.23456p
+1));
731 test(SV("1#23456P+2"), loc
, SV("{:LA}"), F(0x1.23456p
+2));
732 test(SV("1#23456P+3"), loc
, SV("{:LA}"), F(0x1.23456p
+3));
733 test(SV("1#23456P+20"), loc
, SV("{:LA}"), F(0x1.23456p
+20));
735 // *** Fill, align, zero Padding ***
736 std::locale::global(en_US
);
737 test(SV("1.23456P+3$$$"), SV("{:$<13LA}"), F(0x1.23456p3
));
738 test(SV("$$$1.23456P+3"), SV("{:$>13LA}"), F(0x1.23456p3
));
739 test(SV("$1.23456P+3$$"), SV("{:$^13LA}"), F(0x1.23456p3
));
740 test(SV("0001.23456P+3"), SV("{:013LA}"), F(0x1.23456p3
));
741 test(SV("-1.23456P+3$$$"), SV("{:$<14LA}"), F(-0x1.23456p3
));
742 test(SV("$$$-1.23456P+3"), SV("{:$>14LA}"), F(-0x1.23456p3
));
743 test(SV("$-1.23456P+3$$"), SV("{:$^14LA}"), F(-0x1.23456p3
));
744 test(SV("-0001.23456P+3"), SV("{:014LA}"), F(-0x1.23456p3
));
746 std::locale::global(loc
);
747 test(SV("1#23456P+3$$$"), SV("{:$<13LA}"), F(0x1.23456p3
));
748 test(SV("$$$1#23456P+3"), SV("{:$>13LA}"), F(0x1.23456p3
));
749 test(SV("$1#23456P+3$$"), SV("{:$^13LA}"), F(0x1.23456p3
));
750 test(SV("0001#23456P+3"), SV("{:013LA}"), F(0x1.23456p3
));
751 test(SV("-1#23456P+3$$$"), SV("{:$<14LA}"), F(-0x1.23456p3
));
752 test(SV("$$$-1#23456P+3"), SV("{:$>14LA}"), F(-0x1.23456p3
));
753 test(SV("$-1#23456P+3$$"), SV("{:$^14LA}"), F(-0x1.23456p3
));
754 test(SV("-0001#23456P+3"), SV("{:014LA}"), F(-0x1.23456p3
));
756 test(SV("1.23456P+3$$$"), en_US
, SV("{:$<13LA}"), F(0x1.23456p3
));
757 test(SV("$$$1.23456P+3"), en_US
, SV("{:$>13LA}"), F(0x1.23456p3
));
758 test(SV("$1.23456P+3$$"), en_US
, SV("{:$^13LA}"), F(0x1.23456p3
));
759 test(SV("0001.23456P+3"), en_US
, SV("{:013LA}"), F(0x1.23456p3
));
760 test(SV("-1.23456P+3$$$"), en_US
, SV("{:$<14LA}"), F(-0x1.23456p3
));
761 test(SV("$$$-1.23456P+3"), en_US
, SV("{:$>14LA}"), F(-0x1.23456p3
));
762 test(SV("$-1.23456P+3$$"), en_US
, SV("{:$^14LA}"), F(-0x1.23456p3
));
763 test(SV("-0001.23456P+3"), en_US
, SV("{:014LA}"), F(-0x1.23456p3
));
765 std::locale::global(en_US
);
766 test(SV("1#23456P+3$$$"), loc
, SV("{:$<13LA}"), F(0x1.23456p3
));
767 test(SV("$$$1#23456P+3"), loc
, SV("{:$>13LA}"), F(0x1.23456p3
));
768 test(SV("$1#23456P+3$$"), loc
, SV("{:$^13LA}"), F(0x1.23456p3
));
769 test(SV("0001#23456P+3"), loc
, SV("{:013LA}"), F(0x1.23456p3
));
770 test(SV("-1#23456P+3$$$"), loc
, SV("{:$<14LA}"), F(-0x1.23456p3
));
771 test(SV("$$$-1#23456P+3"), loc
, SV("{:$>14LA}"), F(-0x1.23456p3
));
772 test(SV("$-1#23456P+3$$"), loc
, SV("{:$^14LA}"), F(-0x1.23456p3
));
773 test(SV("-0001#23456P+3"), loc
, SV("{:014LA}"), F(-0x1.23456p3
));
776 template <class F
, class CharT
>
777 void test_floating_point_hex_lower_case_precision() {
778 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
779 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
782 std::locale::global(en_US
);
783 test(SV("1.234560p-3"), SV("{:.6La}"), F(0x1.23456p
-3));
784 test(SV("1.234560p-2"), SV("{:.6La}"), F(0x1.23456p
-2));
785 test(SV("1.234560p-1"), SV("{:.6La}"), F(0x1.23456p
-1));
786 test(SV("1.234560p+0"), SV("{:.6La}"), F(0x1.23456p0
));
787 test(SV("1.234560p+1"), SV("{:.6La}"), F(0x1.23456p
+1));
788 test(SV("1.234560p+2"), SV("{:.6La}"), F(0x1.23456p
+2));
789 test(SV("1.234560p+3"), SV("{:.6La}"), F(0x1.23456p
+3));
790 test(SV("1.234560p+20"), SV("{:.6La}"), F(0x1.23456p
+20));
792 std::locale::global(loc
);
793 test(SV("1#234560p-3"), SV("{:.6La}"), F(0x1.23456p
-3));
794 test(SV("1#234560p-2"), SV("{:.6La}"), F(0x1.23456p
-2));
795 test(SV("1#234560p-1"), SV("{:.6La}"), F(0x1.23456p
-1));
796 test(SV("1#234560p+0"), SV("{:.6La}"), F(0x1.23456p0
));
797 test(SV("1#234560p+1"), SV("{:.6La}"), F(0x1.23456p
+1));
798 test(SV("1#234560p+2"), SV("{:.6La}"), F(0x1.23456p
+2));
799 test(SV("1#234560p+3"), SV("{:.6La}"), F(0x1.23456p
+3));
800 test(SV("1#234560p+20"), SV("{:.6La}"), F(0x1.23456p
+20));
802 test(SV("1.234560p-3"), en_US
, SV("{:.6La}"), F(0x1.23456p
-3));
803 test(SV("1.234560p-2"), en_US
, SV("{:.6La}"), F(0x1.23456p
-2));
804 test(SV("1.234560p-1"), en_US
, SV("{:.6La}"), F(0x1.23456p
-1));
805 test(SV("1.234560p+0"), en_US
, SV("{:.6La}"), F(0x1.23456p0
));
806 test(SV("1.234560p+1"), en_US
, SV("{:.6La}"), F(0x1.23456p
+1));
807 test(SV("1.234560p+2"), en_US
, SV("{:.6La}"), F(0x1.23456p
+2));
808 test(SV("1.234560p+3"), en_US
, SV("{:.6La}"), F(0x1.23456p
+3));
809 test(SV("1.234560p+20"), en_US
, SV("{:.6La}"), F(0x1.23456p
+20));
811 std::locale::global(en_US
);
812 test(SV("1#234560p-3"), loc
, SV("{:.6La}"), F(0x1.23456p
-3));
813 test(SV("1#234560p-2"), loc
, SV("{:.6La}"), F(0x1.23456p
-2));
814 test(SV("1#234560p-1"), loc
, SV("{:.6La}"), F(0x1.23456p
-1));
815 test(SV("1#234560p+0"), loc
, SV("{:.6La}"), F(0x1.23456p0
));
816 test(SV("1#234560p+1"), loc
, SV("{:.6La}"), F(0x1.23456p
+1));
817 test(SV("1#234560p+2"), loc
, SV("{:.6La}"), F(0x1.23456p
+2));
818 test(SV("1#234560p+3"), loc
, SV("{:.6La}"), F(0x1.23456p
+3));
819 test(SV("1#234560p+20"), loc
, SV("{:.6La}"), F(0x1.23456p
+20));
821 // *** Fill, align, zero padding ***
822 std::locale::global(en_US
);
823 test(SV("1.234560p+3$$$"), SV("{:$<14.6La}"), F(0x1.23456p3
));
824 test(SV("$$$1.234560p+3"), SV("{:$>14.6La}"), F(0x1.23456p3
));
825 test(SV("$1.234560p+3$$"), SV("{:$^14.6La}"), F(0x1.23456p3
));
826 test(SV("0001.234560p+3"), SV("{:014.6La}"), F(0x1.23456p3
));
827 test(SV("-1.234560p+3$$$"), SV("{:$<15.6La}"), F(-0x1.23456p3
));
828 test(SV("$$$-1.234560p+3"), SV("{:$>15.6La}"), F(-0x1.23456p3
));
829 test(SV("$-1.234560p+3$$"), SV("{:$^15.6La}"), F(-0x1.23456p3
));
830 test(SV("-0001.234560p+3"), SV("{:015.6La}"), F(-0x1.23456p3
));
832 std::locale::global(loc
);
833 test(SV("1#234560p+3$$$"), SV("{:$<14.6La}"), F(0x1.23456p3
));
834 test(SV("$$$1#234560p+3"), SV("{:$>14.6La}"), F(0x1.23456p3
));
835 test(SV("$1#234560p+3$$"), SV("{:$^14.6La}"), F(0x1.23456p3
));
836 test(SV("0001#234560p+3"), SV("{:014.6La}"), F(0x1.23456p3
));
837 test(SV("-1#234560p+3$$$"), SV("{:$<15.6La}"), F(-0x1.23456p3
));
838 test(SV("$$$-1#234560p+3"), SV("{:$>15.6La}"), F(-0x1.23456p3
));
839 test(SV("$-1#234560p+3$$"), SV("{:$^15.6La}"), F(-0x1.23456p3
));
840 test(SV("-0001#234560p+3"), SV("{:015.6La}"), F(-0x1.23456p3
));
842 test(SV("1.234560p+3$$$"), en_US
, SV("{:$<14.6La}"), F(0x1.23456p3
));
843 test(SV("$$$1.234560p+3"), en_US
, SV("{:$>14.6La}"), F(0x1.23456p3
));
844 test(SV("$1.234560p+3$$"), en_US
, SV("{:$^14.6La}"), F(0x1.23456p3
));
845 test(SV("0001.234560p+3"), en_US
, SV("{:014.6La}"), F(0x1.23456p3
));
846 test(SV("-1.234560p+3$$$"), en_US
, SV("{:$<15.6La}"), F(-0x1.23456p3
));
847 test(SV("$$$-1.234560p+3"), en_US
, SV("{:$>15.6La}"), F(-0x1.23456p3
));
848 test(SV("$-1.234560p+3$$"), en_US
, SV("{:$^15.6La}"), F(-0x1.23456p3
));
849 test(SV("-0001.234560p+3"), en_US
, SV("{:015.6La}"), F(-0x1.23456p3
));
851 std::locale::global(en_US
);
852 test(SV("1#234560p+3$$$"), loc
, SV("{:$<14.6La}"), F(0x1.23456p3
));
853 test(SV("$$$1#234560p+3"), loc
, SV("{:$>14.6La}"), F(0x1.23456p3
));
854 test(SV("$1#234560p+3$$"), loc
, SV("{:$^14.6La}"), F(0x1.23456p3
));
855 test(SV("0001#234560p+3"), loc
, SV("{:014.6La}"), F(0x1.23456p3
));
856 test(SV("-1#234560p+3$$$"), loc
, SV("{:$<15.6La}"), F(-0x1.23456p3
));
857 test(SV("$$$-1#234560p+3"), loc
, SV("{:$>15.6La}"), F(-0x1.23456p3
));
858 test(SV("$-1#234560p+3$$"), loc
, SV("{:$^15.6La}"), F(-0x1.23456p3
));
859 test(SV("-0001#234560p+3"), loc
, SV("{:015.6La}"), F(-0x1.23456p3
));
862 template <class F
, class CharT
>
863 void test_floating_point_hex_upper_case_precision() {
864 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
865 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
868 std::locale::global(en_US
);
869 test(SV("1.234560P-3"), SV("{:.6LA}"), F(0x1.23456p
-3));
870 test(SV("1.234560P-2"), SV("{:.6LA}"), F(0x1.23456p
-2));
871 test(SV("1.234560P-1"), SV("{:.6LA}"), F(0x1.23456p
-1));
872 test(SV("1.234560P+0"), SV("{:.6LA}"), F(0x1.23456p0
));
873 test(SV("1.234560P+1"), SV("{:.6LA}"), F(0x1.23456p
+1));
874 test(SV("1.234560P+2"), SV("{:.6LA}"), F(0x1.23456p
+2));
875 test(SV("1.234560P+3"), SV("{:.6LA}"), F(0x1.23456p
+3));
876 test(SV("1.234560P+20"), SV("{:.6LA}"), F(0x1.23456p
+20));
878 std::locale::global(loc
);
879 test(SV("1#234560P-3"), SV("{:.6LA}"), F(0x1.23456p
-3));
880 test(SV("1#234560P-2"), SV("{:.6LA}"), F(0x1.23456p
-2));
881 test(SV("1#234560P-1"), SV("{:.6LA}"), F(0x1.23456p
-1));
882 test(SV("1#234560P+0"), SV("{:.6LA}"), F(0x1.23456p0
));
883 test(SV("1#234560P+1"), SV("{:.6LA}"), F(0x1.23456p
+1));
884 test(SV("1#234560P+2"), SV("{:.6LA}"), F(0x1.23456p
+2));
885 test(SV("1#234560P+3"), SV("{:.6LA}"), F(0x1.23456p
+3));
886 test(SV("1#234560P+20"), SV("{:.6LA}"), F(0x1.23456p
+20));
888 test(SV("1.234560P-3"), en_US
, SV("{:.6LA}"), F(0x1.23456p
-3));
889 test(SV("1.234560P-2"), en_US
, SV("{:.6LA}"), F(0x1.23456p
-2));
890 test(SV("1.234560P-1"), en_US
, SV("{:.6LA}"), F(0x1.23456p
-1));
891 test(SV("1.234560P+0"), en_US
, SV("{:.6LA}"), F(0x1.23456p0
));
892 test(SV("1.234560P+1"), en_US
, SV("{:.6LA}"), F(0x1.23456p
+1));
893 test(SV("1.234560P+2"), en_US
, SV("{:.6LA}"), F(0x1.23456p
+2));
894 test(SV("1.234560P+3"), en_US
, SV("{:.6LA}"), F(0x1.23456p
+3));
895 test(SV("1.234560P+20"), en_US
, SV("{:.6LA}"), F(0x1.23456p
+20));
897 std::locale::global(en_US
);
898 test(SV("1#234560P-3"), loc
, SV("{:.6LA}"), F(0x1.23456p
-3));
899 test(SV("1#234560P-2"), loc
, SV("{:.6LA}"), F(0x1.23456p
-2));
900 test(SV("1#234560P-1"), loc
, SV("{:.6LA}"), F(0x1.23456p
-1));
901 test(SV("1#234560P+0"), loc
, SV("{:.6LA}"), F(0x1.23456p0
));
902 test(SV("1#234560P+1"), loc
, SV("{:.6LA}"), F(0x1.23456p
+1));
903 test(SV("1#234560P+2"), loc
, SV("{:.6LA}"), F(0x1.23456p
+2));
904 test(SV("1#234560P+3"), loc
, SV("{:.6LA}"), F(0x1.23456p
+3));
905 test(SV("1#234560P+20"), loc
, SV("{:.6LA}"), F(0x1.23456p
+20));
907 // *** Fill, align, zero Padding ***
908 std::locale::global(en_US
);
909 test(SV("1.234560P+3$$$"), SV("{:$<14.6LA}"), F(0x1.23456p3
));
910 test(SV("$$$1.234560P+3"), SV("{:$>14.6LA}"), F(0x1.23456p3
));
911 test(SV("$1.234560P+3$$"), SV("{:$^14.6LA}"), F(0x1.23456p3
));
912 test(SV("0001.234560P+3"), SV("{:014.6LA}"), F(0x1.23456p3
));
913 test(SV("-1.234560P+3$$$"), SV("{:$<15.6LA}"), F(-0x1.23456p3
));
914 test(SV("$$$-1.234560P+3"), SV("{:$>15.6LA}"), F(-0x1.23456p3
));
915 test(SV("$-1.234560P+3$$"), SV("{:$^15.6LA}"), F(-0x1.23456p3
));
916 test(SV("-0001.234560P+3"), SV("{:015.6LA}"), F(-0x1.23456p3
));
918 std::locale::global(loc
);
919 test(SV("1#234560P+3$$$"), SV("{:$<14.6LA}"), F(0x1.23456p3
));
920 test(SV("$$$1#234560P+3"), SV("{:$>14.6LA}"), F(0x1.23456p3
));
921 test(SV("$1#234560P+3$$"), SV("{:$^14.6LA}"), F(0x1.23456p3
));
922 test(SV("0001#234560P+3"), SV("{:014.6LA}"), F(0x1.23456p3
));
923 test(SV("-1#234560P+3$$$"), SV("{:$<15.6LA}"), F(-0x1.23456p3
));
924 test(SV("$$$-1#234560P+3"), SV("{:$>15.6LA}"), F(-0x1.23456p3
));
925 test(SV("$-1#234560P+3$$"), SV("{:$^15.6LA}"), F(-0x1.23456p3
));
926 test(SV("-0001#234560P+3"), SV("{:015.6LA}"), F(-0x1.23456p3
));
928 test(SV("1.234560P+3$$$"), en_US
, SV("{:$<14.6LA}"), F(0x1.23456p3
));
929 test(SV("$$$1.234560P+3"), en_US
, SV("{:$>14.6LA}"), F(0x1.23456p3
));
930 test(SV("$1.234560P+3$$"), en_US
, SV("{:$^14.6LA}"), F(0x1.23456p3
));
931 test(SV("0001.234560P+3"), en_US
, SV("{:014.6LA}"), F(0x1.23456p3
));
932 test(SV("-1.234560P+3$$$"), en_US
, SV("{:$<15.6LA}"), F(-0x1.23456p3
));
933 test(SV("$$$-1.234560P+3"), en_US
, SV("{:$>15.6LA}"), F(-0x1.23456p3
));
934 test(SV("$-1.234560P+3$$"), en_US
, SV("{:$^15.6LA}"), F(-0x1.23456p3
));
935 test(SV("-0001.234560P+3"), en_US
, SV("{:015.6LA}"), F(-0x1.23456p3
));
937 std::locale::global(en_US
);
938 test(SV("1#234560P+3$$$"), loc
, SV("{:$<14.6LA}"), F(0x1.23456p3
));
939 test(SV("$$$1#234560P+3"), loc
, SV("{:$>14.6LA}"), F(0x1.23456p3
));
940 test(SV("$1#234560P+3$$"), loc
, SV("{:$^14.6LA}"), F(0x1.23456p3
));
941 test(SV("0001#234560P+3"), loc
, SV("{:014.6LA}"), F(0x1.23456p3
));
942 test(SV("-1#234560P+3$$$"), loc
, SV("{:$<15.6LA}"), F(-0x1.23456p3
));
943 test(SV("$$$-1#234560P+3"), loc
, SV("{:$>15.6LA}"), F(-0x1.23456p3
));
944 test(SV("$-1#234560P+3$$"), loc
, SV("{:$^15.6LA}"), F(-0x1.23456p3
));
945 test(SV("-0001#234560P+3"), loc
, SV("{:015.6LA}"), F(-0x1.23456p3
));
948 template <class F
, class CharT
>
949 void test_floating_point_scientific_lower_case() {
950 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
951 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
954 std::locale::global(en_US
);
955 test(SV("1.234567e-03"), SV("{:.6Le}"), F(1.234567e-3));
956 test(SV("1.234567e-02"), SV("{:.6Le}"), F(1.234567e-2));
957 test(SV("1.234567e-01"), SV("{:.6Le}"), F(1.234567e-1));
958 test(SV("1.234567e+00"), SV("{:.6Le}"), F(1.234567e0
));
959 test(SV("1.234567e+01"), SV("{:.6Le}"), F(1.234567e1
));
960 test(SV("1.234567e+02"), SV("{:.6Le}"), F(1.234567e2
));
961 test(SV("1.234567e+03"), SV("{:.6Le}"), F(1.234567e3
));
962 test(SV("1.234567e+20"), SV("{:.6Le}"), F(1.234567e20
));
963 test(SV("-1.234567e-03"), SV("{:.6Le}"), F(-1.234567e-3));
964 test(SV("-1.234567e-02"), SV("{:.6Le}"), F(-1.234567e-2));
965 test(SV("-1.234567e-01"), SV("{:.6Le}"), F(-1.234567e-1));
966 test(SV("-1.234567e+00"), SV("{:.6Le}"), F(-1.234567e0
));
967 test(SV("-1.234567e+01"), SV("{:.6Le}"), F(-1.234567e1
));
968 test(SV("-1.234567e+02"), SV("{:.6Le}"), F(-1.234567e2
));
969 test(SV("-1.234567e+03"), SV("{:.6Le}"), F(-1.234567e3
));
970 test(SV("-1.234567e+20"), SV("{:.6Le}"), F(-1.234567e20
));
972 std::locale::global(loc
);
973 test(SV("1#234567e-03"), SV("{:.6Le}"), F(1.234567e-3));
974 test(SV("1#234567e-02"), SV("{:.6Le}"), F(1.234567e-2));
975 test(SV("1#234567e-01"), SV("{:.6Le}"), F(1.234567e-1));
976 test(SV("1#234567e+00"), SV("{:.6Le}"), F(1.234567e0
));
977 test(SV("1#234567e+01"), SV("{:.6Le}"), F(1.234567e1
));
978 test(SV("1#234567e+02"), SV("{:.6Le}"), F(1.234567e2
));
979 test(SV("1#234567e+03"), SV("{:.6Le}"), F(1.234567e3
));
980 test(SV("1#234567e+20"), SV("{:.6Le}"), F(1.234567e20
));
981 test(SV("-1#234567e-03"), SV("{:.6Le}"), F(-1.234567e-3));
982 test(SV("-1#234567e-02"), SV("{:.6Le}"), F(-1.234567e-2));
983 test(SV("-1#234567e-01"), SV("{:.6Le}"), F(-1.234567e-1));
984 test(SV("-1#234567e+00"), SV("{:.6Le}"), F(-1.234567e0
));
985 test(SV("-1#234567e+01"), SV("{:.6Le}"), F(-1.234567e1
));
986 test(SV("-1#234567e+02"), SV("{:.6Le}"), F(-1.234567e2
));
987 test(SV("-1#234567e+03"), SV("{:.6Le}"), F(-1.234567e3
));
988 test(SV("-1#234567e+20"), SV("{:.6Le}"), F(-1.234567e20
));
990 test(SV("1.234567e-03"), en_US
, SV("{:.6Le}"), F(1.234567e-3));
991 test(SV("1.234567e-02"), en_US
, SV("{:.6Le}"), F(1.234567e-2));
992 test(SV("1.234567e-01"), en_US
, SV("{:.6Le}"), F(1.234567e-1));
993 test(SV("1.234567e+00"), en_US
, SV("{:.6Le}"), F(1.234567e0
));
994 test(SV("1.234567e+01"), en_US
, SV("{:.6Le}"), F(1.234567e1
));
995 test(SV("1.234567e+02"), en_US
, SV("{:.6Le}"), F(1.234567e2
));
996 test(SV("1.234567e+03"), en_US
, SV("{:.6Le}"), F(1.234567e3
));
997 test(SV("1.234567e+20"), en_US
, SV("{:.6Le}"), F(1.234567e20
));
998 test(SV("-1.234567e-03"), en_US
, SV("{:.6Le}"), F(-1.234567e-3));
999 test(SV("-1.234567e-02"), en_US
, SV("{:.6Le}"), F(-1.234567e-2));
1000 test(SV("-1.234567e-01"), en_US
, SV("{:.6Le}"), F(-1.234567e-1));
1001 test(SV("-1.234567e+00"), en_US
, SV("{:.6Le}"), F(-1.234567e0
));
1002 test(SV("-1.234567e+01"), en_US
, SV("{:.6Le}"), F(-1.234567e1
));
1003 test(SV("-1.234567e+02"), en_US
, SV("{:.6Le}"), F(-1.234567e2
));
1004 test(SV("-1.234567e+03"), en_US
, SV("{:.6Le}"), F(-1.234567e3
));
1005 test(SV("-1.234567e+20"), en_US
, SV("{:.6Le}"), F(-1.234567e20
));
1007 std::locale::global(en_US
);
1008 test(SV("1#234567e-03"), loc
, SV("{:.6Le}"), F(1.234567e-3));
1009 test(SV("1#234567e-02"), loc
, SV("{:.6Le}"), F(1.234567e-2));
1010 test(SV("1#234567e-01"), loc
, SV("{:.6Le}"), F(1.234567e-1));
1011 test(SV("1#234567e+00"), loc
, SV("{:.6Le}"), F(1.234567e0
));
1012 test(SV("1#234567e+01"), loc
, SV("{:.6Le}"), F(1.234567e1
));
1013 test(SV("1#234567e+02"), loc
, SV("{:.6Le}"), F(1.234567e2
));
1014 test(SV("1#234567e+03"), loc
, SV("{:.6Le}"), F(1.234567e3
));
1015 test(SV("1#234567e+20"), loc
, SV("{:.6Le}"), F(1.234567e20
));
1016 test(SV("-1#234567e-03"), loc
, SV("{:.6Le}"), F(-1.234567e-3));
1017 test(SV("-1#234567e-02"), loc
, SV("{:.6Le}"), F(-1.234567e-2));
1018 test(SV("-1#234567e-01"), loc
, SV("{:.6Le}"), F(-1.234567e-1));
1019 test(SV("-1#234567e+00"), loc
, SV("{:.6Le}"), F(-1.234567e0
));
1020 test(SV("-1#234567e+01"), loc
, SV("{:.6Le}"), F(-1.234567e1
));
1021 test(SV("-1#234567e+02"), loc
, SV("{:.6Le}"), F(-1.234567e2
));
1022 test(SV("-1#234567e+03"), loc
, SV("{:.6Le}"), F(-1.234567e3
));
1023 test(SV("-1#234567e+20"), loc
, SV("{:.6Le}"), F(-1.234567e20
));
1025 // *** Fill, align, zero padding ***
1026 std::locale::global(en_US
);
1027 test(SV("1.234567e+03$$$"), SV("{:$<15.6Le}"), F(1.234567e3
));
1028 test(SV("$$$1.234567e+03"), SV("{:$>15.6Le}"), F(1.234567e3
));
1029 test(SV("$1.234567e+03$$"), SV("{:$^15.6Le}"), F(1.234567e3
));
1030 test(SV("0001.234567e+03"), SV("{:015.6Le}"), F(1.234567e3
));
1031 test(SV("-1.234567e+03$$$"), SV("{:$<16.6Le}"), F(-1.234567e3
));
1032 test(SV("$$$-1.234567e+03"), SV("{:$>16.6Le}"), F(-1.234567e3
));
1033 test(SV("$-1.234567e+03$$"), SV("{:$^16.6Le}"), F(-1.234567e3
));
1034 test(SV("-0001.234567e+03"), SV("{:016.6Le}"), F(-1.234567e3
));
1036 std::locale::global(loc
);
1037 test(SV("1#234567e+03$$$"), SV("{:$<15.6Le}"), F(1.234567e3
));
1038 test(SV("$$$1#234567e+03"), SV("{:$>15.6Le}"), F(1.234567e3
));
1039 test(SV("$1#234567e+03$$"), SV("{:$^15.6Le}"), F(1.234567e3
));
1040 test(SV("0001#234567e+03"), SV("{:015.6Le}"), F(1.234567e3
));
1041 test(SV("-1#234567e+03$$$"), SV("{:$<16.6Le}"), F(-1.234567e3
));
1042 test(SV("$$$-1#234567e+03"), SV("{:$>16.6Le}"), F(-1.234567e3
));
1043 test(SV("$-1#234567e+03$$"), SV("{:$^16.6Le}"), F(-1.234567e3
));
1044 test(SV("-0001#234567e+03"), SV("{:016.6Le}"), F(-1.234567e3
));
1046 test(SV("1.234567e+03$$$"), en_US
, SV("{:$<15.6Le}"), F(1.234567e3
));
1047 test(SV("$$$1.234567e+03"), en_US
, SV("{:$>15.6Le}"), F(1.234567e3
));
1048 test(SV("$1.234567e+03$$"), en_US
, SV("{:$^15.6Le}"), F(1.234567e3
));
1049 test(SV("0001.234567e+03"), en_US
, SV("{:015.6Le}"), F(1.234567e3
));
1050 test(SV("-1.234567e+03$$$"), en_US
, SV("{:$<16.6Le}"), F(-1.234567e3
));
1051 test(SV("$$$-1.234567e+03"), en_US
, SV("{:$>16.6Le}"), F(-1.234567e3
));
1052 test(SV("$-1.234567e+03$$"), en_US
, SV("{:$^16.6Le}"), F(-1.234567e3
));
1053 test(SV("-0001.234567e+03"), en_US
, SV("{:016.6Le}"), F(-1.234567e3
));
1055 std::locale::global(en_US
);
1056 test(SV("1#234567e+03$$$"), loc
, SV("{:$<15.6Le}"), F(1.234567e3
));
1057 test(SV("$$$1#234567e+03"), loc
, SV("{:$>15.6Le}"), F(1.234567e3
));
1058 test(SV("$1#234567e+03$$"), loc
, SV("{:$^15.6Le}"), F(1.234567e3
));
1059 test(SV("0001#234567e+03"), loc
, SV("{:015.6Le}"), F(1.234567e3
));
1060 test(SV("-1#234567e+03$$$"), loc
, SV("{:$<16.6Le}"), F(-1.234567e3
));
1061 test(SV("$$$-1#234567e+03"), loc
, SV("{:$>16.6Le}"), F(-1.234567e3
));
1062 test(SV("$-1#234567e+03$$"), loc
, SV("{:$^16.6Le}"), F(-1.234567e3
));
1063 test(SV("-0001#234567e+03"), loc
, SV("{:016.6Le}"), F(-1.234567e3
));
1066 template <class F
, class CharT
>
1067 void test_floating_point_scientific_upper_case() {
1068 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1069 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1072 std::locale::global(en_US
);
1073 test(SV("1.234567E-03"), SV("{:.6LE}"), F(1.234567e-3));
1074 test(SV("1.234567E-02"), SV("{:.6LE}"), F(1.234567e-2));
1075 test(SV("1.234567E-01"), SV("{:.6LE}"), F(1.234567e-1));
1076 test(SV("1.234567E+00"), SV("{:.6LE}"), F(1.234567e0
));
1077 test(SV("1.234567E+01"), SV("{:.6LE}"), F(1.234567e1
));
1078 test(SV("1.234567E+02"), SV("{:.6LE}"), F(1.234567e2
));
1079 test(SV("1.234567E+03"), SV("{:.6LE}"), F(1.234567e3
));
1080 test(SV("1.234567E+20"), SV("{:.6LE}"), F(1.234567e20
));
1081 test(SV("-1.234567E-03"), SV("{:.6LE}"), F(-1.234567e-3));
1082 test(SV("-1.234567E-02"), SV("{:.6LE}"), F(-1.234567e-2));
1083 test(SV("-1.234567E-01"), SV("{:.6LE}"), F(-1.234567e-1));
1084 test(SV("-1.234567E+00"), SV("{:.6LE}"), F(-1.234567e0
));
1085 test(SV("-1.234567E+01"), SV("{:.6LE}"), F(-1.234567e1
));
1086 test(SV("-1.234567E+02"), SV("{:.6LE}"), F(-1.234567e2
));
1087 test(SV("-1.234567E+03"), SV("{:.6LE}"), F(-1.234567e3
));
1088 test(SV("-1.234567E+20"), SV("{:.6LE}"), F(-1.234567e20
));
1090 std::locale::global(loc
);
1091 test(SV("1#234567E-03"), SV("{:.6LE}"), F(1.234567e-3));
1092 test(SV("1#234567E-02"), SV("{:.6LE}"), F(1.234567e-2));
1093 test(SV("1#234567E-01"), SV("{:.6LE}"), F(1.234567e-1));
1094 test(SV("1#234567E+00"), SV("{:.6LE}"), F(1.234567e0
));
1095 test(SV("1#234567E+01"), SV("{:.6LE}"), F(1.234567e1
));
1096 test(SV("1#234567E+02"), SV("{:.6LE}"), F(1.234567e2
));
1097 test(SV("1#234567E+03"), SV("{:.6LE}"), F(1.234567e3
));
1098 test(SV("1#234567E+20"), SV("{:.6LE}"), F(1.234567e20
));
1099 test(SV("-1#234567E-03"), SV("{:.6LE}"), F(-1.234567e-3));
1100 test(SV("-1#234567E-02"), SV("{:.6LE}"), F(-1.234567e-2));
1101 test(SV("-1#234567E-01"), SV("{:.6LE}"), F(-1.234567e-1));
1102 test(SV("-1#234567E+00"), SV("{:.6LE}"), F(-1.234567e0
));
1103 test(SV("-1#234567E+01"), SV("{:.6LE}"), F(-1.234567e1
));
1104 test(SV("-1#234567E+02"), SV("{:.6LE}"), F(-1.234567e2
));
1105 test(SV("-1#234567E+03"), SV("{:.6LE}"), F(-1.234567e3
));
1106 test(SV("-1#234567E+20"), SV("{:.6LE}"), F(-1.234567e20
));
1108 test(SV("1.234567E-03"), en_US
, SV("{:.6LE}"), F(1.234567e-3));
1109 test(SV("1.234567E-02"), en_US
, SV("{:.6LE}"), F(1.234567e-2));
1110 test(SV("1.234567E-01"), en_US
, SV("{:.6LE}"), F(1.234567e-1));
1111 test(SV("1.234567E+00"), en_US
, SV("{:.6LE}"), F(1.234567e0
));
1112 test(SV("1.234567E+01"), en_US
, SV("{:.6LE}"), F(1.234567e1
));
1113 test(SV("1.234567E+02"), en_US
, SV("{:.6LE}"), F(1.234567e2
));
1114 test(SV("1.234567E+03"), en_US
, SV("{:.6LE}"), F(1.234567e3
));
1115 test(SV("1.234567E+20"), en_US
, SV("{:.6LE}"), F(1.234567e20
));
1116 test(SV("-1.234567E-03"), en_US
, SV("{:.6LE}"), F(-1.234567e-3));
1117 test(SV("-1.234567E-02"), en_US
, SV("{:.6LE}"), F(-1.234567e-2));
1118 test(SV("-1.234567E-01"), en_US
, SV("{:.6LE}"), F(-1.234567e-1));
1119 test(SV("-1.234567E+00"), en_US
, SV("{:.6LE}"), F(-1.234567e0
));
1120 test(SV("-1.234567E+01"), en_US
, SV("{:.6LE}"), F(-1.234567e1
));
1121 test(SV("-1.234567E+02"), en_US
, SV("{:.6LE}"), F(-1.234567e2
));
1122 test(SV("-1.234567E+03"), en_US
, SV("{:.6LE}"), F(-1.234567e3
));
1123 test(SV("-1.234567E+20"), en_US
, SV("{:.6LE}"), F(-1.234567e20
));
1125 std::locale::global(en_US
);
1126 test(SV("1#234567E-03"), loc
, SV("{:.6LE}"), F(1.234567e-3));
1127 test(SV("1#234567E-02"), loc
, SV("{:.6LE}"), F(1.234567e-2));
1128 test(SV("1#234567E-01"), loc
, SV("{:.6LE}"), F(1.234567e-1));
1129 test(SV("1#234567E+00"), loc
, SV("{:.6LE}"), F(1.234567e0
));
1130 test(SV("1#234567E+01"), loc
, SV("{:.6LE}"), F(1.234567e1
));
1131 test(SV("1#234567E+02"), loc
, SV("{:.6LE}"), F(1.234567e2
));
1132 test(SV("1#234567E+03"), loc
, SV("{:.6LE}"), F(1.234567e3
));
1133 test(SV("1#234567E+20"), loc
, SV("{:.6LE}"), F(1.234567e20
));
1134 test(SV("-1#234567E-03"), loc
, SV("{:.6LE}"), F(-1.234567e-3));
1135 test(SV("-1#234567E-02"), loc
, SV("{:.6LE}"), F(-1.234567e-2));
1136 test(SV("-1#234567E-01"), loc
, SV("{:.6LE}"), F(-1.234567e-1));
1137 test(SV("-1#234567E+00"), loc
, SV("{:.6LE}"), F(-1.234567e0
));
1138 test(SV("-1#234567E+01"), loc
, SV("{:.6LE}"), F(-1.234567e1
));
1139 test(SV("-1#234567E+02"), loc
, SV("{:.6LE}"), F(-1.234567e2
));
1140 test(SV("-1#234567E+03"), loc
, SV("{:.6LE}"), F(-1.234567e3
));
1141 test(SV("-1#234567E+20"), loc
, SV("{:.6LE}"), F(-1.234567e20
));
1143 // *** Fill, align, zero padding ***
1144 std::locale::global(en_US
);
1145 test(SV("1.234567E+03$$$"), SV("{:$<15.6LE}"), F(1.234567e3
));
1146 test(SV("$$$1.234567E+03"), SV("{:$>15.6LE}"), F(1.234567e3
));
1147 test(SV("$1.234567E+03$$"), SV("{:$^15.6LE}"), F(1.234567e3
));
1148 test(SV("0001.234567E+03"), SV("{:015.6LE}"), F(1.234567e3
));
1149 test(SV("-1.234567E+03$$$"), SV("{:$<16.6LE}"), F(-1.234567e3
));
1150 test(SV("$$$-1.234567E+03"), SV("{:$>16.6LE}"), F(-1.234567e3
));
1151 test(SV("$-1.234567E+03$$"), SV("{:$^16.6LE}"), F(-1.234567e3
));
1152 test(SV("-0001.234567E+03"), SV("{:016.6LE}"), F(-1.234567e3
));
1154 std::locale::global(loc
);
1155 test(SV("1#234567E+03$$$"), SV("{:$<15.6LE}"), F(1.234567e3
));
1156 test(SV("$$$1#234567E+03"), SV("{:$>15.6LE}"), F(1.234567e3
));
1157 test(SV("$1#234567E+03$$"), SV("{:$^15.6LE}"), F(1.234567e3
));
1158 test(SV("0001#234567E+03"), SV("{:015.6LE}"), F(1.234567e3
));
1159 test(SV("-1#234567E+03$$$"), SV("{:$<16.6LE}"), F(-1.234567e3
));
1160 test(SV("$$$-1#234567E+03"), SV("{:$>16.6LE}"), F(-1.234567e3
));
1161 test(SV("$-1#234567E+03$$"), SV("{:$^16.6LE}"), F(-1.234567e3
));
1162 test(SV("-0001#234567E+03"), SV("{:016.6LE}"), F(-1.234567e3
));
1164 test(SV("1.234567E+03$$$"), en_US
, SV("{:$<15.6LE}"), F(1.234567e3
));
1165 test(SV("$$$1.234567E+03"), en_US
, SV("{:$>15.6LE}"), F(1.234567e3
));
1166 test(SV("$1.234567E+03$$"), en_US
, SV("{:$^15.6LE}"), F(1.234567e3
));
1167 test(SV("0001.234567E+03"), en_US
, SV("{:015.6LE}"), F(1.234567e3
));
1168 test(SV("-1.234567E+03$$$"), en_US
, SV("{:$<16.6LE}"), F(-1.234567e3
));
1169 test(SV("$$$-1.234567E+03"), en_US
, SV("{:$>16.6LE}"), F(-1.234567e3
));
1170 test(SV("$-1.234567E+03$$"), en_US
, SV("{:$^16.6LE}"), F(-1.234567e3
));
1171 test(SV("-0001.234567E+03"), en_US
, SV("{:016.6LE}"), F(-1.234567e3
));
1173 std::locale::global(en_US
);
1174 test(SV("1#234567E+03$$$"), loc
, SV("{:$<15.6LE}"), F(1.234567e3
));
1175 test(SV("$$$1#234567E+03"), loc
, SV("{:$>15.6LE}"), F(1.234567e3
));
1176 test(SV("$1#234567E+03$$"), loc
, SV("{:$^15.6LE}"), F(1.234567e3
));
1177 test(SV("0001#234567E+03"), loc
, SV("{:015.6LE}"), F(1.234567e3
));
1178 test(SV("-1#234567E+03$$$"), loc
, SV("{:$<16.6LE}"), F(-1.234567e3
));
1179 test(SV("$$$-1#234567E+03"), loc
, SV("{:$>16.6LE}"), F(-1.234567e3
));
1180 test(SV("$-1#234567E+03$$"), loc
, SV("{:$^16.6LE}"), F(-1.234567e3
));
1181 test(SV("-0001#234567E+03"), loc
, SV("{:016.6LE}"), F(-1.234567e3
));
1184 template <class F
, class CharT
>
1185 void test_floating_point_fixed_lower_case() {
1186 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1187 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1190 std::locale::global(en_US
);
1191 test(SV("0.000001"), SV("{:.6Lf}"), F(1.234567e-6));
1192 test(SV("0.000012"), SV("{:.6Lf}"), F(1.234567e-5));
1193 test(SV("0.000123"), SV("{:.6Lf}"), F(1.234567e-4));
1194 test(SV("0.001235"), SV("{:.6Lf}"), F(1.234567e-3));
1195 test(SV("0.012346"), SV("{:.6Lf}"), F(1.234567e-2));
1196 test(SV("0.123457"), SV("{:.6Lf}"), F(1.234567e-1));
1197 test(SV("1.234567"), SV("{:.6Lf}"), F(1.234567e0
));
1198 test(SV("12.345670"), SV("{:.6Lf}"), F(1.234567e1
));
1199 if constexpr (sizeof(F
) > sizeof(float)) {
1200 test(SV("123.456700"), SV("{:.6Lf}"), F(1.234567e2
));
1201 test(SV("1,234.567000"), SV("{:.6Lf}"), F(1.234567e3
));
1202 test(SV("12,345.670000"), SV("{:.6Lf}"), F(1.234567e4
));
1203 test(SV("123,456.700000"), SV("{:.6Lf}"), F(1.234567e5
));
1204 test(SV("1,234,567.000000"), SV("{:.6Lf}"), F(1.234567e6
));
1205 test(SV("12,345,670.000000"), SV("{:.6Lf}"), F(1.234567e7
));
1206 test(SV("123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(1.234567e20
));
1208 test(SV("-0.000001"), SV("{:.6Lf}"), F(-1.234567e-6));
1209 test(SV("-0.000012"), SV("{:.6Lf}"), F(-1.234567e-5));
1210 test(SV("-0.000123"), SV("{:.6Lf}"), F(-1.234567e-4));
1211 test(SV("-0.001235"), SV("{:.6Lf}"), F(-1.234567e-3));
1212 test(SV("-0.012346"), SV("{:.6Lf}"), F(-1.234567e-2));
1213 test(SV("-0.123457"), SV("{:.6Lf}"), F(-1.234567e-1));
1214 test(SV("-1.234567"), SV("{:.6Lf}"), F(-1.234567e0
));
1215 test(SV("-12.345670"), SV("{:.6Lf}"), F(-1.234567e1
));
1216 if constexpr (sizeof(F
) > sizeof(float)) {
1217 test(SV("-123.456700"), SV("{:.6Lf}"), F(-1.234567e2
));
1218 test(SV("-1,234.567000"), SV("{:.6Lf}"), F(-1.234567e3
));
1219 test(SV("-12,345.670000"), SV("{:.6Lf}"), F(-1.234567e4
));
1220 test(SV("-123,456.700000"), SV("{:.6Lf}"), F(-1.234567e5
));
1221 test(SV("-1,234,567.000000"), SV("{:.6Lf}"), F(-1.234567e6
));
1222 test(SV("-12,345,670.000000"), SV("{:.6Lf}"), F(-1.234567e7
));
1223 test(SV("-123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(-1.234567e20
));
1226 std::locale::global(loc
);
1227 test(SV("0#000001"), SV("{:.6Lf}"), F(1.234567e-6));
1228 test(SV("0#000012"), SV("{:.6Lf}"), F(1.234567e-5));
1229 test(SV("0#000123"), SV("{:.6Lf}"), F(1.234567e-4));
1230 test(SV("0#001235"), SV("{:.6Lf}"), F(1.234567e-3));
1231 test(SV("0#012346"), SV("{:.6Lf}"), F(1.234567e-2));
1232 test(SV("0#123457"), SV("{:.6Lf}"), F(1.234567e-1));
1233 test(SV("1#234567"), SV("{:.6Lf}"), F(1.234567e0
));
1234 test(SV("1_2#345670"), SV("{:.6Lf}"), F(1.234567e1
));
1235 if constexpr (sizeof(F
) > sizeof(float)) {
1236 test(SV("12_3#456700"), SV("{:.6Lf}"), F(1.234567e2
));
1237 test(SV("1_23_4#567000"), SV("{:.6Lf}"), F(1.234567e3
));
1238 test(SV("12_34_5#670000"), SV("{:.6Lf}"), F(1.234567e4
));
1239 test(SV("123_45_6#700000"), SV("{:.6Lf}"), F(1.234567e5
));
1240 test(SV("1_234_56_7#000000"), SV("{:.6Lf}"), F(1.234567e6
));
1241 test(SV("12_345_67_0#000000"), SV("{:.6Lf}"), F(1.234567e7
));
1242 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
));
1244 test(SV("-0#000001"), SV("{:.6Lf}"), F(-1.234567e-6));
1245 test(SV("-0#000012"), SV("{:.6Lf}"), F(-1.234567e-5));
1246 test(SV("-0#000123"), SV("{:.6Lf}"), F(-1.234567e-4));
1247 test(SV("-0#001235"), SV("{:.6Lf}"), F(-1.234567e-3));
1248 test(SV("-0#012346"), SV("{:.6Lf}"), F(-1.234567e-2));
1249 test(SV("-0#123457"), SV("{:.6Lf}"), F(-1.234567e-1));
1250 test(SV("-1#234567"), SV("{:.6Lf}"), F(-1.234567e0
));
1251 test(SV("-1_2#345670"), SV("{:.6Lf}"), F(-1.234567e1
));
1252 if constexpr (sizeof(F
) > sizeof(float)) {
1253 test(SV("-12_3#456700"), SV("{:.6Lf}"), F(-1.234567e2
));
1254 test(SV("-1_23_4#567000"), SV("{:.6Lf}"), F(-1.234567e3
));
1255 test(SV("-12_34_5#670000"), SV("{:.6Lf}"), F(-1.234567e4
));
1256 test(SV("-123_45_6#700000"), SV("{:.6Lf}"), F(-1.234567e5
));
1257 test(SV("-1_234_56_7#000000"), SV("{:.6Lf}"), F(-1.234567e6
));
1258 test(SV("-12_345_67_0#000000"), SV("{:.6Lf}"), F(-1.234567e7
));
1259 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
));
1262 test(SV("0.000001"), en_US
, SV("{:.6Lf}"), F(1.234567e-6));
1263 test(SV("0.000012"), en_US
, SV("{:.6Lf}"), F(1.234567e-5));
1264 test(SV("0.000123"), en_US
, SV("{:.6Lf}"), F(1.234567e-4));
1265 test(SV("0.001235"), en_US
, SV("{:.6Lf}"), F(1.234567e-3));
1266 test(SV("0.012346"), en_US
, SV("{:.6Lf}"), F(1.234567e-2));
1267 test(SV("0.123457"), en_US
, SV("{:.6Lf}"), F(1.234567e-1));
1268 test(SV("1.234567"), en_US
, SV("{:.6Lf}"), F(1.234567e0
));
1269 test(SV("12.345670"), en_US
, SV("{:.6Lf}"), F(1.234567e1
));
1270 if constexpr (sizeof(F
) > sizeof(float)) {
1271 test(SV("123.456700"), en_US
, SV("{:.6Lf}"), F(1.234567e2
));
1272 test(SV("1,234.567000"), en_US
, SV("{:.6Lf}"), F(1.234567e3
));
1273 test(SV("12,345.670000"), en_US
, SV("{:.6Lf}"), F(1.234567e4
));
1274 test(SV("123,456.700000"), en_US
, SV("{:.6Lf}"), F(1.234567e5
));
1275 test(SV("1,234,567.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e6
));
1276 test(SV("12,345,670.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e7
));
1277 test(SV("123,456,700,000,000,000,000.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e20
));
1279 test(SV("-0.000001"), en_US
, SV("{:.6Lf}"), F(-1.234567e-6));
1280 test(SV("-0.000012"), en_US
, SV("{:.6Lf}"), F(-1.234567e-5));
1281 test(SV("-0.000123"), en_US
, SV("{:.6Lf}"), F(-1.234567e-4));
1282 test(SV("-0.001235"), en_US
, SV("{:.6Lf}"), F(-1.234567e-3));
1283 test(SV("-0.012346"), en_US
, SV("{:.6Lf}"), F(-1.234567e-2));
1284 test(SV("-0.123457"), en_US
, SV("{:.6Lf}"), F(-1.234567e-1));
1285 test(SV("-1.234567"), en_US
, SV("{:.6Lf}"), F(-1.234567e0
));
1286 test(SV("-12.345670"), en_US
, SV("{:.6Lf}"), F(-1.234567e1
));
1287 if constexpr (sizeof(F
) > sizeof(float)) {
1288 test(SV("-123.456700"), en_US
, SV("{:.6Lf}"), F(-1.234567e2
));
1289 test(SV("-1,234.567000"), en_US
, SV("{:.6Lf}"), F(-1.234567e3
));
1290 test(SV("-12,345.670000"), en_US
, SV("{:.6Lf}"), F(-1.234567e4
));
1291 test(SV("-123,456.700000"), en_US
, SV("{:.6Lf}"), F(-1.234567e5
));
1292 test(SV("-1,234,567.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e6
));
1293 test(SV("-12,345,670.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e7
));
1294 test(SV("-123,456,700,000,000,000,000.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e20
));
1297 std::locale::global(en_US
);
1298 test(SV("0#000001"), loc
, SV("{:.6Lf}"), F(1.234567e-6));
1299 test(SV("0#000012"), loc
, SV("{:.6Lf}"), F(1.234567e-5));
1300 test(SV("0#000123"), loc
, SV("{:.6Lf}"), F(1.234567e-4));
1301 test(SV("0#001235"), loc
, SV("{:.6Lf}"), F(1.234567e-3));
1302 test(SV("0#012346"), loc
, SV("{:.6Lf}"), F(1.234567e-2));
1303 test(SV("0#123457"), loc
, SV("{:.6Lf}"), F(1.234567e-1));
1304 test(SV("1#234567"), loc
, SV("{:.6Lf}"), F(1.234567e0
));
1305 test(SV("1_2#345670"), loc
, SV("{:.6Lf}"), F(1.234567e1
));
1306 if constexpr (sizeof(F
) > sizeof(float)) {
1307 test(SV("12_3#456700"), loc
, SV("{:.6Lf}"), F(1.234567e2
));
1308 test(SV("1_23_4#567000"), loc
, SV("{:.6Lf}"), F(1.234567e3
));
1309 test(SV("12_34_5#670000"), loc
, SV("{:.6Lf}"), F(1.234567e4
));
1310 test(SV("123_45_6#700000"), loc
, SV("{:.6Lf}"), F(1.234567e5
));
1311 test(SV("1_234_56_7#000000"), loc
, SV("{:.6Lf}"), F(1.234567e6
));
1312 test(SV("12_345_67_0#000000"), loc
, SV("{:.6Lf}"), F(1.234567e7
));
1313 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
));
1315 test(SV("-0#000001"), loc
, SV("{:.6Lf}"), F(-1.234567e-6));
1316 test(SV("-0#000012"), loc
, SV("{:.6Lf}"), F(-1.234567e-5));
1317 test(SV("-0#000123"), loc
, SV("{:.6Lf}"), F(-1.234567e-4));
1318 test(SV("-0#001235"), loc
, SV("{:.6Lf}"), F(-1.234567e-3));
1319 test(SV("-0#012346"), loc
, SV("{:.6Lf}"), F(-1.234567e-2));
1320 test(SV("-0#123457"), loc
, SV("{:.6Lf}"), F(-1.234567e-1));
1321 test(SV("-1#234567"), loc
, SV("{:.6Lf}"), F(-1.234567e0
));
1322 test(SV("-1_2#345670"), loc
, SV("{:.6Lf}"), F(-1.234567e1
));
1323 if constexpr (sizeof(F
) > sizeof(float)) {
1324 test(SV("-12_3#456700"), loc
, SV("{:.6Lf}"), F(-1.234567e2
));
1325 test(SV("-1_23_4#567000"), loc
, SV("{:.6Lf}"), F(-1.234567e3
));
1326 test(SV("-12_34_5#670000"), loc
, SV("{:.6Lf}"), F(-1.234567e4
));
1327 test(SV("-123_45_6#700000"), loc
, SV("{:.6Lf}"), F(-1.234567e5
));
1328 test(SV("-1_234_56_7#000000"), loc
, SV("{:.6Lf}"), F(-1.234567e6
));
1329 test(SV("-12_345_67_0#000000"), loc
, SV("{:.6Lf}"), F(-1.234567e7
));
1330 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
));
1333 // *** Fill, align, zero padding ***
1334 if constexpr (sizeof(F
) > sizeof(float)) {
1335 std::locale::global(en_US
);
1336 test(SV("1,234.567000$$$"), SV("{:$<15.6Lf}"), F(1.234567e3
));
1337 test(SV("$$$1,234.567000"), SV("{:$>15.6Lf}"), F(1.234567e3
));
1338 test(SV("$1,234.567000$$"), SV("{:$^15.6Lf}"), F(1.234567e3
));
1339 test(SV("0001,234.567000"), SV("{:015.6Lf}"), F(1.234567e3
));
1340 test(SV("-1,234.567000$$$"), SV("{:$<16.6Lf}"), F(-1.234567e3
));
1341 test(SV("$$$-1,234.567000"), SV("{:$>16.6Lf}"), F(-1.234567e3
));
1342 test(SV("$-1,234.567000$$"), SV("{:$^16.6Lf}"), F(-1.234567e3
));
1343 test(SV("-0001,234.567000"), SV("{:016.6Lf}"), F(-1.234567e3
));
1345 std::locale::global(loc
);
1346 test(SV("1_23_4#567000$$$"), SV("{:$<16.6Lf}"), F(1.234567e3
));
1347 test(SV("$$$1_23_4#567000"), SV("{:$>16.6Lf}"), F(1.234567e3
));
1348 test(SV("$1_23_4#567000$$"), SV("{:$^16.6Lf}"), F(1.234567e3
));
1349 test(SV("0001_23_4#567000"), SV("{:016.6Lf}"), F(1.234567e3
));
1350 test(SV("-1_23_4#567000$$$"), SV("{:$<17.6Lf}"), F(-1.234567e3
));
1351 test(SV("$$$-1_23_4#567000"), SV("{:$>17.6Lf}"), F(-1.234567e3
));
1352 test(SV("$-1_23_4#567000$$"), SV("{:$^17.6Lf}"), F(-1.234567e3
));
1353 test(SV("-0001_23_4#567000"), SV("{:017.6Lf}"), F(-1.234567e3
));
1355 test(SV("1,234.567000$$$"), en_US
, SV("{:$<15.6Lf}"), F(1.234567e3
));
1356 test(SV("$$$1,234.567000"), en_US
, SV("{:$>15.6Lf}"), F(1.234567e3
));
1357 test(SV("$1,234.567000$$"), en_US
, SV("{:$^15.6Lf}"), F(1.234567e3
));
1358 test(SV("0001,234.567000"), en_US
, SV("{:015.6Lf}"), F(1.234567e3
));
1359 test(SV("-1,234.567000$$$"), en_US
, SV("{:$<16.6Lf}"), F(-1.234567e3
));
1360 test(SV("$$$-1,234.567000"), en_US
, SV("{:$>16.6Lf}"), F(-1.234567e3
));
1361 test(SV("$-1,234.567000$$"), en_US
, SV("{:$^16.6Lf}"), F(-1.234567e3
));
1362 test(SV("-0001,234.567000"), en_US
, SV("{:016.6Lf}"), F(-1.234567e3
));
1364 std::locale::global(en_US
);
1365 test(SV("1_23_4#567000$$$"), loc
, SV("{:$<16.6Lf}"), F(1.234567e3
));
1366 test(SV("$$$1_23_4#567000"), loc
, SV("{:$>16.6Lf}"), F(1.234567e3
));
1367 test(SV("$1_23_4#567000$$"), loc
, SV("{:$^16.6Lf}"), F(1.234567e3
));
1368 test(SV("0001_23_4#567000"), loc
, SV("{:016.6Lf}"), F(1.234567e3
));
1369 test(SV("-1_23_4#567000$$$"), loc
, SV("{:$<17.6Lf}"), F(-1.234567e3
));
1370 test(SV("$$$-1_23_4#567000"), loc
, SV("{:$>17.6Lf}"), F(-1.234567e3
));
1371 test(SV("$-1_23_4#567000$$"), loc
, SV("{:$^17.6Lf}"), F(-1.234567e3
));
1372 test(SV("-0001_23_4#567000"), loc
, SV("{:017.6Lf}"), F(-1.234567e3
));
1376 template <class F
, class CharT
>
1377 void test_floating_point_fixed_upper_case() {
1378 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1379 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1382 std::locale::global(en_US
);
1383 test(SV("0.000001"), SV("{:.6Lf}"), F(1.234567e-6));
1384 test(SV("0.000012"), SV("{:.6Lf}"), F(1.234567e-5));
1385 test(SV("0.000123"), SV("{:.6Lf}"), F(1.234567e-4));
1386 test(SV("0.001235"), SV("{:.6Lf}"), F(1.234567e-3));
1387 test(SV("0.012346"), SV("{:.6Lf}"), F(1.234567e-2));
1388 test(SV("0.123457"), SV("{:.6Lf}"), F(1.234567e-1));
1389 test(SV("1.234567"), SV("{:.6Lf}"), F(1.234567e0
));
1390 test(SV("12.345670"), SV("{:.6Lf}"), F(1.234567e1
));
1391 if constexpr (sizeof(F
) > sizeof(float)) {
1392 test(SV("123.456700"), SV("{:.6Lf}"), F(1.234567e2
));
1393 test(SV("1,234.567000"), SV("{:.6Lf}"), F(1.234567e3
));
1394 test(SV("12,345.670000"), SV("{:.6Lf}"), F(1.234567e4
));
1395 test(SV("123,456.700000"), SV("{:.6Lf}"), F(1.234567e5
));
1396 test(SV("1,234,567.000000"), SV("{:.6Lf}"), F(1.234567e6
));
1397 test(SV("12,345,670.000000"), SV("{:.6Lf}"), F(1.234567e7
));
1398 test(SV("123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(1.234567e20
));
1400 test(SV("-0.000001"), SV("{:.6Lf}"), F(-1.234567e-6));
1401 test(SV("-0.000012"), SV("{:.6Lf}"), F(-1.234567e-5));
1402 test(SV("-0.000123"), SV("{:.6Lf}"), F(-1.234567e-4));
1403 test(SV("-0.001235"), SV("{:.6Lf}"), F(-1.234567e-3));
1404 test(SV("-0.012346"), SV("{:.6Lf}"), F(-1.234567e-2));
1405 test(SV("-0.123457"), SV("{:.6Lf}"), F(-1.234567e-1));
1406 test(SV("-1.234567"), SV("{:.6Lf}"), F(-1.234567e0
));
1407 test(SV("-12.345670"), SV("{:.6Lf}"), F(-1.234567e1
));
1408 if constexpr (sizeof(F
) > sizeof(float)) {
1409 test(SV("-123.456700"), SV("{:.6Lf}"), F(-1.234567e2
));
1410 test(SV("-1,234.567000"), SV("{:.6Lf}"), F(-1.234567e3
));
1411 test(SV("-12,345.670000"), SV("{:.6Lf}"), F(-1.234567e4
));
1412 test(SV("-123,456.700000"), SV("{:.6Lf}"), F(-1.234567e5
));
1413 test(SV("-1,234,567.000000"), SV("{:.6Lf}"), F(-1.234567e6
));
1414 test(SV("-12,345,670.000000"), SV("{:.6Lf}"), F(-1.234567e7
));
1415 test(SV("-123,456,700,000,000,000,000.000000"), SV("{:.6Lf}"), F(-1.234567e20
));
1418 std::locale::global(loc
);
1419 test(SV("0#000001"), SV("{:.6Lf}"), F(1.234567e-6));
1420 test(SV("0#000012"), SV("{:.6Lf}"), F(1.234567e-5));
1421 test(SV("0#000123"), SV("{:.6Lf}"), F(1.234567e-4));
1422 test(SV("0#001235"), SV("{:.6Lf}"), F(1.234567e-3));
1423 test(SV("0#012346"), SV("{:.6Lf}"), F(1.234567e-2));
1424 test(SV("0#123457"), SV("{:.6Lf}"), F(1.234567e-1));
1425 test(SV("1#234567"), SV("{:.6Lf}"), F(1.234567e0
));
1426 test(SV("1_2#345670"), SV("{:.6Lf}"), F(1.234567e1
));
1427 if constexpr (sizeof(F
) > sizeof(float)) {
1428 test(SV("12_3#456700"), SV("{:.6Lf}"), F(1.234567e2
));
1429 test(SV("1_23_4#567000"), SV("{:.6Lf}"), F(1.234567e3
));
1430 test(SV("12_34_5#670000"), SV("{:.6Lf}"), F(1.234567e4
));
1431 test(SV("123_45_6#700000"), SV("{:.6Lf}"), F(1.234567e5
));
1432 test(SV("1_234_56_7#000000"), SV("{:.6Lf}"), F(1.234567e6
));
1433 test(SV("12_345_67_0#000000"), SV("{:.6Lf}"), F(1.234567e7
));
1434 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
));
1436 test(SV("-0#000001"), SV("{:.6Lf}"), F(-1.234567e-6));
1437 test(SV("-0#000012"), SV("{:.6Lf}"), F(-1.234567e-5));
1438 test(SV("-0#000123"), SV("{:.6Lf}"), F(-1.234567e-4));
1439 test(SV("-0#001235"), SV("{:.6Lf}"), F(-1.234567e-3));
1440 test(SV("-0#012346"), SV("{:.6Lf}"), F(-1.234567e-2));
1441 test(SV("-0#123457"), SV("{:.6Lf}"), F(-1.234567e-1));
1442 test(SV("-1#234567"), SV("{:.6Lf}"), F(-1.234567e0
));
1443 test(SV("-1_2#345670"), SV("{:.6Lf}"), F(-1.234567e1
));
1444 if constexpr (sizeof(F
) > sizeof(float)) {
1445 test(SV("-12_3#456700"), SV("{:.6Lf}"), F(-1.234567e2
));
1446 test(SV("-1_23_4#567000"), SV("{:.6Lf}"), F(-1.234567e3
));
1447 test(SV("-12_34_5#670000"), SV("{:.6Lf}"), F(-1.234567e4
));
1448 test(SV("-123_45_6#700000"), SV("{:.6Lf}"), F(-1.234567e5
));
1449 test(SV("-1_234_56_7#000000"), SV("{:.6Lf}"), F(-1.234567e6
));
1450 test(SV("-12_345_67_0#000000"), SV("{:.6Lf}"), F(-1.234567e7
));
1451 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
));
1454 test(SV("0.000001"), en_US
, SV("{:.6Lf}"), F(1.234567e-6));
1455 test(SV("0.000012"), en_US
, SV("{:.6Lf}"), F(1.234567e-5));
1456 test(SV("0.000123"), en_US
, SV("{:.6Lf}"), F(1.234567e-4));
1457 test(SV("0.001235"), en_US
, SV("{:.6Lf}"), F(1.234567e-3));
1458 test(SV("0.012346"), en_US
, SV("{:.6Lf}"), F(1.234567e-2));
1459 test(SV("0.123457"), en_US
, SV("{:.6Lf}"), F(1.234567e-1));
1460 test(SV("1.234567"), en_US
, SV("{:.6Lf}"), F(1.234567e0
));
1461 test(SV("12.345670"), en_US
, SV("{:.6Lf}"), F(1.234567e1
));
1462 if constexpr (sizeof(F
) > sizeof(float)) {
1463 test(SV("123.456700"), en_US
, SV("{:.6Lf}"), F(1.234567e2
));
1464 test(SV("1,234.567000"), en_US
, SV("{:.6Lf}"), F(1.234567e3
));
1465 test(SV("12,345.670000"), en_US
, SV("{:.6Lf}"), F(1.234567e4
));
1466 test(SV("123,456.700000"), en_US
, SV("{:.6Lf}"), F(1.234567e5
));
1467 test(SV("1,234,567.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e6
));
1468 test(SV("12,345,670.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e7
));
1469 test(SV("123,456,700,000,000,000,000.000000"), en_US
, SV("{:.6Lf}"), F(1.234567e20
));
1471 test(SV("-0.000001"), en_US
, SV("{:.6Lf}"), F(-1.234567e-6));
1472 test(SV("-0.000012"), en_US
, SV("{:.6Lf}"), F(-1.234567e-5));
1473 test(SV("-0.000123"), en_US
, SV("{:.6Lf}"), F(-1.234567e-4));
1474 test(SV("-0.001235"), en_US
, SV("{:.6Lf}"), F(-1.234567e-3));
1475 test(SV("-0.012346"), en_US
, SV("{:.6Lf}"), F(-1.234567e-2));
1476 test(SV("-0.123457"), en_US
, SV("{:.6Lf}"), F(-1.234567e-1));
1477 test(SV("-1.234567"), en_US
, SV("{:.6Lf}"), F(-1.234567e0
));
1478 test(SV("-12.345670"), en_US
, SV("{:.6Lf}"), F(-1.234567e1
));
1479 if constexpr (sizeof(F
) > sizeof(float)) {
1480 test(SV("-123.456700"), en_US
, SV("{:.6Lf}"), F(-1.234567e2
));
1481 test(SV("-1,234.567000"), en_US
, SV("{:.6Lf}"), F(-1.234567e3
));
1482 test(SV("-12,345.670000"), en_US
, SV("{:.6Lf}"), F(-1.234567e4
));
1483 test(SV("-123,456.700000"), en_US
, SV("{:.6Lf}"), F(-1.234567e5
));
1484 test(SV("-1,234,567.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e6
));
1485 test(SV("-12,345,670.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e7
));
1486 test(SV("-123,456,700,000,000,000,000.000000"), en_US
, SV("{:.6Lf}"), F(-1.234567e20
));
1489 std::locale::global(en_US
);
1490 test(SV("0#000001"), loc
, SV("{:.6Lf}"), F(1.234567e-6));
1491 test(SV("0#000012"), loc
, SV("{:.6Lf}"), F(1.234567e-5));
1492 test(SV("0#000123"), loc
, SV("{:.6Lf}"), F(1.234567e-4));
1493 test(SV("0#001235"), loc
, SV("{:.6Lf}"), F(1.234567e-3));
1494 test(SV("0#012346"), loc
, SV("{:.6Lf}"), F(1.234567e-2));
1495 test(SV("0#123457"), loc
, SV("{:.6Lf}"), F(1.234567e-1));
1496 test(SV("1#234567"), loc
, SV("{:.6Lf}"), F(1.234567e0
));
1497 test(SV("1_2#345670"), loc
, SV("{:.6Lf}"), F(1.234567e1
));
1498 if constexpr (sizeof(F
) > sizeof(float)) {
1499 test(SV("12_3#456700"), loc
, SV("{:.6Lf}"), F(1.234567e2
));
1500 test(SV("1_23_4#567000"), loc
, SV("{:.6Lf}"), F(1.234567e3
));
1501 test(SV("12_34_5#670000"), loc
, SV("{:.6Lf}"), F(1.234567e4
));
1502 test(SV("123_45_6#700000"), loc
, SV("{:.6Lf}"), F(1.234567e5
));
1503 test(SV("1_234_56_7#000000"), loc
, SV("{:.6Lf}"), F(1.234567e6
));
1504 test(SV("12_345_67_0#000000"), loc
, SV("{:.6Lf}"), F(1.234567e7
));
1505 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
));
1507 test(SV("-0#000001"), loc
, SV("{:.6Lf}"), F(-1.234567e-6));
1508 test(SV("-0#000012"), loc
, SV("{:.6Lf}"), F(-1.234567e-5));
1509 test(SV("-0#000123"), loc
, SV("{:.6Lf}"), F(-1.234567e-4));
1510 test(SV("-0#001235"), loc
, SV("{:.6Lf}"), F(-1.234567e-3));
1511 test(SV("-0#012346"), loc
, SV("{:.6Lf}"), F(-1.234567e-2));
1512 test(SV("-0#123457"), loc
, SV("{:.6Lf}"), F(-1.234567e-1));
1513 test(SV("-1#234567"), loc
, SV("{:.6Lf}"), F(-1.234567e0
));
1514 test(SV("-1_2#345670"), loc
, SV("{:.6Lf}"), F(-1.234567e1
));
1515 if constexpr (sizeof(F
) > sizeof(float)) {
1516 test(SV("-12_3#456700"), loc
, SV("{:.6Lf}"), F(-1.234567e2
));
1517 test(SV("-1_23_4#567000"), loc
, SV("{:.6Lf}"), F(-1.234567e3
));
1518 test(SV("-12_34_5#670000"), loc
, SV("{:.6Lf}"), F(-1.234567e4
));
1519 test(SV("-123_45_6#700000"), loc
, SV("{:.6Lf}"), F(-1.234567e5
));
1520 test(SV("-1_234_56_7#000000"), loc
, SV("{:.6Lf}"), F(-1.234567e6
));
1521 test(SV("-12_345_67_0#000000"), loc
, SV("{:.6Lf}"), F(-1.234567e7
));
1522 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
));
1525 // *** Fill, align, zero padding ***
1526 if constexpr (sizeof(F
) > sizeof(float)) {
1527 std::locale::global(en_US
);
1528 test(SV("1,234.567000$$$"), SV("{:$<15.6Lf}"), F(1.234567e3
));
1529 test(SV("$$$1,234.567000"), SV("{:$>15.6Lf}"), F(1.234567e3
));
1530 test(SV("$1,234.567000$$"), SV("{:$^15.6Lf}"), F(1.234567e3
));
1531 test(SV("0001,234.567000"), SV("{:015.6Lf}"), F(1.234567e3
));
1532 test(SV("-1,234.567000$$$"), SV("{:$<16.6Lf}"), F(-1.234567e3
));
1533 test(SV("$$$-1,234.567000"), SV("{:$>16.6Lf}"), F(-1.234567e3
));
1534 test(SV("$-1,234.567000$$"), SV("{:$^16.6Lf}"), F(-1.234567e3
));
1535 test(SV("-0001,234.567000"), SV("{:016.6Lf}"), F(-1.234567e3
));
1537 std::locale::global(loc
);
1538 test(SV("1_23_4#567000$$$"), SV("{:$<16.6Lf}"), F(1.234567e3
));
1539 test(SV("$$$1_23_4#567000"), SV("{:$>16.6Lf}"), F(1.234567e3
));
1540 test(SV("$1_23_4#567000$$"), SV("{:$^16.6Lf}"), F(1.234567e3
));
1541 test(SV("0001_23_4#567000"), SV("{:016.6Lf}"), F(1.234567e3
));
1542 test(SV("-1_23_4#567000$$$"), SV("{:$<17.6Lf}"), F(-1.234567e3
));
1543 test(SV("$$$-1_23_4#567000"), SV("{:$>17.6Lf}"), F(-1.234567e3
));
1544 test(SV("$-1_23_4#567000$$"), SV("{:$^17.6Lf}"), F(-1.234567e3
));
1545 test(SV("-0001_23_4#567000"), SV("{:017.6Lf}"), F(-1.234567e3
));
1547 test(SV("1,234.567000$$$"), en_US
, SV("{:$<15.6Lf}"), F(1.234567e3
));
1548 test(SV("$$$1,234.567000"), en_US
, SV("{:$>15.6Lf}"), F(1.234567e3
));
1549 test(SV("$1,234.567000$$"), en_US
, SV("{:$^15.6Lf}"), F(1.234567e3
));
1550 test(SV("0001,234.567000"), en_US
, SV("{:015.6Lf}"), F(1.234567e3
));
1551 test(SV("-1,234.567000$$$"), en_US
, SV("{:$<16.6Lf}"), F(-1.234567e3
));
1552 test(SV("$$$-1,234.567000"), en_US
, SV("{:$>16.6Lf}"), F(-1.234567e3
));
1553 test(SV("$-1,234.567000$$"), en_US
, SV("{:$^16.6Lf}"), F(-1.234567e3
));
1554 test(SV("-0001,234.567000"), en_US
, SV("{:016.6Lf}"), F(-1.234567e3
));
1556 std::locale::global(en_US
);
1557 test(SV("1_23_4#567000$$$"), loc
, SV("{:$<16.6Lf}"), F(1.234567e3
));
1558 test(SV("$$$1_23_4#567000"), loc
, SV("{:$>16.6Lf}"), F(1.234567e3
));
1559 test(SV("$1_23_4#567000$$"), loc
, SV("{:$^16.6Lf}"), F(1.234567e3
));
1560 test(SV("0001_23_4#567000"), loc
, SV("{:016.6Lf}"), F(1.234567e3
));
1561 test(SV("-1_23_4#567000$$$"), loc
, SV("{:$<17.6Lf}"), F(-1.234567e3
));
1562 test(SV("$$$-1_23_4#567000"), loc
, SV("{:$>17.6Lf}"), F(-1.234567e3
));
1563 test(SV("$-1_23_4#567000$$"), loc
, SV("{:$^17.6Lf}"), F(-1.234567e3
));
1564 test(SV("-0001_23_4#567000"), loc
, SV("{:017.6Lf}"), F(-1.234567e3
));
1568 template <class F
, class CharT
>
1569 void test_floating_point_general_lower_case() {
1570 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1571 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1574 std::locale::global(en_US
);
1575 test(SV("1.23457e-06"), SV("{:.6Lg}"), F(1.234567e-6));
1576 test(SV("1.23457e-05"), SV("{:.6Lg}"), F(1.234567e-5));
1577 test(SV("0.000123457"), SV("{:.6Lg}"), F(1.234567e-4));
1578 test(SV("0.00123457"), SV("{:.6Lg}"), F(1.234567e-3));
1579 test(SV("0.0123457"), SV("{:.6Lg}"), F(1.234567e-2));
1580 test(SV("0.123457"), SV("{:.6Lg}"), F(1.234567e-1));
1581 test(SV("1.23457"), SV("{:.6Lg}"), F(1.234567e0
));
1582 test(SV("12.3457"), SV("{:.6Lg}"), F(1.234567e1
));
1583 test(SV("123.457"), SV("{:.6Lg}"), F(1.234567e2
));
1584 test(SV("1,234.57"), SV("{:.6Lg}"), F(1.234567e3
));
1585 test(SV("12,345.7"), SV("{:.6Lg}"), F(1.234567e4
));
1586 test(SV("123,457"), SV("{:.6Lg}"), F(1.234567e5
));
1587 test(SV("1.23457e+06"), SV("{:.6Lg}"), F(1.234567e6
));
1588 test(SV("1.23457e+07"), SV("{:.6Lg}"), F(1.234567e7
));
1589 test(SV("-1.23457e-06"), SV("{:.6Lg}"), F(-1.234567e-6));
1590 test(SV("-1.23457e-05"), SV("{:.6Lg}"), F(-1.234567e-5));
1591 test(SV("-0.000123457"), SV("{:.6Lg}"), F(-1.234567e-4));
1592 test(SV("-0.00123457"), SV("{:.6Lg}"), F(-1.234567e-3));
1593 test(SV("-0.0123457"), SV("{:.6Lg}"), F(-1.234567e-2));
1594 test(SV("-0.123457"), SV("{:.6Lg}"), F(-1.234567e-1));
1595 test(SV("-1.23457"), SV("{:.6Lg}"), F(-1.234567e0
));
1596 test(SV("-12.3457"), SV("{:.6Lg}"), F(-1.234567e1
));
1597 test(SV("-123.457"), SV("{:.6Lg}"), F(-1.234567e2
));
1598 test(SV("-1,234.57"), SV("{:.6Lg}"), F(-1.234567e3
));
1599 test(SV("-12,345.7"), SV("{:.6Lg}"), F(-1.234567e4
));
1600 test(SV("-123,457"), SV("{:.6Lg}"), F(-1.234567e5
));
1601 test(SV("-1.23457e+06"), SV("{:.6Lg}"), F(-1.234567e6
));
1602 test(SV("-1.23457e+07"), SV("{:.6Lg}"), F(-1.234567e7
));
1604 std::locale::global(loc
);
1605 test(SV("1#23457e-06"), SV("{:.6Lg}"), F(1.234567e-6));
1606 test(SV("1#23457e-05"), SV("{:.6Lg}"), F(1.234567e-5));
1607 test(SV("0#000123457"), SV("{:.6Lg}"), F(1.234567e-4));
1608 test(SV("0#00123457"), SV("{:.6Lg}"), F(1.234567e-3));
1609 test(SV("0#0123457"), SV("{:.6Lg}"), F(1.234567e-2));
1610 test(SV("0#123457"), SV("{:.6Lg}"), F(1.234567e-1));
1611 test(SV("1#23457"), SV("{:.6Lg}"), F(1.234567e0
));
1612 test(SV("1_2#3457"), SV("{:.6Lg}"), F(1.234567e1
));
1613 test(SV("12_3#457"), SV("{:.6Lg}"), F(1.234567e2
));
1614 test(SV("1_23_4#57"), SV("{:.6Lg}"), F(1.234567e3
));
1615 test(SV("12_34_5#7"), SV("{:.6Lg}"), F(1.234567e4
));
1616 test(SV("123_45_7"), SV("{:.6Lg}"), F(1.234567e5
));
1617 test(SV("1#23457e+06"), SV("{:.6Lg}"), F(1.234567e6
));
1618 test(SV("1#23457e+07"), SV("{:.6Lg}"), F(1.234567e7
));
1619 test(SV("-1#23457e-06"), SV("{:.6Lg}"), F(-1.234567e-6));
1620 test(SV("-1#23457e-05"), SV("{:.6Lg}"), F(-1.234567e-5));
1621 test(SV("-0#000123457"), SV("{:.6Lg}"), F(-1.234567e-4));
1622 test(SV("-0#00123457"), SV("{:.6Lg}"), F(-1.234567e-3));
1623 test(SV("-0#0123457"), SV("{:.6Lg}"), F(-1.234567e-2));
1624 test(SV("-0#123457"), SV("{:.6Lg}"), F(-1.234567e-1));
1625 test(SV("-1#23457"), SV("{:.6Lg}"), F(-1.234567e0
));
1626 test(SV("-1_2#3457"), SV("{:.6Lg}"), F(-1.234567e1
));
1627 test(SV("-12_3#457"), SV("{:.6Lg}"), F(-1.234567e2
));
1628 test(SV("-1_23_4#57"), SV("{:.6Lg}"), F(-1.234567e3
));
1629 test(SV("-12_34_5#7"), SV("{:.6Lg}"), F(-1.234567e4
));
1630 test(SV("-123_45_7"), SV("{:.6Lg}"), F(-1.234567e5
));
1631 test(SV("-1#23457e+06"), SV("{:.6Lg}"), F(-1.234567e6
));
1632 test(SV("-1#23457e+07"), SV("{:.6Lg}"), F(-1.234567e7
));
1634 test(SV("1.23457e-06"), en_US
, SV("{:.6Lg}"), F(1.234567e-6));
1635 test(SV("1.23457e-05"), en_US
, SV("{:.6Lg}"), F(1.234567e-5));
1636 test(SV("0.000123457"), en_US
, SV("{:.6Lg}"), F(1.234567e-4));
1637 test(SV("0.00123457"), en_US
, SV("{:.6Lg}"), F(1.234567e-3));
1638 test(SV("0.0123457"), en_US
, SV("{:.6Lg}"), F(1.234567e-2));
1639 test(SV("0.123457"), en_US
, SV("{:.6Lg}"), F(1.234567e-1));
1640 test(SV("1.23457"), en_US
, SV("{:.6Lg}"), F(1.234567e0
));
1641 test(SV("12.3457"), en_US
, SV("{:.6Lg}"), F(1.234567e1
));
1642 test(SV("123.457"), en_US
, SV("{:.6Lg}"), F(1.234567e2
));
1643 test(SV("1,234.57"), en_US
, SV("{:.6Lg}"), F(1.234567e3
));
1644 test(SV("12,345.7"), en_US
, SV("{:.6Lg}"), F(1.234567e4
));
1645 test(SV("123,457"), en_US
, SV("{:.6Lg}"), F(1.234567e5
));
1646 test(SV("1.23457e+06"), en_US
, SV("{:.6Lg}"), F(1.234567e6
));
1647 test(SV("1.23457e+07"), en_US
, SV("{:.6Lg}"), F(1.234567e7
));
1648 test(SV("-1.23457e-06"), en_US
, SV("{:.6Lg}"), F(-1.234567e-6));
1649 test(SV("-1.23457e-05"), en_US
, SV("{:.6Lg}"), F(-1.234567e-5));
1650 test(SV("-0.000123457"), en_US
, SV("{:.6Lg}"), F(-1.234567e-4));
1651 test(SV("-0.00123457"), en_US
, SV("{:.6Lg}"), F(-1.234567e-3));
1652 test(SV("-0.0123457"), en_US
, SV("{:.6Lg}"), F(-1.234567e-2));
1653 test(SV("-0.123457"), en_US
, SV("{:.6Lg}"), F(-1.234567e-1));
1654 test(SV("-1.23457"), en_US
, SV("{:.6Lg}"), F(-1.234567e0
));
1655 test(SV("-12.3457"), en_US
, SV("{:.6Lg}"), F(-1.234567e1
));
1656 test(SV("-123.457"), en_US
, SV("{:.6Lg}"), F(-1.234567e2
));
1657 test(SV("-1,234.57"), en_US
, SV("{:.6Lg}"), F(-1.234567e3
));
1658 test(SV("-12,345.7"), en_US
, SV("{:.6Lg}"), F(-1.234567e4
));
1659 test(SV("-123,457"), en_US
, SV("{:.6Lg}"), F(-1.234567e5
));
1660 test(SV("-1.23457e+06"), en_US
, SV("{:.6Lg}"), F(-1.234567e6
));
1661 test(SV("-1.23457e+07"), en_US
, SV("{:.6Lg}"), F(-1.234567e7
));
1663 std::locale::global(en_US
);
1664 test(SV("1#23457e-06"), loc
, SV("{:.6Lg}"), F(1.234567e-6));
1665 test(SV("1#23457e-05"), loc
, SV("{:.6Lg}"), F(1.234567e-5));
1666 test(SV("0#000123457"), loc
, SV("{:.6Lg}"), F(1.234567e-4));
1667 test(SV("0#00123457"), loc
, SV("{:.6Lg}"), F(1.234567e-3));
1668 test(SV("0#0123457"), loc
, SV("{:.6Lg}"), F(1.234567e-2));
1669 test(SV("0#123457"), loc
, SV("{:.6Lg}"), F(1.234567e-1));
1670 test(SV("1#23457"), loc
, SV("{:.6Lg}"), F(1.234567e0
));
1671 test(SV("1_2#3457"), loc
, SV("{:.6Lg}"), F(1.234567e1
));
1672 test(SV("12_3#457"), loc
, SV("{:.6Lg}"), F(1.234567e2
));
1673 test(SV("1_23_4#57"), loc
, SV("{:.6Lg}"), F(1.234567e3
));
1674 test(SV("12_34_5#7"), loc
, SV("{:.6Lg}"), F(1.234567e4
));
1675 test(SV("123_45_7"), loc
, SV("{:.6Lg}"), F(1.234567e5
));
1676 test(SV("1#23457e+06"), loc
, SV("{:.6Lg}"), F(1.234567e6
));
1677 test(SV("1#23457e+07"), loc
, SV("{:.6Lg}"), F(1.234567e7
));
1678 test(SV("-1#23457e-06"), loc
, SV("{:.6Lg}"), F(-1.234567e-6));
1679 test(SV("-1#23457e-05"), loc
, SV("{:.6Lg}"), F(-1.234567e-5));
1680 test(SV("-0#000123457"), loc
, SV("{:.6Lg}"), F(-1.234567e-4));
1681 test(SV("-0#00123457"), loc
, SV("{:.6Lg}"), F(-1.234567e-3));
1682 test(SV("-0#0123457"), loc
, SV("{:.6Lg}"), F(-1.234567e-2));
1683 test(SV("-0#123457"), loc
, SV("{:.6Lg}"), F(-1.234567e-1));
1684 test(SV("-1#23457"), loc
, SV("{:.6Lg}"), F(-1.234567e0
));
1685 test(SV("-1_2#3457"), loc
, SV("{:.6Lg}"), F(-1.234567e1
));
1686 test(SV("-12_3#457"), loc
, SV("{:.6Lg}"), F(-1.234567e2
));
1687 test(SV("-1_23_4#57"), loc
, SV("{:.6Lg}"), F(-1.234567e3
));
1688 test(SV("-12_34_5#7"), loc
, SV("{:.6Lg}"), F(-1.234567e4
));
1689 test(SV("-123_45_7"), loc
, SV("{:.6Lg}"), F(-1.234567e5
));
1690 test(SV("-1#23457e+06"), loc
, SV("{:.6Lg}"), F(-1.234567e6
));
1691 test(SV("-1#23457e+07"), loc
, SV("{:.6Lg}"), F(-1.234567e7
));
1693 // *** Fill, align, zero padding ***
1694 std::locale::global(en_US
);
1695 test(SV("1,234.57$$$"), SV("{:$<11.6Lg}"), F(1.234567e3
));
1696 test(SV("$$$1,234.57"), SV("{:$>11.6Lg}"), F(1.234567e3
));
1697 test(SV("$1,234.57$$"), SV("{:$^11.6Lg}"), F(1.234567e3
));
1698 test(SV("0001,234.57"), SV("{:011.6Lg}"), F(1.234567e3
));
1699 test(SV("-1,234.57$$$"), SV("{:$<12.6Lg}"), F(-1.234567e3
));
1700 test(SV("$$$-1,234.57"), SV("{:$>12.6Lg}"), F(-1.234567e3
));
1701 test(SV("$-1,234.57$$"), SV("{:$^12.6Lg}"), F(-1.234567e3
));
1702 test(SV("-0001,234.57"), SV("{:012.6Lg}"), F(-1.234567e3
));
1704 std::locale::global(loc
);
1705 test(SV("1_23_4#57$$$"), SV("{:$<12.6Lg}"), F(1.234567e3
));
1706 test(SV("$$$1_23_4#57"), SV("{:$>12.6Lg}"), F(1.234567e3
));
1707 test(SV("$1_23_4#57$$"), SV("{:$^12.6Lg}"), F(1.234567e3
));
1708 test(SV("0001_23_4#57"), SV("{:012.6Lg}"), F(1.234567e3
));
1709 test(SV("-1_23_4#57$$$"), SV("{:$<13.6Lg}"), F(-1.234567e3
));
1710 test(SV("$$$-1_23_4#57"), SV("{:$>13.6Lg}"), F(-1.234567e3
));
1711 test(SV("$-1_23_4#57$$"), SV("{:$^13.6Lg}"), F(-1.234567e3
));
1712 test(SV("-0001_23_4#57"), SV("{:013.6Lg}"), F(-1.234567e3
));
1714 test(SV("1,234.57$$$"), en_US
, SV("{:$<11.6Lg}"), F(1.234567e3
));
1715 test(SV("$$$1,234.57"), en_US
, SV("{:$>11.6Lg}"), F(1.234567e3
));
1716 test(SV("$1,234.57$$"), en_US
, SV("{:$^11.6Lg}"), F(1.234567e3
));
1717 test(SV("0001,234.57"), en_US
, SV("{:011.6Lg}"), F(1.234567e3
));
1718 test(SV("-1,234.57$$$"), en_US
, SV("{:$<12.6Lg}"), F(-1.234567e3
));
1719 test(SV("$$$-1,234.57"), en_US
, SV("{:$>12.6Lg}"), F(-1.234567e3
));
1720 test(SV("$-1,234.57$$"), en_US
, SV("{:$^12.6Lg}"), F(-1.234567e3
));
1721 test(SV("-0001,234.57"), en_US
, SV("{:012.6Lg}"), F(-1.234567e3
));
1723 std::locale::global(en_US
);
1724 test(SV("1_23_4#57$$$"), loc
, SV("{:$<12.6Lg}"), F(1.234567e3
));
1725 test(SV("$$$1_23_4#57"), loc
, SV("{:$>12.6Lg}"), F(1.234567e3
));
1726 test(SV("$1_23_4#57$$"), loc
, SV("{:$^12.6Lg}"), F(1.234567e3
));
1727 test(SV("0001_23_4#57"), loc
, SV("{:012.6Lg}"), F(1.234567e3
));
1728 test(SV("-1_23_4#57$$$"), loc
, SV("{:$<13.6Lg}"), F(-1.234567e3
));
1729 test(SV("$$$-1_23_4#57"), loc
, SV("{:$>13.6Lg}"), F(-1.234567e3
));
1730 test(SV("$-1_23_4#57$$"), loc
, SV("{:$^13.6Lg}"), F(-1.234567e3
));
1731 test(SV("-0001_23_4#57"), loc
, SV("{:013.6Lg}"), F(-1.234567e3
));
1734 template <class F
, class CharT
>
1735 void test_floating_point_general_upper_case() {
1736 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1737 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1740 std::locale::global(en_US
);
1741 test(SV("1.23457E-06"), SV("{:.6LG}"), F(1.234567e-6));
1742 test(SV("1.23457E-05"), SV("{:.6LG}"), F(1.234567e-5));
1743 test(SV("0.000123457"), SV("{:.6LG}"), F(1.234567e-4));
1744 test(SV("0.00123457"), SV("{:.6LG}"), F(1.234567e-3));
1745 test(SV("0.0123457"), SV("{:.6LG}"), F(1.234567e-2));
1746 test(SV("0.123457"), SV("{:.6LG}"), F(1.234567e-1));
1747 test(SV("1.23457"), SV("{:.6LG}"), F(1.234567e0
));
1748 test(SV("12.3457"), SV("{:.6LG}"), F(1.234567e1
));
1749 test(SV("123.457"), SV("{:.6LG}"), F(1.234567e2
));
1750 test(SV("1,234.57"), SV("{:.6LG}"), F(1.234567e3
));
1751 test(SV("12,345.7"), SV("{:.6LG}"), F(1.234567e4
));
1752 test(SV("123,457"), SV("{:.6LG}"), F(1.234567e5
));
1753 test(SV("1.23457E+06"), SV("{:.6LG}"), F(1.234567e6
));
1754 test(SV("1.23457E+07"), SV("{:.6LG}"), F(1.234567e7
));
1755 test(SV("-1.23457E-06"), SV("{:.6LG}"), F(-1.234567e-6));
1756 test(SV("-1.23457E-05"), SV("{:.6LG}"), F(-1.234567e-5));
1757 test(SV("-0.000123457"), SV("{:.6LG}"), F(-1.234567e-4));
1758 test(SV("-0.00123457"), SV("{:.6LG}"), F(-1.234567e-3));
1759 test(SV("-0.0123457"), SV("{:.6LG}"), F(-1.234567e-2));
1760 test(SV("-0.123457"), SV("{:.6LG}"), F(-1.234567e-1));
1761 test(SV("-1.23457"), SV("{:.6LG}"), F(-1.234567e0
));
1762 test(SV("-12.3457"), SV("{:.6LG}"), F(-1.234567e1
));
1763 test(SV("-123.457"), SV("{:.6LG}"), F(-1.234567e2
));
1764 test(SV("-1,234.57"), SV("{:.6LG}"), F(-1.234567e3
));
1765 test(SV("-12,345.7"), SV("{:.6LG}"), F(-1.234567e4
));
1766 test(SV("-123,457"), SV("{:.6LG}"), F(-1.234567e5
));
1767 test(SV("-1.23457E+06"), SV("{:.6LG}"), F(-1.234567e6
));
1768 test(SV("-1.23457E+07"), SV("{:.6LG}"), F(-1.234567e7
));
1770 std::locale::global(loc
);
1771 test(SV("1#23457E-06"), SV("{:.6LG}"), F(1.234567e-6));
1772 test(SV("1#23457E-05"), SV("{:.6LG}"), F(1.234567e-5));
1773 test(SV("0#000123457"), SV("{:.6LG}"), F(1.234567e-4));
1774 test(SV("0#00123457"), SV("{:.6LG}"), F(1.234567e-3));
1775 test(SV("0#0123457"), SV("{:.6LG}"), F(1.234567e-2));
1776 test(SV("0#123457"), SV("{:.6LG}"), F(1.234567e-1));
1777 test(SV("1#23457"), SV("{:.6LG}"), F(1.234567e0
));
1778 test(SV("1_2#3457"), SV("{:.6LG}"), F(1.234567e1
));
1779 test(SV("12_3#457"), SV("{:.6LG}"), F(1.234567e2
));
1780 test(SV("1_23_4#57"), SV("{:.6LG}"), F(1.234567e3
));
1781 test(SV("12_34_5#7"), SV("{:.6LG}"), F(1.234567e4
));
1782 test(SV("123_45_7"), SV("{:.6LG}"), F(1.234567e5
));
1783 test(SV("1#23457E+06"), SV("{:.6LG}"), F(1.234567e6
));
1784 test(SV("1#23457E+07"), SV("{:.6LG}"), F(1.234567e7
));
1785 test(SV("-1#23457E-06"), SV("{:.6LG}"), F(-1.234567e-6));
1786 test(SV("-1#23457E-05"), SV("{:.6LG}"), F(-1.234567e-5));
1787 test(SV("-0#000123457"), SV("{:.6LG}"), F(-1.234567e-4));
1788 test(SV("-0#00123457"), SV("{:.6LG}"), F(-1.234567e-3));
1789 test(SV("-0#0123457"), SV("{:.6LG}"), F(-1.234567e-2));
1790 test(SV("-0#123457"), SV("{:.6LG}"), F(-1.234567e-1));
1791 test(SV("-1#23457"), SV("{:.6LG}"), F(-1.234567e0
));
1792 test(SV("-1_2#3457"), SV("{:.6LG}"), F(-1.234567e1
));
1793 test(SV("-12_3#457"), SV("{:.6LG}"), F(-1.234567e2
));
1794 test(SV("-1_23_4#57"), SV("{:.6LG}"), F(-1.234567e3
));
1795 test(SV("-12_34_5#7"), SV("{:.6LG}"), F(-1.234567e4
));
1796 test(SV("-123_45_7"), SV("{:.6LG}"), F(-1.234567e5
));
1797 test(SV("-1#23457E+06"), SV("{:.6LG}"), F(-1.234567e6
));
1798 test(SV("-1#23457E+07"), SV("{:.6LG}"), F(-1.234567e7
));
1800 test(SV("1.23457E-06"), en_US
, SV("{:.6LG}"), F(1.234567e-6));
1801 test(SV("1.23457E-05"), en_US
, SV("{:.6LG}"), F(1.234567e-5));
1802 test(SV("0.000123457"), en_US
, SV("{:.6LG}"), F(1.234567e-4));
1803 test(SV("0.00123457"), en_US
, SV("{:.6LG}"), F(1.234567e-3));
1804 test(SV("0.0123457"), en_US
, SV("{:.6LG}"), F(1.234567e-2));
1805 test(SV("0.123457"), en_US
, SV("{:.6LG}"), F(1.234567e-1));
1806 test(SV("1.23457"), en_US
, SV("{:.6LG}"), F(1.234567e0
));
1807 test(SV("12.3457"), en_US
, SV("{:.6LG}"), F(1.234567e1
));
1808 test(SV("123.457"), en_US
, SV("{:.6LG}"), F(1.234567e2
));
1809 test(SV("1,234.57"), en_US
, SV("{:.6LG}"), F(1.234567e3
));
1810 test(SV("12,345.7"), en_US
, SV("{:.6LG}"), F(1.234567e4
));
1811 test(SV("123,457"), en_US
, SV("{:.6LG}"), F(1.234567e5
));
1812 test(SV("1.23457E+06"), en_US
, SV("{:.6LG}"), F(1.234567e6
));
1813 test(SV("1.23457E+07"), en_US
, SV("{:.6LG}"), F(1.234567e7
));
1814 test(SV("-1.23457E-06"), en_US
, SV("{:.6LG}"), F(-1.234567e-6));
1815 test(SV("-1.23457E-05"), en_US
, SV("{:.6LG}"), F(-1.234567e-5));
1816 test(SV("-0.000123457"), en_US
, SV("{:.6LG}"), F(-1.234567e-4));
1817 test(SV("-0.00123457"), en_US
, SV("{:.6LG}"), F(-1.234567e-3));
1818 test(SV("-0.0123457"), en_US
, SV("{:.6LG}"), F(-1.234567e-2));
1819 test(SV("-0.123457"), en_US
, SV("{:.6LG}"), F(-1.234567e-1));
1820 test(SV("-1.23457"), en_US
, SV("{:.6LG}"), F(-1.234567e0
));
1821 test(SV("-12.3457"), en_US
, SV("{:.6LG}"), F(-1.234567e1
));
1822 test(SV("-123.457"), en_US
, SV("{:.6LG}"), F(-1.234567e2
));
1823 test(SV("-1,234.57"), en_US
, SV("{:.6LG}"), F(-1.234567e3
));
1824 test(SV("-12,345.7"), en_US
, SV("{:.6LG}"), F(-1.234567e4
));
1825 test(SV("-123,457"), en_US
, SV("{:.6LG}"), F(-1.234567e5
));
1826 test(SV("-1.23457E+06"), en_US
, SV("{:.6LG}"), F(-1.234567e6
));
1827 test(SV("-1.23457E+07"), en_US
, SV("{:.6LG}"), F(-1.234567e7
));
1829 std::locale::global(en_US
);
1830 test(SV("1#23457E-06"), loc
, SV("{:.6LG}"), F(1.234567e-6));
1831 test(SV("1#23457E-05"), loc
, SV("{:.6LG}"), F(1.234567e-5));
1832 test(SV("0#000123457"), loc
, SV("{:.6LG}"), F(1.234567e-4));
1833 test(SV("0#00123457"), loc
, SV("{:.6LG}"), F(1.234567e-3));
1834 test(SV("0#0123457"), loc
, SV("{:.6LG}"), F(1.234567e-2));
1835 test(SV("0#123457"), loc
, SV("{:.6LG}"), F(1.234567e-1));
1836 test(SV("1#23457"), loc
, SV("{:.6LG}"), F(1.234567e0
));
1837 test(SV("1_2#3457"), loc
, SV("{:.6LG}"), F(1.234567e1
));
1838 test(SV("12_3#457"), loc
, SV("{:.6LG}"), F(1.234567e2
));
1839 test(SV("1_23_4#57"), loc
, SV("{:.6LG}"), F(1.234567e3
));
1840 test(SV("12_34_5#7"), loc
, SV("{:.6LG}"), F(1.234567e4
));
1841 test(SV("123_45_7"), loc
, SV("{:.6LG}"), F(1.234567e5
));
1842 test(SV("1#23457E+06"), loc
, SV("{:.6LG}"), F(1.234567e6
));
1843 test(SV("1#23457E+07"), loc
, SV("{:.6LG}"), F(1.234567e7
));
1844 test(SV("-1#23457E-06"), loc
, SV("{:.6LG}"), F(-1.234567e-6));
1845 test(SV("-1#23457E-05"), loc
, SV("{:.6LG}"), F(-1.234567e-5));
1846 test(SV("-0#000123457"), loc
, SV("{:.6LG}"), F(-1.234567e-4));
1847 test(SV("-0#00123457"), loc
, SV("{:.6LG}"), F(-1.234567e-3));
1848 test(SV("-0#0123457"), loc
, SV("{:.6LG}"), F(-1.234567e-2));
1849 test(SV("-0#123457"), loc
, SV("{:.6LG}"), F(-1.234567e-1));
1850 test(SV("-1#23457"), loc
, SV("{:.6LG}"), F(-1.234567e0
));
1851 test(SV("-1_2#3457"), loc
, SV("{:.6LG}"), F(-1.234567e1
));
1852 test(SV("-12_3#457"), loc
, SV("{:.6LG}"), F(-1.234567e2
));
1853 test(SV("-1_23_4#57"), loc
, SV("{:.6LG}"), F(-1.234567e3
));
1854 test(SV("-12_34_5#7"), loc
, SV("{:.6LG}"), F(-1.234567e4
));
1855 test(SV("-123_45_7"), loc
, SV("{:.6LG}"), F(-1.234567e5
));
1856 test(SV("-1#23457E+06"), loc
, SV("{:.6LG}"), F(-1.234567e6
));
1857 test(SV("-1#23457E+07"), loc
, SV("{:.6LG}"), F(-1.234567e7
));
1859 // *** Fill, align, zero padding ***
1860 std::locale::global(en_US
);
1861 test(SV("1,234.57$$$"), SV("{:$<11.6LG}"), F(1.234567e3
));
1862 test(SV("$$$1,234.57"), SV("{:$>11.6LG}"), F(1.234567e3
));
1863 test(SV("$1,234.57$$"), SV("{:$^11.6LG}"), F(1.234567e3
));
1864 test(SV("0001,234.57"), SV("{:011.6LG}"), F(1.234567e3
));
1865 test(SV("-1,234.57$$$"), SV("{:$<12.6LG}"), F(-1.234567e3
));
1866 test(SV("$$$-1,234.57"), SV("{:$>12.6LG}"), F(-1.234567e3
));
1867 test(SV("$-1,234.57$$"), SV("{:$^12.6LG}"), F(-1.234567e3
));
1868 test(SV("-0001,234.57"), SV("{:012.6LG}"), F(-1.234567e3
));
1870 std::locale::global(loc
);
1871 test(SV("1_23_4#57$$$"), SV("{:$<12.6LG}"), F(1.234567e3
));
1872 test(SV("$$$1_23_4#57"), SV("{:$>12.6LG}"), F(1.234567e3
));
1873 test(SV("$1_23_4#57$$"), SV("{:$^12.6LG}"), F(1.234567e3
));
1874 test(SV("0001_23_4#57"), SV("{:012.6LG}"), F(1.234567e3
));
1875 test(SV("-1_23_4#57$$$"), SV("{:$<13.6LG}"), F(-1.234567e3
));
1876 test(SV("$$$-1_23_4#57"), SV("{:$>13.6LG}"), F(-1.234567e3
));
1877 test(SV("$-1_23_4#57$$"), SV("{:$^13.6LG}"), F(-1.234567e3
));
1878 test(SV("-0001_23_4#57"), SV("{:013.6LG}"), F(-1.234567e3
));
1880 test(SV("1,234.57$$$"), en_US
, SV("{:$<11.6LG}"), F(1.234567e3
));
1881 test(SV("$$$1,234.57"), en_US
, SV("{:$>11.6LG}"), F(1.234567e3
));
1882 test(SV("$1,234.57$$"), en_US
, SV("{:$^11.6LG}"), F(1.234567e3
));
1883 test(SV("0001,234.57"), en_US
, SV("{:011.6LG}"), F(1.234567e3
));
1884 test(SV("-1,234.57$$$"), en_US
, SV("{:$<12.6LG}"), F(-1.234567e3
));
1885 test(SV("$$$-1,234.57"), en_US
, SV("{:$>12.6LG}"), F(-1.234567e3
));
1886 test(SV("$-1,234.57$$"), en_US
, SV("{:$^12.6LG}"), F(-1.234567e3
));
1887 test(SV("-0001,234.57"), en_US
, SV("{:012.6LG}"), F(-1.234567e3
));
1889 std::locale::global(en_US
);
1890 test(SV("1_23_4#57$$$"), loc
, SV("{:$<12.6LG}"), F(1.234567e3
));
1891 test(SV("$$$1_23_4#57"), loc
, SV("{:$>12.6LG}"), F(1.234567e3
));
1892 test(SV("$1_23_4#57$$"), loc
, SV("{:$^12.6LG}"), F(1.234567e3
));
1893 test(SV("0001_23_4#57"), loc
, SV("{:012.6LG}"), F(1.234567e3
));
1894 test(SV("-1_23_4#57$$$"), loc
, SV("{:$<13.6LG}"), F(-1.234567e3
));
1895 test(SV("$$$-1_23_4#57"), loc
, SV("{:$>13.6LG}"), F(-1.234567e3
));
1896 test(SV("$-1_23_4#57$$"), loc
, SV("{:$^13.6LG}"), F(-1.234567e3
));
1897 test(SV("-0001_23_4#57"), loc
, SV("{:013.6LG}"), F(-1.234567e3
));
1900 template <class F
, class CharT
>
1901 void test_floating_point_default() {
1902 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
1903 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
1906 std::locale::global(en_US
);
1907 test(SV("1.234567e-06"), SV("{:L}"), F(1.234567e-6));
1908 test(SV("1.234567e-05"), SV("{:L}"), F(1.234567e-5));
1909 test(SV("0.0001234567"), SV("{:L}"), F(1.234567e-4));
1910 test(SV("0.001234567"), SV("{:L}"), F(1.234567e-3));
1911 test(SV("0.01234567"), SV("{:L}"), F(1.234567e-2));
1912 test(SV("0.1234567"), SV("{:L}"), F(1.234567e-1));
1913 test(SV("1.234567"), SV("{:L}"), F(1.234567e0
));
1914 test(SV("12.34567"), SV("{:L}"), F(1.234567e1
));
1915 test(SV("123.4567"), SV("{:L}"), F(1.234567e2
));
1916 test(SV("1,234.567"), SV("{:L}"), F(1.234567e3
));
1917 test(SV("12,345.67"), SV("{:L}"), F(1.234567e4
));
1918 test(SV("123,456.7"), SV("{:L}"), F(1.234567e5
));
1919 test(SV("1,234,567"), SV("{:L}"), F(1.234567e6
));
1920 test(SV("12,345,670"), SV("{:L}"), F(1.234567e7
));
1921 if constexpr (sizeof(F
) > sizeof(float)) {
1922 test(SV("123,456,700"), SV("{:L}"), F(1.234567e8
));
1923 test(SV("1,234,567,000"), SV("{:L}"), F(1.234567e9
));
1924 test(SV("12,345,670,000"), SV("{:L}"), F(1.234567e10
));
1925 test(SV("123,456,700,000"), SV("{:L}"), F(1.234567e11
));
1926 test(SV("1.234567e+12"), SV("{:L}"), F(1.234567e12
));
1927 test(SV("1.234567e+13"), SV("{:L}"), F(1.234567e13
));
1929 test(SV("-1.234567e-06"), SV("{:L}"), F(-1.234567e-6));
1930 test(SV("-1.234567e-05"), SV("{:L}"), F(-1.234567e-5));
1931 test(SV("-0.0001234567"), SV("{:L}"), F(-1.234567e-4));
1932 test(SV("-0.001234567"), SV("{:L}"), F(-1.234567e-3));
1933 test(SV("-0.01234567"), SV("{:L}"), F(-1.234567e-2));
1934 test(SV("-0.1234567"), SV("{:L}"), F(-1.234567e-1));
1935 test(SV("-1.234567"), SV("{:L}"), F(-1.234567e0
));
1936 test(SV("-12.34567"), SV("{:L}"), F(-1.234567e1
));
1937 test(SV("-123.4567"), SV("{:L}"), F(-1.234567e2
));
1938 test(SV("-1,234.567"), SV("{:L}"), F(-1.234567e3
));
1939 test(SV("-12,345.67"), SV("{:L}"), F(-1.234567e4
));
1940 test(SV("-123,456.7"), SV("{:L}"), F(-1.234567e5
));
1941 test(SV("-1,234,567"), SV("{:L}"), F(-1.234567e6
));
1942 test(SV("-12,345,670"), SV("{:L}"), F(-1.234567e7
));
1943 if constexpr (sizeof(F
) > sizeof(float)) {
1944 test(SV("-123,456,700"), SV("{:L}"), F(-1.234567e8
));
1945 test(SV("-1,234,567,000"), SV("{:L}"), F(-1.234567e9
));
1946 test(SV("-12,345,670,000"), SV("{:L}"), F(-1.234567e10
));
1947 test(SV("-123,456,700,000"), SV("{:L}"), F(-1.234567e11
));
1948 test(SV("-1.234567e+12"), SV("{:L}"), F(-1.234567e12
));
1949 test(SV("-1.234567e+13"), SV("{:L}"), F(-1.234567e13
));
1952 std::locale::global(loc
);
1953 test(SV("1#234567e-06"), SV("{:L}"), F(1.234567e-6));
1954 test(SV("1#234567e-05"), SV("{:L}"), F(1.234567e-5));
1955 test(SV("0#0001234567"), SV("{:L}"), F(1.234567e-4));
1956 test(SV("0#001234567"), SV("{:L}"), F(1.234567e-3));
1957 test(SV("0#01234567"), SV("{:L}"), F(1.234567e-2));
1958 test(SV("0#1234567"), SV("{:L}"), F(1.234567e-1));
1959 test(SV("1#234567"), SV("{:L}"), F(1.234567e0
));
1960 test(SV("1_2#34567"), SV("{:L}"), F(1.234567e1
));
1961 test(SV("12_3#4567"), SV("{:L}"), F(1.234567e2
));
1962 test(SV("1_23_4#567"), SV("{:L}"), F(1.234567e3
));
1963 test(SV("12_34_5#67"), SV("{:L}"), F(1.234567e4
));
1964 test(SV("123_45_6#7"), SV("{:L}"), F(1.234567e5
));
1965 test(SV("1_234_56_7"), SV("{:L}"), F(1.234567e6
));
1966 test(SV("12_345_67_0"), SV("{:L}"), F(1.234567e7
));
1967 if constexpr (sizeof(F
) > sizeof(float)) {
1968 test(SV("1_23_456_70_0"), SV("{:L}"), F(1.234567e8
));
1969 test(SV("1_2_34_567_00_0"), SV("{:L}"), F(1.234567e9
));
1970 test(SV("1_2_3_45_670_00_0"), SV("{:L}"), F(1.234567e10
));
1971 test(SV("1_2_3_4_56_700_00_0"), SV("{:L}"), F(1.234567e11
));
1972 test(SV("1#234567e+12"), SV("{:L}"), F(1.234567e12
));
1973 test(SV("1#234567e+13"), SV("{:L}"), F(1.234567e13
));
1975 test(SV("-1#234567e-06"), SV("{:L}"), F(-1.234567e-6));
1976 test(SV("-1#234567e-05"), SV("{:L}"), F(-1.234567e-5));
1977 test(SV("-0#0001234567"), SV("{:L}"), F(-1.234567e-4));
1978 test(SV("-0#001234567"), SV("{:L}"), F(-1.234567e-3));
1979 test(SV("-0#01234567"), SV("{:L}"), F(-1.234567e-2));
1980 test(SV("-0#1234567"), SV("{:L}"), F(-1.234567e-1));
1981 test(SV("-1#234567"), SV("{:L}"), F(-1.234567e0
));
1982 test(SV("-1_2#34567"), SV("{:L}"), F(-1.234567e1
));
1983 test(SV("-12_3#4567"), SV("{:L}"), F(-1.234567e2
));
1984 test(SV("-1_23_4#567"), SV("{:L}"), F(-1.234567e3
));
1985 test(SV("-12_34_5#67"), SV("{:L}"), F(-1.234567e4
));
1986 test(SV("-123_45_6#7"), SV("{:L}"), F(-1.234567e5
));
1987 test(SV("-1_234_56_7"), SV("{:L}"), F(-1.234567e6
));
1988 test(SV("-12_345_67_0"), SV("{:L}"), F(-1.234567e7
));
1989 if constexpr (sizeof(F
) > sizeof(float)) {
1990 test(SV("-1_23_456_70_0"), SV("{:L}"), F(-1.234567e8
));
1991 test(SV("-1_2_34_567_00_0"), SV("{:L}"), F(-1.234567e9
));
1992 test(SV("-1_2_3_45_670_00_0"), SV("{:L}"), F(-1.234567e10
));
1993 test(SV("-1_2_3_4_56_700_00_0"), SV("{:L}"), F(-1.234567e11
));
1994 test(SV("-1#234567e+12"), SV("{:L}"), F(-1.234567e12
));
1995 test(SV("-1#234567e+13"), SV("{:L}"), F(-1.234567e13
));
1998 test(SV("1.234567e-06"), en_US
, SV("{:L}"), F(1.234567e-6));
1999 test(SV("1.234567e-05"), en_US
, SV("{:L}"), F(1.234567e-5));
2000 test(SV("0.0001234567"), en_US
, SV("{:L}"), F(1.234567e-4));
2001 test(SV("0.001234567"), en_US
, SV("{:L}"), F(1.234567e-3));
2002 test(SV("0.01234567"), en_US
, SV("{:L}"), F(1.234567e-2));
2003 test(SV("0.1234567"), en_US
, SV("{:L}"), F(1.234567e-1));
2004 test(SV("1.234567"), en_US
, SV("{:L}"), F(1.234567e0
));
2005 test(SV("12.34567"), en_US
, SV("{:L}"), F(1.234567e1
));
2006 test(SV("123.4567"), en_US
, SV("{:L}"), F(1.234567e2
));
2007 test(SV("1,234.567"), en_US
, SV("{:L}"), F(1.234567e3
));
2008 test(SV("12,345.67"), en_US
, SV("{:L}"), F(1.234567e4
));
2009 test(SV("123,456.7"), en_US
, SV("{:L}"), F(1.234567e5
));
2010 test(SV("1,234,567"), en_US
, SV("{:L}"), F(1.234567e6
));
2011 test(SV("12,345,670"), en_US
, SV("{:L}"), F(1.234567e7
));
2012 if constexpr (sizeof(F
) > sizeof(float)) {
2013 test(SV("123,456,700"), en_US
, SV("{:L}"), F(1.234567e8
));
2014 test(SV("1,234,567,000"), en_US
, SV("{:L}"), F(1.234567e9
));
2015 test(SV("12,345,670,000"), en_US
, SV("{:L}"), F(1.234567e10
));
2016 test(SV("123,456,700,000"), en_US
, SV("{:L}"), F(1.234567e11
));
2017 test(SV("1.234567e+12"), en_US
, SV("{:L}"), F(1.234567e12
));
2018 test(SV("1.234567e+13"), en_US
, SV("{:L}"), F(1.234567e13
));
2020 test(SV("-1.234567e-06"), en_US
, SV("{:L}"), F(-1.234567e-6));
2021 test(SV("-1.234567e-05"), en_US
, SV("{:L}"), F(-1.234567e-5));
2022 test(SV("-0.0001234567"), en_US
, SV("{:L}"), F(-1.234567e-4));
2023 test(SV("-0.001234567"), en_US
, SV("{:L}"), F(-1.234567e-3));
2024 test(SV("-0.01234567"), en_US
, SV("{:L}"), F(-1.234567e-2));
2025 test(SV("-0.1234567"), en_US
, SV("{:L}"), F(-1.234567e-1));
2026 test(SV("-1.234567"), en_US
, SV("{:L}"), F(-1.234567e0
));
2027 test(SV("-12.34567"), en_US
, SV("{:L}"), F(-1.234567e1
));
2028 test(SV("-123.4567"), en_US
, SV("{:L}"), F(-1.234567e2
));
2029 test(SV("-1,234.567"), en_US
, SV("{:L}"), F(-1.234567e3
));
2030 test(SV("-12,345.67"), en_US
, SV("{:L}"), F(-1.234567e4
));
2031 test(SV("-123,456.7"), en_US
, SV("{:L}"), F(-1.234567e5
));
2032 test(SV("-1,234,567"), en_US
, SV("{:L}"), F(-1.234567e6
));
2033 test(SV("-12,345,670"), en_US
, SV("{:L}"), F(-1.234567e7
));
2034 if constexpr (sizeof(F
) > sizeof(float)) {
2035 test(SV("-123,456,700"), en_US
, SV("{:L}"), F(-1.234567e8
));
2036 test(SV("-1,234,567,000"), en_US
, SV("{:L}"), F(-1.234567e9
));
2037 test(SV("-12,345,670,000"), en_US
, SV("{:L}"), F(-1.234567e10
));
2038 test(SV("-123,456,700,000"), en_US
, SV("{:L}"), F(-1.234567e11
));
2039 test(SV("-1.234567e+12"), en_US
, SV("{:L}"), F(-1.234567e12
));
2040 test(SV("-1.234567e+13"), en_US
, SV("{:L}"), F(-1.234567e13
));
2043 std::locale::global(en_US
);
2044 test(SV("1#234567e-06"), loc
, SV("{:L}"), F(1.234567e-6));
2045 test(SV("1#234567e-05"), loc
, SV("{:L}"), F(1.234567e-5));
2046 test(SV("0#0001234567"), loc
, SV("{:L}"), F(1.234567e-4));
2047 test(SV("0#001234567"), loc
, SV("{:L}"), F(1.234567e-3));
2048 test(SV("0#01234567"), loc
, SV("{:L}"), F(1.234567e-2));
2049 test(SV("0#1234567"), loc
, SV("{:L}"), F(1.234567e-1));
2050 test(SV("1#234567"), loc
, SV("{:L}"), F(1.234567e0
));
2051 test(SV("1_2#34567"), loc
, SV("{:L}"), F(1.234567e1
));
2052 test(SV("12_3#4567"), loc
, SV("{:L}"), F(1.234567e2
));
2053 test(SV("1_23_4#567"), loc
, SV("{:L}"), F(1.234567e3
));
2054 test(SV("12_34_5#67"), loc
, SV("{:L}"), F(1.234567e4
));
2055 test(SV("123_45_6#7"), loc
, SV("{:L}"), F(1.234567e5
));
2056 test(SV("1_234_56_7"), loc
, SV("{:L}"), F(1.234567e6
));
2057 test(SV("12_345_67_0"), loc
, SV("{:L}"), F(1.234567e7
));
2058 if constexpr (sizeof(F
) > sizeof(float)) {
2059 test(SV("1_23_456_70_0"), loc
, SV("{:L}"), F(1.234567e8
));
2060 test(SV("1_2_34_567_00_0"), loc
, SV("{:L}"), F(1.234567e9
));
2061 test(SV("1_2_3_45_670_00_0"), loc
, SV("{:L}"), F(1.234567e10
));
2062 test(SV("1_2_3_4_56_700_00_0"), loc
, SV("{:L}"), F(1.234567e11
));
2063 test(SV("1#234567e+12"), loc
, SV("{:L}"), F(1.234567e12
));
2064 test(SV("1#234567e+13"), loc
, SV("{:L}"), F(1.234567e13
));
2066 test(SV("-1#234567e-06"), loc
, SV("{:L}"), F(-1.234567e-6));
2067 test(SV("-1#234567e-05"), loc
, SV("{:L}"), F(-1.234567e-5));
2068 test(SV("-0#0001234567"), loc
, SV("{:L}"), F(-1.234567e-4));
2069 test(SV("-0#001234567"), loc
, SV("{:L}"), F(-1.234567e-3));
2070 test(SV("-0#01234567"), loc
, SV("{:L}"), F(-1.234567e-2));
2071 test(SV("-0#1234567"), loc
, SV("{:L}"), F(-1.234567e-1));
2072 test(SV("-1#234567"), loc
, SV("{:L}"), F(-1.234567e0
));
2073 test(SV("-1_2#34567"), loc
, SV("{:L}"), F(-1.234567e1
));
2074 test(SV("-12_3#4567"), loc
, SV("{:L}"), F(-1.234567e2
));
2075 test(SV("-1_23_4#567"), loc
, SV("{:L}"), F(-1.234567e3
));
2076 test(SV("-12_34_5#67"), loc
, SV("{:L}"), F(-1.234567e4
));
2077 test(SV("-123_45_6#7"), loc
, SV("{:L}"), F(-1.234567e5
));
2078 test(SV("-1_234_56_7"), loc
, SV("{:L}"), F(-1.234567e6
));
2079 test(SV("-12_345_67_0"), loc
, SV("{:L}"), F(-1.234567e7
));
2080 if constexpr (sizeof(F
) > sizeof(float)) {
2081 test(SV("-1_23_456_70_0"), loc
, SV("{:L}"), F(-1.234567e8
));
2082 test(SV("-1_2_34_567_00_0"), loc
, SV("{:L}"), F(-1.234567e9
));
2083 test(SV("-1_2_3_45_670_00_0"), loc
, SV("{:L}"), F(-1.234567e10
));
2084 test(SV("-1_2_3_4_56_700_00_0"), loc
, SV("{:L}"), F(-1.234567e11
));
2085 test(SV("-1#234567e+12"), loc
, SV("{:L}"), F(-1.234567e12
));
2086 test(SV("-1#234567e+13"), loc
, SV("{:L}"), F(-1.234567e13
));
2089 // *** Fill, align, zero padding ***
2090 std::locale::global(en_US
);
2091 test(SV("1,234.567$$$"), SV("{:$<12L}"), F(1.234567e3
));
2092 test(SV("$$$1,234.567"), SV("{:$>12L}"), F(1.234567e3
));
2093 test(SV("$1,234.567$$"), SV("{:$^12L}"), F(1.234567e3
));
2094 test(SV("0001,234.567"), SV("{:012L}"), F(1.234567e3
));
2095 test(SV("-1,234.567$$$"), SV("{:$<13L}"), F(-1.234567e3
));
2096 test(SV("$$$-1,234.567"), SV("{:$>13L}"), F(-1.234567e3
));
2097 test(SV("$-1,234.567$$"), SV("{:$^13L}"), F(-1.234567e3
));
2098 test(SV("-0001,234.567"), SV("{:013L}"), F(-1.234567e3
));
2100 std::locale::global(loc
);
2101 test(SV("1_23_4#567$$$"), SV("{:$<13L}"), F(1.234567e3
));
2102 test(SV("$$$1_23_4#567"), SV("{:$>13L}"), F(1.234567e3
));
2103 test(SV("$1_23_4#567$$"), SV("{:$^13L}"), F(1.234567e3
));
2104 test(SV("0001_23_4#567"), SV("{:013L}"), F(1.234567e3
));
2105 test(SV("-1_23_4#567$$$"), SV("{:$<14L}"), F(-1.234567e3
));
2106 test(SV("$$$-1_23_4#567"), SV("{:$>14L}"), F(-1.234567e3
));
2107 test(SV("$-1_23_4#567$$"), SV("{:$^14L}"), F(-1.234567e3
));
2108 test(SV("-0001_23_4#567"), SV("{:014L}"), F(-1.234567e3
));
2110 test(SV("1,234.567$$$"), en_US
, SV("{:$<12L}"), F(1.234567e3
));
2111 test(SV("$$$1,234.567"), en_US
, SV("{:$>12L}"), F(1.234567e3
));
2112 test(SV("$1,234.567$$"), en_US
, SV("{:$^12L}"), F(1.234567e3
));
2113 test(SV("0001,234.567"), en_US
, SV("{:012L}"), F(1.234567e3
));
2114 test(SV("-1,234.567$$$"), en_US
, SV("{:$<13L}"), F(-1.234567e3
));
2115 test(SV("$$$-1,234.567"), en_US
, SV("{:$>13L}"), F(-1.234567e3
));
2116 test(SV("$-1,234.567$$"), en_US
, SV("{:$^13L}"), F(-1.234567e3
));
2117 test(SV("-0001,234.567"), en_US
, SV("{:013L}"), F(-1.234567e3
));
2119 std::locale::global(en_US
);
2120 test(SV("1_23_4#567$$$"), loc
, SV("{:$<13L}"), F(1.234567e3
));
2121 test(SV("$$$1_23_4#567"), loc
, SV("{:$>13L}"), F(1.234567e3
));
2122 test(SV("$1_23_4#567$$"), loc
, SV("{:$^13L}"), F(1.234567e3
));
2123 test(SV("0001_23_4#567"), loc
, SV("{:013L}"), F(1.234567e3
));
2124 test(SV("-1_23_4#567$$$"), loc
, SV("{:$<14L}"), F(-1.234567e3
));
2125 test(SV("$$$-1_23_4#567"), loc
, SV("{:$>14L}"), F(-1.234567e3
));
2126 test(SV("$-1_23_4#567$$"), loc
, SV("{:$^14L}"), F(-1.234567e3
));
2127 test(SV("-0001_23_4#567"), loc
, SV("{:014L}"), F(-1.234567e3
));
2130 template <class F
, class CharT
>
2131 void test_floating_point_default_precision() {
2132 std::locale loc
= std::locale(std::locale(), new numpunct
<CharT
>());
2133 std::locale en_US
= std::locale(LOCALE_en_US_UTF_8
);
2136 std::locale::global(en_US
);
2137 test(SV("1.23457e-06"), SV("{:.6L}"), F(1.234567e-6));
2138 test(SV("1.23457e-05"), SV("{:.6L}"), F(1.234567e-5));
2139 test(SV("0.000123457"), SV("{:.6L}"), F(1.234567e-4));
2140 test(SV("0.00123457"), SV("{:.6L}"), F(1.234567e-3));
2141 test(SV("0.0123457"), SV("{:.6L}"), F(1.234567e-2));
2142 test(SV("0.123457"), SV("{:.6L}"), F(1.234567e-1));
2143 test(SV("1.23457"), SV("{:.6L}"), F(1.234567e0
));
2144 test(SV("12.3457"), SV("{:.6L}"), F(1.234567e1
));
2145 test(SV("123.457"), SV("{:.6L}"), F(1.234567e2
));
2146 test(SV("1,234.57"), SV("{:.6L}"), F(1.234567e3
));
2147 test(SV("12,345.7"), SV("{:.6L}"), F(1.234567e4
));
2148 test(SV("123,457"), SV("{:.6L}"), F(1.234567e5
));
2149 test(SV("1.23457e+06"), SV("{:.6L}"), F(1.234567e6
));
2150 test(SV("1.23457e+07"), SV("{:.6L}"), F(1.234567e7
));
2151 test(SV("-1.23457e-06"), SV("{:.6L}"), F(-1.234567e-6));
2152 test(SV("-1.23457e-05"), SV("{:.6L}"), F(-1.234567e-5));
2153 test(SV("-0.000123457"), SV("{:.6L}"), F(-1.234567e-4));
2154 test(SV("-0.00123457"), SV("{:.6L}"), F(-1.234567e-3));
2155 test(SV("-0.0123457"), SV("{:.6L}"), F(-1.234567e-2));
2156 test(SV("-0.123457"), SV("{:.6L}"), F(-1.234567e-1));
2157 test(SV("-1.23457"), SV("{:.6L}"), F(-1.234567e0
));
2158 test(SV("-12.3457"), SV("{:.6L}"), F(-1.234567e1
));
2159 test(SV("-123.457"), SV("{:.6L}"), F(-1.234567e2
));
2160 test(SV("-1,234.57"), SV("{:.6L}"), F(-1.234567e3
));
2161 test(SV("-12,345.7"), SV("{:.6L}"), F(-1.234567e4
));
2162 test(SV("-123,457"), SV("{:.6L}"), F(-1.234567e5
));
2163 test(SV("-1.23457e+06"), SV("{:.6L}"), F(-1.234567e6
));
2164 test(SV("-1.23457e+07"), SV("{:.6L}"), F(-1.234567e7
));
2166 std::locale::global(loc
);
2167 test(SV("1#23457e-06"), SV("{:.6L}"), F(1.234567e-6));
2168 test(SV("1#23457e-05"), SV("{:.6L}"), F(1.234567e-5));
2169 test(SV("0#000123457"), SV("{:.6L}"), F(1.234567e-4));
2170 test(SV("0#00123457"), SV("{:.6L}"), F(1.234567e-3));
2171 test(SV("0#0123457"), SV("{:.6L}"), F(1.234567e-2));
2172 test(SV("0#123457"), SV("{:.6L}"), F(1.234567e-1));
2173 test(SV("1#23457"), SV("{:.6L}"), F(1.234567e0
));
2174 test(SV("1_2#3457"), SV("{:.6L}"), F(1.234567e1
));
2175 test(SV("12_3#457"), SV("{:.6L}"), F(1.234567e2
));
2176 test(SV("1_23_4#57"), SV("{:.6L}"), F(1.234567e3
));
2177 test(SV("12_34_5#7"), SV("{:.6L}"), F(1.234567e4
));
2178 test(SV("123_45_7"), SV("{:.6L}"), F(1.234567e5
));
2179 test(SV("1#23457e+06"), SV("{:.6L}"), F(1.234567e6
));
2180 test(SV("1#23457e+07"), SV("{:.6L}"), F(1.234567e7
));
2181 test(SV("-1#23457e-06"), SV("{:.6L}"), F(-1.234567e-6));
2182 test(SV("-1#23457e-05"), SV("{:.6L}"), F(-1.234567e-5));
2183 test(SV("-0#000123457"), SV("{:.6L}"), F(-1.234567e-4));
2184 test(SV("-0#00123457"), SV("{:.6L}"), F(-1.234567e-3));
2185 test(SV("-0#0123457"), SV("{:.6L}"), F(-1.234567e-2));
2186 test(SV("-0#123457"), SV("{:.6L}"), F(-1.234567e-1));
2187 test(SV("-1#23457"), SV("{:.6L}"), F(-1.234567e0
));
2188 test(SV("-1_2#3457"), SV("{:.6L}"), F(-1.234567e1
));
2189 test(SV("-12_3#457"), SV("{:.6L}"), F(-1.234567e2
));
2190 test(SV("-1_23_4#57"), SV("{:.6L}"), F(-1.234567e3
));
2191 test(SV("-12_34_5#7"), SV("{:.6L}"), F(-1.234567e4
));
2192 test(SV("-123_45_7"), SV("{:.6L}"), F(-1.234567e5
));
2193 test(SV("-1#23457e+06"), SV("{:.6L}"), F(-1.234567e6
));
2194 test(SV("-1#23457e+07"), SV("{:.6L}"), F(-1.234567e7
));
2196 test(SV("1.23457e-06"), en_US
, SV("{:.6L}"), F(1.234567e-6));
2197 test(SV("1.23457e-05"), en_US
, SV("{:.6L}"), F(1.234567e-5));
2198 test(SV("0.000123457"), en_US
, SV("{:.6L}"), F(1.234567e-4));
2199 test(SV("0.00123457"), en_US
, SV("{:.6L}"), F(1.234567e-3));
2200 test(SV("0.0123457"), en_US
, SV("{:.6L}"), F(1.234567e-2));
2201 test(SV("0.123457"), en_US
, SV("{:.6L}"), F(1.234567e-1));
2202 test(SV("1.23457"), en_US
, SV("{:.6L}"), F(1.234567e0
));
2203 test(SV("12.3457"), en_US
, SV("{:.6L}"), F(1.234567e1
));
2204 test(SV("123.457"), en_US
, SV("{:.6L}"), F(1.234567e2
));
2205 test(SV("1,234.57"), en_US
, SV("{:.6L}"), F(1.234567e3
));
2206 test(SV("12,345.7"), en_US
, SV("{:.6L}"), F(1.234567e4
));
2207 test(SV("123,457"), en_US
, SV("{:.6L}"), F(1.234567e5
));
2208 test(SV("1.23457e+06"), en_US
, SV("{:.6L}"), F(1.234567e6
));
2209 test(SV("1.23457e+07"), en_US
, SV("{:.6L}"), F(1.234567e7
));
2210 test(SV("-1.23457e-06"), en_US
, SV("{:.6L}"), F(-1.234567e-6));
2211 test(SV("-1.23457e-05"), en_US
, SV("{:.6L}"), F(-1.234567e-5));
2212 test(SV("-0.000123457"), en_US
, SV("{:.6L}"), F(-1.234567e-4));
2213 test(SV("-0.00123457"), en_US
, SV("{:.6L}"), F(-1.234567e-3));
2214 test(SV("-0.0123457"), en_US
, SV("{:.6L}"), F(-1.234567e-2));
2215 test(SV("-0.123457"), en_US
, SV("{:.6L}"), F(-1.234567e-1));
2216 test(SV("-1.23457"), en_US
, SV("{:.6L}"), F(-1.234567e0
));
2217 test(SV("-12.3457"), en_US
, SV("{:.6L}"), F(-1.234567e1
));
2218 test(SV("-123.457"), en_US
, SV("{:.6L}"), F(-1.234567e2
));
2219 test(SV("-1,234.57"), en_US
, SV("{:.6L}"), F(-1.234567e3
));
2220 test(SV("-12,345.7"), en_US
, SV("{:.6L}"), F(-1.234567e4
));
2221 test(SV("-123,457"), en_US
, SV("{:.6L}"), F(-1.234567e5
));
2222 test(SV("-1.23457e+06"), en_US
, SV("{:.6L}"), F(-1.234567e6
));
2223 test(SV("-1.23457e+07"), en_US
, SV("{:.6L}"), F(-1.234567e7
));
2225 std::locale::global(en_US
);
2226 test(SV("1#23457e-06"), loc
, SV("{:.6L}"), F(1.234567e-6));
2227 test(SV("1#23457e-05"), loc
, SV("{:.6L}"), F(1.234567e-5));
2228 test(SV("0#000123457"), loc
, SV("{:.6L}"), F(1.234567e-4));
2229 test(SV("0#00123457"), loc
, SV("{:.6L}"), F(1.234567e-3));
2230 test(SV("0#0123457"), loc
, SV("{:.6L}"), F(1.234567e-2));
2231 test(SV("0#123457"), loc
, SV("{:.6L}"), F(1.234567e-1));
2232 test(SV("1#23457"), loc
, SV("{:.6L}"), F(1.234567e0
));
2233 test(SV("1_2#3457"), loc
, SV("{:.6L}"), F(1.234567e1
));
2234 test(SV("12_3#457"), loc
, SV("{:.6L}"), F(1.234567e2
));
2235 test(SV("1_23_4#57"), loc
, SV("{:.6L}"), F(1.234567e3
));
2236 test(SV("12_34_5#7"), loc
, SV("{:.6L}"), F(1.234567e4
));
2237 test(SV("123_45_7"), loc
, SV("{:.6L}"), F(1.234567e5
));
2238 test(SV("1#23457e+06"), loc
, SV("{:.6L}"), F(1.234567e6
));
2239 test(SV("1#23457e+07"), loc
, SV("{:.6L}"), F(1.234567e7
));
2240 test(SV("-1#23457e-06"), loc
, SV("{:.6L}"), F(-1.234567e-6));
2241 test(SV("-1#23457e-05"), loc
, SV("{:.6L}"), F(-1.234567e-5));
2242 test(SV("-0#000123457"), loc
, SV("{:.6L}"), F(-1.234567e-4));
2243 test(SV("-0#00123457"), loc
, SV("{:.6L}"), F(-1.234567e-3));
2244 test(SV("-0#0123457"), loc
, SV("{:.6L}"), F(-1.234567e-2));
2245 test(SV("-0#123457"), loc
, SV("{:.6L}"), F(-1.234567e-1));
2246 test(SV("-1#23457"), loc
, SV("{:.6L}"), F(-1.234567e0
));
2247 test(SV("-1_2#3457"), loc
, SV("{:.6L}"), F(-1.234567e1
));
2248 test(SV("-12_3#457"), loc
, SV("{:.6L}"), F(-1.234567e2
));
2249 test(SV("-1_23_4#57"), loc
, SV("{:.6L}"), F(-1.234567e3
));
2250 test(SV("-12_34_5#7"), loc
, SV("{:.6L}"), F(-1.234567e4
));
2251 test(SV("-123_45_7"), loc
, SV("{:.6L}"), F(-1.234567e5
));
2252 test(SV("-1#23457e+06"), loc
, SV("{:.6L}"), F(-1.234567e6
));
2253 test(SV("-1#23457e+07"), loc
, SV("{:.6L}"), F(-1.234567e7
));
2255 // *** Fill, align, zero padding ***
2256 std::locale::global(en_US
);
2257 test(SV("1,234.57$$$"), SV("{:$<11.6L}"), F(1.234567e3
));
2258 test(SV("$$$1,234.57"), SV("{:$>11.6L}"), F(1.234567e3
));
2259 test(SV("$1,234.57$$"), SV("{:$^11.6L}"), F(1.234567e3
));
2260 test(SV("0001,234.57"), SV("{:011.6L}"), F(1.234567e3
));
2261 test(SV("-1,234.57$$$"), SV("{:$<12.6L}"), F(-1.234567e3
));
2262 test(SV("$$$-1,234.57"), SV("{:$>12.6L}"), F(-1.234567e3
));
2263 test(SV("$-1,234.57$$"), SV("{:$^12.6L}"), F(-1.234567e3
));
2264 test(SV("-0001,234.57"), SV("{:012.6L}"), F(-1.234567e3
));
2266 std::locale::global(loc
);
2267 test(SV("1_23_4#57$$$"), SV("{:$<12.6L}"), F(1.234567e3
));
2268 test(SV("$$$1_23_4#57"), SV("{:$>12.6L}"), F(1.234567e3
));
2269 test(SV("$1_23_4#57$$"), SV("{:$^12.6L}"), F(1.234567e3
));
2270 test(SV("0001_23_4#57"), SV("{:012.6L}"), F(1.234567e3
));
2271 test(SV("-1_23_4#57$$$"), SV("{:$<13.6L}"), F(-1.234567e3
));
2272 test(SV("$$$-1_23_4#57"), SV("{:$>13.6L}"), F(-1.234567e3
));
2273 test(SV("$-1_23_4#57$$"), SV("{:$^13.6L}"), F(-1.234567e3
));
2274 test(SV("-0001_23_4#57"), SV("{:013.6L}"), F(-1.234567e3
));
2276 test(SV("1,234.57$$$"), en_US
, SV("{:$<11.6L}"), F(1.234567e3
));
2277 test(SV("$$$1,234.57"), en_US
, SV("{:$>11.6L}"), F(1.234567e3
));
2278 test(SV("$1,234.57$$"), en_US
, SV("{:$^11.6L}"), F(1.234567e3
));
2279 test(SV("0001,234.57"), en_US
, SV("{:011.6L}"), F(1.234567e3
));
2280 test(SV("-1,234.57$$$"), en_US
, SV("{:$<12.6L}"), F(-1.234567e3
));
2281 test(SV("$$$-1,234.57"), en_US
, SV("{:$>12.6L}"), F(-1.234567e3
));
2282 test(SV("$-1,234.57$$"), en_US
, SV("{:$^12.6L}"), F(-1.234567e3
));
2283 test(SV("-0001,234.57"), en_US
, SV("{:012.6L}"), F(-1.234567e3
));
2285 std::locale::global(en_US
);
2286 test(SV("1_23_4#57$$$"), loc
, SV("{:$<12.6L}"), F(1.234567e3
));
2287 test(SV("$$$1_23_4#57"), loc
, SV("{:$>12.6L}"), F(1.234567e3
));
2288 test(SV("$1_23_4#57$$"), loc
, SV("{:$^12.6L}"), F(1.234567e3
));
2289 test(SV("0001_23_4#57"), loc
, SV("{:012.6L}"), F(1.234567e3
));
2290 test(SV("-1_23_4#57$$$"), loc
, SV("{:$<13.6L}"), F(-1.234567e3
));
2291 test(SV("$$$-1_23_4#57"), loc
, SV("{:$>13.6L}"), F(-1.234567e3
));
2292 test(SV("$-1_23_4#57$$"), loc
, SV("{:$^13.6L}"), F(-1.234567e3
));
2293 test(SV("-0001_23_4#57"), loc
, SV("{:013.6L}"), F(-1.234567e3
));
2296 template <class F
, class CharT
>
2297 void test_floating_point() {
2298 test_floating_point_hex_lower_case
<F
, CharT
>();
2299 test_floating_point_hex_upper_case
<F
, CharT
>();
2300 test_floating_point_hex_lower_case_precision
<F
, CharT
>();
2301 test_floating_point_hex_upper_case_precision
<F
, CharT
>();
2303 test_floating_point_scientific_lower_case
<F
, CharT
>();
2304 test_floating_point_scientific_upper_case
<F
, CharT
>();
2306 test_floating_point_fixed_lower_case
<F
, CharT
>();
2307 test_floating_point_fixed_upper_case
<F
, CharT
>();
2309 test_floating_point_general_lower_case
<F
, CharT
>();
2310 test_floating_point_general_upper_case
<F
, CharT
>();
2312 test_floating_point_default
<F
, CharT
>();
2313 test_floating_point_default_precision
<F
, CharT
>();
2316 template <class CharT
>
2319 test_integer
<CharT
>();
2320 test_floating_point
<float, CharT
>();
2321 test_floating_point
<double, CharT
>();
2322 test_floating_point
<long double, CharT
>();
2325 int main(int, char**) {
2327 #ifndef TEST_HAS_NO_WIDE_CHARACTERS