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