< prev index next >

test/jdk/java/text/Collator/DanishTest.java

Print this page

  1 /*
  2  * Copyright (c) 1997, 2022, 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 
 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"

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 

199     public void TestPrimary() {
200         doTest(myCollation, Collator.PRIMARY,
201                primarySourceData, primaryTargetData, primaryResults);
202     }
203 

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(Locale.of("da"));
216 }

  1 /*
  2  * Copyright (c) 1997, 2023, 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  * @run junit DanishTest
 31  */
 32 /*
 33 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
 34 (C) Copyright IBM Corp. 1996 - All Rights Reserved
 35 
 36   The original version of this source code and documentation is copyrighted and
 37 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
 38 provided under terms of a License Agreement between Taligent and Sun. This
 39 technology is protected by multiple US and International patents. This notice and
 40 attribution to Taligent may not be removed.
 41   Taligent is a registered trademark of Taligent, Inc.
 42 */
 43 
 44 import java.util.Locale;
 45 import java.text.Collator;
 46 
 47 import org.junit.jupiter.api.Test;

 48 
 49 import static org.junit.jupiter.api.Assertions.fail;
 50 
 51 // Quick dummy program for printing out test results
 52 public class DanishTest {
 53 
 54     /*
 55      * Data for TestPrimary()
 56      */
 57     private static final String[] primarySourceData = {
 58         "Lvi",
 59         "L\u00E4vi",
 60         "L\u00FCbeck",
 61         "ANDR\u00C9",
 62         "ANDRE",
 63         "ANNONCERER"
 64     };
 65 
 66     private static final String[] primaryTargetData = {
 67             "Lwi",
 68             "L\u00F6wi",
 69             "Lybeck",
 70             "ANDR\u00E9",
 71             "ANDR\u00C9",
 72             "ANN\u00D3NCERER"

180             "VESTERG\u00C5RD, B",                // 50
181             "Westmalle",
182             "YALLE",
183             "Yderligere",
184             "\u00DDderligere", // Y-acute
185             "\u00DCderligere", // U-diaeresis
186             "\u00FDderligere", // y-acute
187             "\u00FCderligere", // u-diaeresis
188             "U\u0308ruk-hai",
189             "ZORO",
190             "\u00C6BLE",  // AE-ligature
191             "\u00E6BLE",  // ae-ligature
192             "\u00C4BLE",  // A-diaeresis
193             "\u00E4BLE",  // a-diaeresis
194             "\u00D8BERG", // O-stroke
195             "\u00F8BERG", // o-stroke
196             "\u00D6BERG", // O-diaeresis
197             "\u00F6BERG"  // o-diaeresis
198     };
199 
200     @Test
201     public void TestPrimary() {
202         TestUtils.doCollatorTest(myCollation, Collator.PRIMARY,
203                primarySourceData, primaryTargetData, primaryResults);
204     }
205 
206     @Test
207     public void TestTertiary() {
208         TestUtils.doCollatorTest(myCollation, Collator.TERTIARY,
209                tertiarySourceData, tertiaryTargetData, tertiaryResults);
210 
211         for (int i = 0; i < testData.length-1; i++) {
212             for (int j = i+1; j < testData.length; j++) {
213                 TestUtils.doCollatorTest(myCollation, testData[i], testData[j], -1);
214             }
215         }
216     }
217 
218     private final Collator myCollation = Collator.getInstance(Locale.of("da"));
219 }
< prev index next >