author | skovalev |
Fri, 09 Sep 2016 10:58:05 -0700 | |
changeset 40801 | 9bf0aafeb2bb |
parent 10138 | b7572da25d15 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
40801
9bf0aafeb2bb
8165592: Fix module dependencies for sun/text/* tests
skovalev
parents:
10138
diff
changeset
|
2 |
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 4804273 |
|
40801
9bf0aafeb2bb
8165592: Fix module dependencies for sun/text/* tests
skovalev
parents:
10138
diff
changeset
|
27 |
* @modules jdk.localedata |
2 | 28 |
* @summary updating collation tables for swedish |
29 |
*/ |
|
30 |
||
40801
9bf0aafeb2bb
8165592: Fix module dependencies for sun/text/* tests
skovalev
parents:
10138
diff
changeset
|
31 |
import java.text.Collator; |
9bf0aafeb2bb
8165592: Fix module dependencies for sun/text/* tests
skovalev
parents:
10138
diff
changeset
|
32 |
import java.util.Arrays; |
9bf0aafeb2bb
8165592: Fix module dependencies for sun/text/* tests
skovalev
parents:
10138
diff
changeset
|
33 |
import java.util.Locale; |
2 | 34 |
|
35 |
public class Bug4804273 { |
|
36 |
||
37 |
/******************************************************** |
|
38 |
*********************************************************/ |
|
39 |
public static void main (String[] args) { |
|
10138 | 40 |
Locale reservedLocale = Locale.getDefault(); |
41 |
try { |
|
42 |
int errors=0; |
|
2 | 43 |
|
10138 | 44 |
Locale loc = new Locale ("sv", "se"); // Swedish |
2 | 45 |
|
10138 | 46 |
Locale.setDefault (loc); |
47 |
Collator col = Collator.getInstance (); |
|
2 | 48 |
|
10138 | 49 |
String[] data = {"A", |
50 |
"Aa", |
|
51 |
"Ae", |
|
52 |
"B", |
|
53 |
"Y", |
|
54 |
"U\u0308", // U-umlaut |
|
55 |
"Z", |
|
56 |
"A\u030a", // A-ring |
|
57 |
"A\u0308", // A-umlaut |
|
58 |
"\u00c6", // AE ligature |
|
59 |
"O\u0308", // O-umlaut |
|
60 |
"a\u030b", // a-double-acute |
|
61 |
"\u00d8", // O-stroke |
|
62 |
"a", |
|
63 |
"aa", |
|
64 |
"ae", |
|
65 |
"b", |
|
66 |
"y", |
|
67 |
"u\u0308", // u-umlaut |
|
68 |
"z", |
|
69 |
"A\u030b", // A-double-acute |
|
70 |
"a\u030a", // a-ring |
|
71 |
"a\u0308", // a-umlaut |
|
72 |
"\u00e6", // ae ligature |
|
73 |
"o\u0308", // o-umlaut |
|
74 |
"\u00f8", // o-stroke |
|
75 |
}; |
|
2 | 76 |
|
77 |
||
10138 | 78 |
String[] sortedData = {"a", |
79 |
"A", |
|
80 |
"aa", |
|
81 |
"Aa", |
|
82 |
"ae", |
|
83 |
"Ae", |
|
84 |
"b", |
|
85 |
"B", |
|
86 |
"y", |
|
87 |
"Y", |
|
88 |
"u\u0308", // o-umlaut |
|
89 |
"U\u0308", // o-umlaut |
|
90 |
"z", |
|
91 |
"Z", |
|
92 |
"a\u030a", // a-ring |
|
93 |
"A\u030a", // A-ring |
|
94 |
"a\u0308", // a-umlaut |
|
95 |
"A\u0308", // A-umlaut |
|
96 |
"a\u030b", // a-double-acute |
|
97 |
"A\u030b", // A-double-acute |
|
98 |
"\u00e6", // ae ligature |
|
99 |
"\u00c6", // AE ligature |
|
100 |
"o\u0308", // o-umlaut |
|
101 |
"O\u0308", // O-umlaut |
|
102 |
"\u00f8", // o-stroke |
|
103 |
"\u00d8", // O-stroke |
|
104 |
}; |
|
2 | 105 |
|
10138 | 106 |
Arrays.sort (data, col); |
2 | 107 |
|
10138 | 108 |
System.out.println ("Using " + loc.getDisplayName()); |
109 |
for (int i = 0; i < data.length; i++) { |
|
110 |
System.out.println(data[i] + " : " + sortedData[i]); |
|
111 |
if (sortedData[i].compareTo(data[i]) != 0) { |
|
112 |
errors++; |
|
113 |
} |
|
114 |
}//end for |
|
2 | 115 |
|
10138 | 116 |
if (errors > 0) |
117 |
throw new RuntimeException("There are " + errors + |
|
118 |
" words sorted incorrectly!"); |
|
119 |
} finally { |
|
120 |
// restore the reserved locale |
|
121 |
Locale.setDefault(reservedLocale); |
|
122 |
} |
|
2 | 123 |
}//end main |
124 |
||
125 |
}//end class CollatorTest |