1 /*
2 * Copyright (c) 2012, 2018, 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 */
51 private static int errors = 0;
52
53 private static String providers;
54
55 // This test is locale data-dependent.
56 public static void main(String[] args) {
57 providers = args[0];
58
59 test(US, ERA, "B",
60 ERA, BC, YEAR, 1);
61 test(US, ERA, "A",
62 ERA, AD, YEAR, 2012);
63 test(US, DAY_OF_WEEK, "S",
64 YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23);
65 test(US, AM_PM, "a",
66 HOUR_OF_DAY, 10);
67 test(US, AM_PM, "p",
68 HOUR_OF_DAY, 23);
69 test(JAJPJP, DAY_OF_WEEK,
70 LocalDateTime.now().isBefore(LocalDateTime.of(2019, 5, 1, 0, 0)) ?
71 "\u65e5" : "\u706b", // "Sun" for HEISEI, "Tue" for NEWERA
72 YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23);
73 test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.",
74 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5);
75 test(THTH, DAY_OF_WEEK, "\u0e1e",
76 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5);
77
78 testMap(US, DAY_OF_WEEK, ALL_STYLES, // shouldn't include any narrow names
79 "", // 1-based indexing for DAY_OF_WEEK
80 "Sunday", // Sunday
81 "Monday", // Monday
82 "Tuesday", // Tuesday
83 "Wednesday", // Wednesday
84 "Thursday", // Thursday
85 "Friday", // Friday
86 "Saturday", // Saturday
87 RESET_INDEX,
88 "", // 1-based indexing for DAY_OF_WEEK
89 "Sun", // abb Sunday
90 "Mon", // abb Monday
91 "Tue", // abb Tuesday
|
1 /*
2 * Copyright (c) 2012, 2019, 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 */
51 private static int errors = 0;
52
53 private static String providers;
54
55 // This test is locale data-dependent.
56 public static void main(String[] args) {
57 providers = args[0];
58
59 test(US, ERA, "B",
60 ERA, BC, YEAR, 1);
61 test(US, ERA, "A",
62 ERA, AD, YEAR, 2012);
63 test(US, DAY_OF_WEEK, "S",
64 YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23);
65 test(US, AM_PM, "a",
66 HOUR_OF_DAY, 10);
67 test(US, AM_PM, "p",
68 HOUR_OF_DAY, 23);
69 test(JAJPJP, DAY_OF_WEEK,
70 LocalDateTime.now().isBefore(LocalDateTime.of(2019, 5, 1, 0, 0)) ?
71 "\u65e5" : "\u706b", // "Sun" for HEISEI, "Tue" for REIWA
72 YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23);
73 test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.",
74 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5);
75 test(THTH, DAY_OF_WEEK, "\u0e1e",
76 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5);
77
78 testMap(US, DAY_OF_WEEK, ALL_STYLES, // shouldn't include any narrow names
79 "", // 1-based indexing for DAY_OF_WEEK
80 "Sunday", // Sunday
81 "Monday", // Monday
82 "Tuesday", // Tuesday
83 "Wednesday", // Wednesday
84 "Thursday", // Thursday
85 "Friday", // Friday
86 "Saturday", // Saturday
87 RESET_INDEX,
88 "", // 1-based indexing for DAY_OF_WEEK
89 "Sun", // abb Sunday
90 "Mon", // abb Monday
91 "Tue", // abb Tuesday
|