Path: blob/master/test/jdk/java/text/Collator/VietnameseTest.java
41149 views
/*1* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 4932968 501521526* @library /java/text/testlib27* @summary test Vietnamese Collation28* @modules jdk.localedata29*/3031/*32*******************************************************************************33* (C) Copyright IBM Corp. 1996-2003 - All Rights Reserved *34* *35* The original version of this source code and documentation is copyrighted *36* and owned by IBM, These materials are provided under terms of a License *37* Agreement between IBM and Sun. This technology is protected by multiple *38* US and International patents. This notice and attribution to IBM may not *39* to removed. *40*******************************************************************************41*/4243import java.util.Locale;44import java.text.Collator;4546// Quick dummy program for printing out test results47public class VietnameseTest extends CollatorTest {4849public static void main(String[] args) throws Exception {50new VietnameseTest().run(args);51}5253private final static String testPS[] = {54"a",55"a",56"\u00c2",57"Cz",58"d",59"e",60"e",61"\u1ec7",62"gz",63"i",64"kz",65"nz",66"nh",67"o",68"o",69"\u01a0",70"pz",71"tz",72"tr",73"u",74"u",75"y"76};7778private final static String testPT[] = {79"\u00e0",80"\u0102",81"\u0102",82"Ch",83"\u0110",84"\u0111",85"\u1eb9",86"\u1eb9",87"gi",88"\u0128",89"kh",90"ng",91"ng",92"\u00f2",93"\u00f4",94"\u00f4",95"ph",96"th",97"th",98"\u1ee5",99"\u01b0",100"\u1ef4"101};102103private final static int testPR[] = {1040,105-1,1061,1071,108-1,1091,1100,1111,1121,1130,1141,1151,1161,1170,118-1,1191,1201,1211,1221,1230,124-1,1250126};127128private final static String testT[] = {129"a",130"A",131"\u00e0",132"\u00c0",133"\u1ea3",134"\u1ea2",135"\u00e3",136"\u00c3",137"\u00e1",138"\u00c1",139"\u1ea1",140"\u1ea0",141"\u0103",142"\u0102",143"\u1eb1",144"\u1eb0",145"\u1eb3",146"\u1eb2",147"\u1eb5",148"\u1eb4",149"\u1eaf",150"\u1eae",151"\u1eb7",152"\u1eb6",153"\u00e2",154"\u00c2",155"\u1ea7",156"\u1ea6",157"\u1ea9",158"\u1ea8",159"\u1eab",160"\u1eaa",161"\u1ea5",162"\u1ea4",163"\u1ead",164"\u1eac",165"b",166"B",167"c",168"C",169"ch",170"Ch",171"CH",172"d",173"D",174"\u0111",175"\u0110",176"e",177"E",178"\u00e8",179"\u00c8",180"\u1ebb",181"\u1eba",182"\u1ebd",183"\u1ebc",184"\u00e9",185"\u00c9",186"\u1eb9",187"\u1eb8",188"\u00ea",189"\u00ca",190"\u1ec1",191"\u1ec0",192"\u1ec3",193"\u1ec2",194"\u1ec5",195"\u1ec4",196"\u1ebf",197"\u1ebe",198"\u1ec7",199"\u1ec6",200"f",201"F",202"g",203"G",204"gi",205"Gi",206"GI",207"gz",208"h",209"H",210"i",211"I",212"\u00ec",213"\u00cc",214"\u1ec9",215"\u1ec8",216"\u0129",217"\u0128",218"\u00ed",219"\u00cd",220"\u1ecb",221"\u1eca",222"j",223"J",224"k",225"K",226"kh",227"Kh",228"KH",229"kz",230"l",231"L",232"m",233"M",234"n",235"N",236"ng",237"Ng",238"NG",239"ngz",240"nh",241"Nh",242"NH",243"nz",244"o",245"O",246"\u00f2",247"\u00d2",248"\u1ecf",249"\u1ece",250"\u00f5",251"\u00d5",252"\u00f3",253"\u00d3",254"\u1ecd",255"\u1ecc",256"\u00f4",257"\u00d4",258"\u1ed3",259"\u1ed2",260"\u1ed5",261"\u1ed4",262"\u1ed7",263"\u1ed6",264"\u1ed1",265"\u1ed0",266"\u1ed9",267"\u1ed8",268"\u01a1",269"\u01a0",270"\u1edd",271"\u1edc",272"\u1edf",273"\u1ede",274"\u1ee1",275"\u1ee0",276"\u1edb",277"\u1eda",278"\u1ee3",279"\u1ee2",280"p",281"P",282"ph",283"Ph",284"PH",285"pz",286"q",287"Q",288"r",289"R",290"s",291"S",292"t",293"T",294"th",295"Th",296"TH",297"thz",298"tr",299"Tr",300"TR",301"tz",302"u",303"U",304"\u00f9",305"\u00d9",306"\u1ee7",307"\u1ee6",308"\u0169",309"\u0168",310"\u00fa",311"\u00da",312"\u1ee5",313"\u1ee4",314"\u01b0",315"\u01af",316"\u1eeb",317"\u1eea",318"\u1eed",319"\u1eec",320"\u1eef",321"\u1eee",322"\u1ee9",323"\u1ee8",324"\u1ef1",325"\u1ef0",326"v",327"V",328"w",329"W",330"x",331"X",332"y",333"Y",334"\u1ef3",335"\u1ef2",336"\u1ef7",337"\u1ef6",338"\u1ef9",339"\u1ef8",340"\u00fd",341"\u00dd",342"\u1ef5",343"\u1ef4",344"z",345"Z"346};347348public void TestPrimary() {349doTest(myCollation, Collator.PRIMARY, testPS, testPT, testPR);350}351352public void TestTertiary() {353int testLength = testT.length;354355myCollation.setStrength(Collator.TERTIARY);356for (int i = 0; i < testLength - 1; i++) {357for (int j = i+1; j < testLength; j++) {358doTest(myCollation, testT[i], testT[j], -1);359}360}361}362363private final Collator myCollation = Collator.getInstance(new Locale("vi", "VN"));364}365366367