< prev index next >

test/jdk/java/lang/Character/CheckScript.java

Print this page
rev 54996 : 8221431: Support for Unicode 12.1
Reviewed-by:
   1 /*
   2  * Copyright (c) 2010, 2015, 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 6945564 6959267 7033561 7070436 7198195 8032446 8072600
  27  * @summary  Check that the j.l.Character.UnicodeScript

  28  */
  29 
  30 import java.io.*;
  31 import java.util.*;
  32 import java.util.regex.*;
  33 import java.lang.Character.UnicodeScript;
  34 
  35 public class CheckScript {
  36 
  37     public static void main(String[] args) throws Exception {
  38         File fScripts;
  39         File fAliases;
  40         if (args.length == 0) {
  41             fScripts = new File(System.getProperty("test.src", "."), "Scripts.txt");
  42             fAliases = new File(System.getProperty("test.src", "."), "PropertyValueAliases.txt");
  43         } else if (args.length == 2) {
  44             fScripts = new File(args[0]);
  45             fAliases = new File(args[1]);
  46         } else {
  47             System.out.println("java CharacterScript Scripts.txt PropertyValueAliases.txt");
  48             throw new RuntimeException("Datafile name should be specified.");
  49         }
  50 
  51         Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher("");
  52         String line = null;
  53         HashMap<String,ArrayList<Integer>> scripts = new HashMap<>();
  54         try (BufferedReader sbfr = new BufferedReader(new FileReader(fScripts))) {
  55             while ((line = sbfr.readLine()) != null) {
  56                 if (line.length() <= 1 || line.charAt(0) == '#') {
  57                     continue;
  58                 }
  59                 m.reset(line);
  60                 if (m.matches()) {
  61                     int start = Integer.parseInt(m.group(1), 16);
  62                     int end = (m.group(2)==null)?start


   1 /*
   2  * Copyright (c) 2010, 2019, 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 6945564 6959267 7033561 7070436 7198195 8032446 8072600 8221431
  27  * @summary  Check that the j.l.Character.UnicodeScript
  28  * @library /lib/testlibrary/java/lang
  29  */
  30 
  31 import java.io.*;
  32 import java.util.*;
  33 import java.util.regex.*;
  34 import java.lang.Character.UnicodeScript;
  35 
  36 public class CheckScript {
  37 
  38     public static void main(String[] args) throws Exception {
  39         File fScripts;
  40         File fAliases;
  41         if (args.length == 0) {
  42             fScripts = UCDFiles.SCRIPTS.toFile();
  43             fAliases = UCDFiles.PROPERTY_VALUE_ALIASES.toFile();
  44         } else if (args.length == 2) {
  45             fScripts = new File(args[0]);
  46             fAliases = new File(args[1]);
  47         } else {
  48             System.out.println("java CharacterScript Scripts.txt PropertyValueAliases.txt");
  49             throw new RuntimeException("Datafile name should be specified.");
  50         }
  51 
  52         Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher("");
  53         String line = null;
  54         HashMap<String,ArrayList<Integer>> scripts = new HashMap<>();
  55         try (BufferedReader sbfr = new BufferedReader(new FileReader(fScripts))) {
  56             while ((line = sbfr.readLine()) != null) {
  57                 if (line.length() <= 1 || line.charAt(0) == '#') {
  58                     continue;
  59                 }
  60                 m.reset(line);
  61                 if (m.matches()) {
  62                     int start = Integer.parseInt(m.group(1), 16);
  63                     int end = (m.group(2)==null)?start


< prev index next >