< prev index next >

test/jdk/java/text/Collator/VietnameseTest.java

Print this page

  1 /*
  2  * Copyright (c) 2003, 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  * @bug 4932968 5015215
 27  * @library /java/text/testlib
 28  * @summary test Vietnamese Collation
 29  * @modules jdk.localedata

 30  */
 31 
 32 /*
 33  *******************************************************************************
 34  * (C) Copyright IBM Corp. 1996-2003 - All Rights Reserved                     *
 35  *                                                                             *
 36  * The original version of this source code and documentation is copyrighted   *
 37  * and owned by IBM, These materials are provided under terms of a License     *
 38  * Agreement between IBM and Sun. This technology is protected by multiple     *
 39  * US and International patents. This notice and attribution to IBM may not    *
 40  * to removed.                                                                 *
 41  *******************************************************************************
 42  */
 43 
 44 import java.util.Locale;
 45 import java.text.Collator;
 46 
 47 // Quick dummy program for printing out test results
 48 public class VietnameseTest extends CollatorTest {
 49 
 50     public static void main(String[] args) throws Exception {
 51         new VietnameseTest().run(args);
 52     }

 53 
 54     private final static String testPS[] = {
 55         "a",
 56         "a",
 57         "\u00c2",
 58         "Cz",
 59         "d",
 60         "e",
 61         "e",
 62         "\u1ec7",
 63         "gz",
 64         "i",
 65         "kz",
 66         "nz",
 67         "nh",
 68         "o",
 69         "o",
 70         "\u01a0",
 71         "pz",
 72         "tz",

329         "w",
330         "W",
331         "x",
332         "X",
333         "y",
334         "Y",
335         "\u1ef3",
336         "\u1ef2",
337         "\u1ef7",
338         "\u1ef6",
339         "\u1ef9",
340         "\u1ef8",
341         "\u00fd",
342         "\u00dd",
343         "\u1ef5",
344         "\u1ef4",
345         "z",
346         "Z"
347     };
348 

349     public void TestPrimary() {
350         doTest(myCollation, Collator.PRIMARY, testPS, testPT, testPR);
351     }
352 

353     public void TestTertiary() {
354         int testLength = testT.length;
355 
356         myCollation.setStrength(Collator.TERTIARY);
357         for (int i = 0; i < testLength - 1; i++) {
358             for (int j = i+1; j < testLength; j++) {
359                 doTest(myCollation, testT[i], testT[j], -1);
360             }
361         }
362     }
363 
364     private final Collator myCollation = Collator.getInstance(Locale.of("vi", "VN"));
365 }

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

 49 
 50 import static org.junit.jupiter.api.Assertions.fail;
 51 
 52 // Quick dummy program for printing out test results
 53 public class VietnameseTest {
 54 
 55     private final static String testPS[] = {
 56         "a",
 57         "a",
 58         "\u00c2",
 59         "Cz",
 60         "d",
 61         "e",
 62         "e",
 63         "\u1ec7",
 64         "gz",
 65         "i",
 66         "kz",
 67         "nz",
 68         "nh",
 69         "o",
 70         "o",
 71         "\u01a0",
 72         "pz",
 73         "tz",

330         "w",
331         "W",
332         "x",
333         "X",
334         "y",
335         "Y",
336         "\u1ef3",
337         "\u1ef2",
338         "\u1ef7",
339         "\u1ef6",
340         "\u1ef9",
341         "\u1ef8",
342         "\u00fd",
343         "\u00dd",
344         "\u1ef5",
345         "\u1ef4",
346         "z",
347         "Z"
348     };
349 
350     @Test
351     public void TestPrimary() {
352         TestUtils.doCollatorTest(myCollation, Collator.PRIMARY, testPS, testPT, testPR);
353     }
354 
355     @Test
356     public void TestTertiary() {
357         int testLength = testT.length;
358 
359         myCollation.setStrength(Collator.TERTIARY);
360         for (int i = 0; i < testLength - 1; i++) {
361             for (int j = i+1; j < testLength; j++) {
362                 TestUtils.doCollatorTest(myCollation, testT[i], testT[j], -1);
363             }
364         }
365     }
366 
367     private final Collator myCollation = Collator.getInstance(Locale.of("vi", "VN"));
368 }
< prev index next >