1 /*
2  * Copyright (c) 1997, 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 /*
25  * @test
26  * @bug 4930708 4174436 5008498
27  * @library /java/text/testlib
28  * @summary test Danish Collation
29  * @modules jdk.localedata
30  */
31 /*
32 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
33 (C) Copyright IBM Corp. 1996 - All Rights Reserved
34 
35   The original version of this source code and documentation is copyrighted and
36 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
37 provided under terms of a License Agreement between Taligent and Sun. This
38 technology is protected by multiple US and International patents. This notice and
39 attribution to Taligent may not be removed.
40   Taligent is a registered trademark of Taligent, Inc.
41 */
42 
43 import java.util.Locale;
44 import java.text.Collator;
45 
46 // Quick dummy program for printing out test results
47 public class DanishTest extends CollatorTest {
48 
main(String[] args)49     public static void main(String[] args) throws Exception {
50         new DanishTest().run(args);
51     }
52 
53     /*
54      * Data for TestPrimary()
55      */
56     private static final String[] primarySourceData = {
57         "Lvi",
58         "L\u00E4vi",
59         "L\u00FCbeck",
60         "ANDR\u00C9",
61         "ANDRE",
62         "ANNONCERER"
63     };
64 
65     private static final String[] primaryTargetData = {
66             "Lwi",
67             "L\u00F6wi",
68             "Lybeck",
69             "ANDR\u00E9",
70             "ANDR\u00C9",
71             "ANN\u00D3NCERER"
72     };
73 
74     private static final int[] primaryResults = {
75             -1, -1, 0, 0, 0, 0
76     };
77 
78     /*
79      * Data for TestTertiary()
80      */
81     private static final String[] tertiarySourceData = {
82             "Luc",
83             "luck",
84             "L\u00FCbeck",
85             "L\u00E4vi",
86             "L\u00F6ww"
87     };
88 
89     private static final String[] tertiaryTargetData = {
90             "luck",
91             "L\u00FCbeck",
92             "lybeck",
93             "L\u00F6we",
94             "mast"
95     };
96 
97     private static final int[] tertiaryResults = {
98             -1, -1,  1, -1, -1
99     };
100 
101     /*
102      * Data for TestExtra()
103      */
104     private static final String[] testData = {
105             "A/S",
106             "ANDRE",
107             "ANDR\u00C9", // E-acute
108             "ANDR\u00C8", // E-grave
109             "ANDR\u00E9", // e-acute
110             "ANDR\u00EA", // e-circ
111             "Andre",
112             "Andr\u00E9", // e-acute
113             "\u00C1NDRE", // A-acute
114             "\u00C0NDRE", // A-grave
115             "andre",
116             "\u00E1ndre", // a-acute
117             "\u00E0ndre", // a-grave
118             "ANDREAS",
119             "ANNONCERER",
120             "ANN\u00D3NCERER", // O-acute
121             "annoncerer",
122             "ann\u00F3ncerer", // o-acute
123             "AS",
124             "A\u00e6RO", // ae-ligature
125             "CA",
126             "\u00C7A", // C-cedilla
127             "CB",
128             "\u00C7C", // C-cedilla
129             "D.S.B.",
130             "DA",
131             "DB",
132             "\u00D0ORA", // capital eth
133             "DSB",
134             "\u00D0SB", // capital eth
135             "DSC",
136             "EKSTRA_ARBEJDE",
137             "EKSTRABUD",
138             "H\u00D8ST",  // could the 0x00D8 be 0x2205?
139             "HAAG",
140             "H\u00C5NDBOG", // A-ring
141             "HAANDV\u00C6RKSBANKEN", // AE-ligature
142             "INTERNETFORBINDELSE",
143             "Internetforbindelse",
144             "\u00CDNTERNETFORBINDELSE", // I-acute
145             "internetforbindelse",
146             "\u00EDnternetforbindelse", // i-acute
147             "Karl",
148             "karl",
149             "NIELSEN",
150             "NIELS J\u00D8RGEN", // O-slash
151             "NIELS-J\u00D8RGEN", // O-slash
152             "OERVAL",
153             "\u0152RVAL", // OE-ligature
154             "\u0153RVAL", // oe-ligature
155             "R\u00C9E, A", // E-acute
156             "REE, B",
157             "R\u00C9E, L", // E-acute
158             "REE, V",
159             "SCHYTT, B",
160             "SCHYTT, H",
161             "SCH\u00DCTT, H", // U-diaeresis
162             "SCHYTT, L",
163             "SCH\u00DCTT, M", // U-diaeresis
164             "SS",
165             "ss",
166             "\u00DF", // sharp S
167             "SSA",
168             "\u00DFA", // sharp S
169             "STOREK\u00C6R", // AE-ligature
170             "STORE VILDMOSE",
171             "STORMLY",
172             "STORM PETERSEN",
173             "THORVALD",
174             "THORVARDUR",
175             "\u00DEORVAR\u0110UR", //  capital thorn, capital d-stroke(like eth) (sami)
176             "THYGESEN",
177             "VESTERG\u00C5RD, A",
178             "VESTERGAARD, A",
179             "VESTERG\u00C5RD, B",                // 50
180             "Westmalle",
181             "YALLE",
182             "Yderligere",
183             "\u00DDderligere", // Y-acute
184             "\u00DCderligere", // U-diaeresis
185             "\u00FDderligere", // y-acute
186             "\u00FCderligere", // u-diaeresis
187             "U\u0308ruk-hai",
188             "ZORO",
189             "\u00C6BLE",  // AE-ligature
190             "\u00E6BLE",  // ae-ligature
191             "\u00C4BLE",  // A-diaeresis
192             "\u00E4BLE",  // a-diaeresis
193             "\u00D8BERG", // O-stroke
194             "\u00F8BERG", // o-stroke
195             "\u00D6BERG", // O-diaeresis
196             "\u00F6BERG"  // o-diaeresis
197     };
198 
TestPrimary()199     public void TestPrimary() {
200         doTest(myCollation, Collator.PRIMARY,
201                primarySourceData, primaryTargetData, primaryResults);
202     }
203 
TestTertiary()204     public void TestTertiary() {
205         doTest(myCollation, Collator.TERTIARY,
206                tertiarySourceData, tertiaryTargetData, tertiaryResults);
207 
208         for (int i = 0; i < testData.length-1; i++) {
209             for (int j = i+1; j < testData.length; j++) {
210                 doTest(myCollation, testData[i], testData[j], -1);
211             }
212         }
213     }
214 
215     private final Collator myCollation = Collator.getInstance(new Locale("da", "", ""));
216 }
217