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  * @library /java/text/testlib
  27  * @summary test Turkish Collation
  28  */
  29 /*
  30 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
  31 (C) Copyright IBM Corp. 1996 - All Rights Reserved
  32 
  33   The original version of this source code and documentation is copyrighted and
  34 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
  35 provided under terms of a License Agreement between Taligent and Sun. This
  36 technology is protected by multiple US and International patents. This notice and
  37 attribution to Taligent may not be removed.
  38   Taligent is a registered trademark of Taligent, Inc.
  39 */
  40 
  41 import java.util.Locale;
  42 import java.text.Collator;
  43 
  44 // Quick dummy program for printing out test results
  45 public class TurkishTest extends CollatorTest {
  46 
  47     public static void main(String[] args) throws Exception {
  48         new TurkishTest().run(args);
  49     }
  50 
  51     /*
  52      * Data for TestPrimary()
  53      */
  54     private static final String[] primarySourceData = {
  55         "\u00FCoid",
  56         "vo\u0131d",
  57         "idea",
  58         "Idea",
  59         "\u0130dea"
  60     };
  61 
  62     private static final String[] primaryTargetData = {
  63         "void",
  64         "void",
  65         "Idea",
  66         "\u0130dea",
  67         "\u0131dea"
  68     };
  69 
  70     private static final int[] primaryResults = {
  71         -1,  -1,  1, -1, 1
  72     };
  73 
  74     /*
  75      * Data for TestTertiary()
  76      */
  77     private static final String[] tertiarySourceData = {
  78         "s\u0327",
  79         "v\u00E4t",
  80         "old",
  81         "\u00FCoid",
  82         "h\u011Ealt",
  83         "stres\u015E",
  84         "vo\u0131d",
  85         "idea",
  86        "idea",
  87        "\u0131dea"
  88     };
  89 
  90     private static final String tertiaryTargetData[] = {
  91         "u\u0308",
  92         "vbt",
  93         "\u00D6ay",
  94         "void",
  95         "halt",
  96         "\u015Etre\u015Es",
  97         "void",
  98         "Idea",
  99        "\u0130dea",
 100        "Idea"
 101     };
 102 
 103     private static final int[] tertiaryResults = {
 104         -1, -1, -1, -1,  1, -1, -1,  1, -1, -1
 105     };
 106 
 107     public void TestPrimary() {
 108         doTest(myCollation, Collator.PRIMARY,
 109                primarySourceData, primaryTargetData, primaryResults);
 110     }
 111 
 112     public void TestTertiary() {
 113         doTest(myCollation, Collator.TERTIARY,
 114                tertiarySourceData, tertiaryTargetData, tertiaryResults);
 115     }
 116 
 117     private final Collator myCollation = Collator.getInstance(new Locale("tr", "TR", ""));
 118 }