1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* Type-specific source code for unit test
25 *
26 * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
27 * We check in the generated source files so that the test tree can be used
28 * independently of the rest of the source tree.
29 */
30
31 // -- This file was mechanically generated: Do not edit! -- //
32
33 import java.io.*;
34 import java.math.BigDecimal;
35 import java.math.BigInteger;
36 import java.text.DateFormatSymbols;
37 import java.util.*;
38
39
40
41
42 import static java.util.Calendar.*;
43
44
45
46
47
48 public class BasicFloatObject extends Basic {
49
50 private static void test(String fs, String exp, Object ... args) {
51 Formatter f = new Formatter(new StringBuilder(), Locale.US);
52 f.format(fs, args);
53 ck(fs, exp, f.toString());
54
55 f = new Formatter(new StringBuilder(), Locale.US);
56 f.format("foo " + fs + " bar", args);
57 ck(fs, "foo " + exp + " bar", f.toString());
58 }
59
60 private static void test(Locale l, String fs, String exp, Object ... args)
61 {
1064 test("%3.0f", " 1", 1.00);
1065 test("%3.0f", " 10", 10.00);
1066 test("%3.0f", " 99", 99.19);
1067 test("%3.1f", "99.2", 99.19);
1068 test("%3.0f", "100", 99.99);
1069 test("%3.0f", "100", 100.00);
1070 test("%#3.0f", "1000.", 1000.00);
1071 test("%3.0f", "10000", 10000.00);
1072 test("%3.0f", "100000", 100000.00);
1073 test("%3.0f", "1000000", 1000000.00);
1074 test("%3.0f", "10000000", 10000000.00);
1075 test("%3.0f", "100000000", 100000000.00);
1076 test("%10.0f", " 1000000", 1000000.00);
1077 test("%,10.0f", " 1,000,000", 1000000.00);
1078 test("%,10.1f", "1,000,000.0", 1000000.00);
1079 test("%,3.0f", "1,000,000", 1000000.00);
1080 test("%,3.0f", "10,000,000", 10000000.00);
1081 test("%,3.0f", "100,000,000", 100000000.00);
1082 test("%,3.0f", "10,000,000", 10000000.00);
1083 test("%,3.0f", "100,000,000", 100000000.00);
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
|
1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* Type-specific source code for unit test
25 *
26 * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
27 * We check in the generated source files so that the test tree can be used
28 * independently of the rest of the source tree.
29 */
30
31 // -- This file was mechanically generated: Do not edit! -- //
32
33 import java.io.*;
34 import java.math.BigDecimal;
35 import java.math.BigInteger;
36 import java.text.DateFormatSymbols;
37 import java.util.*;
38
39 import static java.util.Calendar.*;
40
41
42
43
44
45 public class BasicFloatObject extends Basic {
46
47 private static void test(String fs, String exp, Object ... args) {
48 Formatter f = new Formatter(new StringBuilder(), Locale.US);
49 f.format(fs, args);
50 ck(fs, exp, f.toString());
51
52 f = new Formatter(new StringBuilder(), Locale.US);
53 f.format("foo " + fs + " bar", args);
54 ck(fs, "foo " + exp + " bar", f.toString());
55 }
56
57 private static void test(Locale l, String fs, String exp, Object ... args)
58 {
1061 test("%3.0f", " 1", 1.00);
1062 test("%3.0f", " 10", 10.00);
1063 test("%3.0f", " 99", 99.19);
1064 test("%3.1f", "99.2", 99.19);
1065 test("%3.0f", "100", 99.99);
1066 test("%3.0f", "100", 100.00);
1067 test("%#3.0f", "1000.", 1000.00);
1068 test("%3.0f", "10000", 10000.00);
1069 test("%3.0f", "100000", 100000.00);
1070 test("%3.0f", "1000000", 1000000.00);
1071 test("%3.0f", "10000000", 10000000.00);
1072 test("%3.0f", "100000000", 100000000.00);
1073 test("%10.0f", " 1000000", 1000000.00);
1074 test("%,10.0f", " 1,000,000", 1000000.00);
1075 test("%,10.1f", "1,000,000.0", 1000000.00);
1076 test("%,3.0f", "1,000,000", 1000000.00);
1077 test("%,3.0f", "10,000,000", 10000000.00);
1078 test("%,3.0f", "100,000,000", 100000000.00);
1079 test("%,3.0f", "10,000,000", 10000000.00);
1080 test("%,3.0f", "100,000,000", 100000000.00);
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
|