jdk-24/test/jdk/sun/text/resources/Collator/Bug4248694.java

86 lines
2.8 KiB
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
2007-12-01 00:00:00 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
2007-12-01 00:00:00 +00:00
*/
/*
* @test
* @bug 4248694
* @modules jdk.localedata
2007-12-01 00:00:00 +00:00
* @summary updating collation tables for icelandic
*/
import java.text.Collator;
import java.util.Arrays;
import java.util.Locale;
2007-12-01 00:00:00 +00:00
public class Bug4248694 {
/********************************************************
*********************************************************/
public static void main (String[] args) {
Locale reservedLocale = Locale.getDefault();
try {
int errors=0;
2007-12-01 00:00:00 +00:00
Locale loc = new Locale ("is", "is"); // Icelandic
2007-12-01 00:00:00 +00:00
Locale.setDefault (loc);
Collator col = Collator.getInstance ();
2007-12-01 00:00:00 +00:00
String[] data = {"\u00e6ard",
"Zard",
"aard",
"\u00feard",
"vird",
"\u00c6ard",
"Zerd",
"\u00deard"};
2007-12-01 00:00:00 +00:00
String[] sortedData = {"aard",
"vird",
"Zard",
"Zerd",
"\u00feard",
"\u00deard",
"\u00e6ard",
"\u00c6ard"};
2007-12-01 00:00:00 +00:00
Arrays.sort (data, col);
2007-12-01 00:00:00 +00:00
System.out.println ("Using " + loc.getDisplayName());
for (int i = 0; i < data.length; i++) {
System.out.println(data[i] + " : " + sortedData[i]);
if (sortedData[i].compareTo(data[i]) != 0) {
errors++;
}
}//end for
2007-12-01 00:00:00 +00:00
if (errors > 0)
throw new RuntimeException();
} finally {
// restore the reserved locale
Locale.setDefault(reservedLocale);
}
2007-12-01 00:00:00 +00:00
}//end main
}//end class CollatorTest