Path: blob/master/test/jdk/java/text/Collator/DanishTest.java
41149 views
/*1* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 4930708 4174436 500849826* @library /java/text/testlib27* @summary test Danish Collation28* @modules jdk.localedata29*/30/*31(C) Copyright Taligent, Inc. 1996 - All Rights Reserved32(C) Copyright IBM Corp. 1996 - All Rights Reserved3334The original version of this source code and documentation is copyrighted and35owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are36provided under terms of a License Agreement between Taligent and Sun. This37technology is protected by multiple US and International patents. This notice and38attribution to Taligent may not be removed.39Taligent is a registered trademark of Taligent, Inc.40*/4142import java.util.Locale;43import java.text.Collator;4445// Quick dummy program for printing out test results46public class DanishTest extends CollatorTest {4748public static void main(String[] args) throws Exception {49new DanishTest().run(args);50}5152/*53* Data for TestPrimary()54*/55private static final String[] primarySourceData = {56"Lvi",57"L\u00E4vi",58"L\u00FCbeck",59"ANDR\u00C9",60"ANDRE",61"ANNONCERER"62};6364private static final String[] primaryTargetData = {65"Lwi",66"L\u00F6wi",67"Lybeck",68"ANDR\u00E9",69"ANDR\u00C9",70"ANN\u00D3NCERER"71};7273private static final int[] primaryResults = {74-1, -1, 0, 0, 0, 075};7677/*78* Data for TestTertiary()79*/80private static final String[] tertiarySourceData = {81"Luc",82"luck",83"L\u00FCbeck",84"L\u00E4vi",85"L\u00F6ww"86};8788private static final String[] tertiaryTargetData = {89"luck",90"L\u00FCbeck",91"lybeck",92"L\u00F6we",93"mast"94};9596private static final int[] tertiaryResults = {97-1, -1, 1, -1, -198};99100/*101* Data for TestExtra()102*/103private static final String[] testData = {104"A/S",105"ANDRE",106"ANDR\u00C9", // E-acute107"ANDR\u00C8", // E-grave108"ANDR\u00E9", // e-acute109"ANDR\u00EA", // e-circ110"Andre",111"Andr\u00E9", // e-acute112"\u00C1NDRE", // A-acute113"\u00C0NDRE", // A-grave114"andre",115"\u00E1ndre", // a-acute116"\u00E0ndre", // a-grave117"ANDREAS",118"ANNONCERER",119"ANN\u00D3NCERER", // O-acute120"annoncerer",121"ann\u00F3ncerer", // o-acute122"AS",123"A\u00e6RO", // ae-ligature124"CA",125"\u00C7A", // C-cedilla126"CB",127"\u00C7C", // C-cedilla128"D.S.B.",129"DA",130"DB",131"\u00D0ORA", // capital eth132"DSB",133"\u00D0SB", // capital eth134"DSC",135"EKSTRA_ARBEJDE",136"EKSTRABUD",137"H\u00D8ST", // could the 0x00D8 be 0x2205?138"HAAG",139"H\u00C5NDBOG", // A-ring140"HAANDV\u00C6RKSBANKEN", // AE-ligature141"INTERNETFORBINDELSE",142"Internetforbindelse",143"\u00CDNTERNETFORBINDELSE", // I-acute144"internetforbindelse",145"\u00EDnternetforbindelse", // i-acute146"Karl",147"karl",148"NIELSEN",149"NIELS J\u00D8RGEN", // O-slash150"NIELS-J\u00D8RGEN", // O-slash151"OERVAL",152"\u0152RVAL", // OE-ligature153"\u0153RVAL", // oe-ligature154"R\u00C9E, A", // E-acute155"REE, B",156"R\u00C9E, L", // E-acute157"REE, V",158"SCHYTT, B",159"SCHYTT, H",160"SCH\u00DCTT, H", // U-diaeresis161"SCHYTT, L",162"SCH\u00DCTT, M", // U-diaeresis163"SS",164"ss",165"\u00DF", // sharp S166"SSA",167"\u00DFA", // sharp S168"STOREK\u00C6R", // AE-ligature169"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", // 50179"Westmalle",180"YALLE",181"Yderligere",182"\u00DDderligere", // Y-acute183"\u00DCderligere", // U-diaeresis184"\u00FDderligere", // y-acute185"\u00FCderligere", // u-diaeresis186"U\u0308ruk-hai",187"ZORO",188"\u00C6BLE", // AE-ligature189"\u00E6BLE", // ae-ligature190"\u00C4BLE", // A-diaeresis191"\u00E4BLE", // a-diaeresis192"\u00D8BERG", // O-stroke193"\u00F8BERG", // o-stroke194"\u00D6BERG", // O-diaeresis195"\u00F6BERG" // o-diaeresis196};197198public void TestPrimary() {199doTest(myCollation, Collator.PRIMARY,200primarySourceData, primaryTargetData, primaryResults);201}202203public void TestTertiary() {204doTest(myCollation, Collator.TERTIARY,205tertiarySourceData, tertiaryTargetData, tertiaryResults);206207for (int i = 0; i < testData.length-1; i++) {208for (int j = i+1; j < testData.length; j++) {209doTest(myCollation, testData[i], testData[j], -1);210}211}212}213214private final Collator myCollation = Collator.getInstance(new Locale("da", "", ""));215}216217218