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 Spanish 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 SpanishTest extends CollatorTest {
  46 
  47     public static void main(String[] args) throws Exception {
  48         new SpanishTest().run(args);
  49     }
  50 
  51     /*
  52      * TestPrimary()
  53      */
  54     private static final String[] primarySourceData = {
  55         "alias",
  56         "acHc",
  57         "acc",
  58         "Hello"
  59     };
  60 
  61     private static final String[] primaryTargetData = {
  62         "allias",
  63         "aCHc",
  64         "aCHc",
  65         "hellO"
  66     };
  67 
  68     private static final int[] primaryResults = {
  69         -1,  0, -1,  0
  70     };
  71 
  72     /*
  73      * TestTertiary()
  74      */
  75     private static final String[] tertiarySourceData = {
  76         "alias",
  77         "Elliot",
  78         "Hello",
  79         "acHc",
  80         "acc"
  81     };
  82 
  83     private static final String[] tertiaryTargetData = {
  84         "allias",
  85         "Emiot",
  86         "hellO",
  87         "aCHc",
  88         "aCHc"
  89     };
  90 
  91     private static final int[] tertiaryResults = {
  92         -1, -1,  1, -1, -1
  93     };
  94 
  95     public void TestPrimary() {
  96         doTest(myCollation, Collator.PRIMARY,
  97                primarySourceData, primaryTargetData, primaryResults);
  98     }
  99 
 100     public void TestTertiary() {
 101         doTest(myCollation, Collator.TERTIARY,
 102                tertiarySourceData, tertiaryTargetData, tertiaryResults);
 103     }
 104 
 105     private final Collator myCollation = Collator.getInstance(new Locale("es", "ES", ""));
 106 }