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 French Collation
 28  * @modules jdk.localedata
 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 FrenchTest extends CollatorTest {
 47 
 48     public static void main(String[] args) throws Exception {
 49         new FrenchTest().run(args);
 50     }
 51 
 52     private static final String[] tertiarySourceData = {
 53         "abc",
 54         "COTE",
 55         "p\u00EAche",
 56         "p\u00EAcher",
 57         "p\u00E9cher",
 58         "p\u00E9cher",
 59         "Hello"
 60     };
 61 
 62     private static final String[] tertiaryTargetData = {
 63         "ABC",
 64         "c\u00f4te",
 65         "p\u00E9ch\u00E9",
 66         "p\u00E9ch\u00E9",
 67         "p\u00EAche",
 68         "p\u00EAcher",
 69         "hellO"
 70     };
 71 
 72     private static final int[] tertiaryResults = {
 73         -1, -1, -1,  1,  1, -1,  1
 74     };
 75 
 76     private static final String[] testData = {
 77         "a",
 78         "A",
 79         "e",
 80         "E",
 81         "\u00e9",
 82         "\u00e8",
 83         "\u00ea",
 84         "\u00eb",
 85         "ea",
 86         "x"
 87     };
 88 
 89     public void TestTertiary() {
 90         doTest(myCollation, Collator.TERTIARY,
 91                tertiarySourceData, tertiaryTargetData, tertiaryResults);
 92 
 93         for (int i = 0; i < testData.length-1; i++) {
 94             for (int j = i+1; j < testData.length; j++) {
 95                 doTest(myCollation, testData[i], testData[j], -1);
 96             }
 97         }
 98     }
 99 
100     private final Collator myCollation = Collator.getInstance(Locale.FRANCE);
101 }