< prev index next >

test/jdk/java/text/Collator/FinnishTest.java

Print this page

  1 /*
  2  * Copyright (c) 1997, 2022, 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 Finnish 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 FinnishTest extends CollatorTest {
 47 
 48     public static void main(String[] args) throws Exception {
 49         new FinnishTest().run(args);
 50     }

 51 
 52     /*
 53      * Data for TestPrimary()
 54      */
 55     private static final String[] primarySourceData = {
 56         "L\u00E5vi",
 57         "wat"
 58     };
 59 
 60     private static final String[] primaryTargetData = {
 61         "L\u00E4we",
 62         "vat"
 63     };
 64 
 65     private static final int[] primaryResults = {
 66         -1,  0
 67     };
 68 
 69     /*
 70      * Data for TestTertiary()
 71      */
 72     private static final String tertiarySourceData[] = {
 73         "wat",
 74         "vat",
 75         "a\u00FCbeck"
 76     };
 77 
 78     private static final String tertiaryTargetData[] = {
 79         "vat",
 80         "way",
 81         "axbeck"
 82     };
 83 
 84     private static final int[] tertiaryResults = {
 85          1, -1,  1
 86     };
 87 

 88     public void TestPrimary() {
 89         doTest(myCollation, Collator.PRIMARY,
 90                primarySourceData, primaryTargetData, primaryResults);
 91     }
 92 

 93     public void TestTertiary() {
 94         doTest(myCollation, Collator.TERTIARY,
 95               tertiarySourceData, tertiaryTargetData, tertiaryResults);
 96     }
 97 
 98     private final Collator myCollation = Collator.getInstance(Locale.of("fi", "FI"));
 99 }

  1 /*
  2  * Copyright (c) 1997, 2023, 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 Finnish Collation
 28  * @modules jdk.localedata
 29  * @run junit FinnishTest
 30  */
 31 /*
 32 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
 33 (C) Copyright IBM Corp. 1996 - All Rights Reserved
 34 
 35   The original version of this source code and documentation is copyrighted and
 36 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
 37 provided under terms of a License Agreement between Taligent and Sun. This
 38 technology is protected by multiple US and International patents. This notice and
 39 attribution to Taligent may not be removed.
 40   Taligent is a registered trademark of Taligent, Inc.
 41 */
 42 
 43 import java.util.Locale;
 44 import java.text.Collator;
 45 
 46 import org.junit.jupiter.api.Test;

 47 
 48 import static org.junit.jupiter.api.Assertions.fail;
 49 
 50 // Quick dummy program for printing out test results
 51 public class FinnishTest {
 52 
 53     /*
 54      * Data for TestPrimary()
 55      */
 56     private static final String[] primarySourceData = {
 57         "L\u00E5vi",
 58         "wat"
 59     };
 60 
 61     private static final String[] primaryTargetData = {
 62         "L\u00E4we",
 63         "vat"
 64     };
 65 
 66     private static final int[] primaryResults = {
 67         -1,  0
 68     };
 69 
 70     /*
 71      * Data for TestTertiary()
 72      */
 73     private static final String tertiarySourceData[] = {
 74         "wat",
 75         "vat",
 76         "a\u00FCbeck"
 77     };
 78 
 79     private static final String tertiaryTargetData[] = {
 80         "vat",
 81         "way",
 82         "axbeck"
 83     };
 84 
 85     private static final int[] tertiaryResults = {
 86          1, -1,  1
 87     };
 88 
 89     @Test
 90     public void TestPrimary() {
 91         TestUtils.doCollatorTest(myCollation, Collator.PRIMARY,
 92                primarySourceData, primaryTargetData, primaryResults);
 93     }
 94 
 95     @Test
 96     public void TestTertiary() {
 97         TestUtils.doCollatorTest(myCollation, Collator.TERTIARY,
 98               tertiarySourceData, tertiaryTargetData, tertiaryResults);
 99     }
100 
101     private final Collator myCollation = Collator.getInstance(Locale.of("fi", "FI"));
102 }
< prev index next >