1 /*
   2  * Copyright (c) 1997, 2016, 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 Thai Collation
  28  */
  29 /*
  30  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  31  *
  32  * This software is the proprietary information of Oracle.
  33  * Use is subject to license terms.
  34  *
  35  */
  36 
  37 import java.util.Locale;
  38 import java.text.Collator;
  39 import java.text.RuleBasedCollator;
  40 
  41 public class ThaiTest extends CollatorTest {
  42 
  43     public static void main(String[] args) throws Exception {
  44         new ThaiTest().run(args);
  45     }
  46 
  47     /*
  48      * Data for TestPrimary()
  49      */
  50     private static final String[] primarySourceData = {
  51         "\u0e01\u0e01",
  52         "\u0e07\u0e42\u0e01\u0e49",
  53         "\u0e10\u0e34\u0e19",
  54         "\u0e16\u0e32\u0e21\u0e23\u0e23\u0e04\u0e40\u0e17\u0e28\u0e19\u0e32",
  55         "\u0e23\u0e21\u0e18\u0e23\u0e23\u0e21\u0e4c\u0e1b\u0e23\u0e30\u0e01\u0e31\u0e19\u0e20\u0e31\u0e22",
  56         "\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e41\u0e25\u0e30\u0e22\u0e35\u0e48\u0e2b\u0e49\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e49\u0e32\u0e02\u0e32\u0e22",
  57         "\u0e23\u0e23\u0e25\u0e38\u0e19\u0e34\u0e15\u0e34\u0e20\u0e32\u0e27\u0e30",
  58         "\u0e01\u0e25\u0e37\u0e2d\u0e41\u0e01\u0e07",
  59         "\u0e21\u0e17\u0e34\u0e25\u0e41\u0e2d\u0e25\u0e01\u0e2d\u0e2e\u0e2d\u0e25\u0e4c",
  60         "\u0e40\u0e2d\u0e35\u0e48\u0e22\u0e21\u0e2d\u0e48\u0e2d\u0e07",
  61         "\u0e2a\u0e14\u0e32\u0e1b\u0e31\u0e15\u0e15\u0e34\u0e1c\u0e25",
  62         "\u0e2d\u0e19\u0e01\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c",
  63         "\u0e21\u0e49\u0e40\u0e17\u0e49\u0e32\u0e22\u0e32\u0e22\u0e21\u0e48\u0e2d\u0e21",
  64         "\u0e2a\u0e49\u0e25\u0e30\u0e21\u0e32\u0e19",
  65         "\u0e2a\u0e49\u0e28\u0e36\u0e01",
  66         "\u0e2a\u0e49\u0e2d\u0e31\u0e48\u0e27",
  67         "\u0e2a\u0e49\u0e40\u0e14\u0e37\u0e2d\u0e19",
  68         "\u0e2a\u0e49\u0e40\u0e25\u0e37\u0e48\u0e2d\u0e19",
  69         "\u0e2a\u0e49\u0e41\u0e02\u0e27\u0e19",
  70         "\u0e2a\u0e49\u0e41\u0e2b\u0e49\u0e07",
  71         "\u0e2a\u0e49\u0e44\u0e01\u0e48",
  72         "\u0e2b",
  73         "\u0e2b\u0e0b\u0e2d\u0e07",
  74         "\u0e2b\u0e19",
  75         "\u0e2b\u0e1b\u0e25\u0e32\u0e23\u0e49\u0e32",
  76         "\u0e2b\u0e21",
  77         "\u0e2b\u0e21\u0e17\u0e2d\u0e07",
  78         "\u0e2b\u0e21\u0e2a\u0e31\u0e1a\u0e1b\u0e30\u0e23\u0e14",
  79         "\u0e2b\u0e21\u0e49",
  80         "\u0e2b\u0e23\u0e13\u0e22\u0e4c",
  81         "\u0e2b\u0e25",
  82         "\u0e2b\u0e25\u0e19\u0e49\u0e33",
  83         "\u0e2b\u0e25\u0e48",
  84         "\u0e2b\u0e25\u0e48\u0e16\u0e19\u0e19",
  85         "\u0e2b\u0e25\u0e48\u0e17\u0e27\u0e35\u0e1b",
  86         "\u0e2b\u0e25\u0e48\u0e17\u0e32\u0e07",
  87         "\u0e2b\u0e25\u0e48\u0e23\u0e27\u0e1a",
  88         "\u0e2b\u0e49",
  89         "\u0e2d",
  90         "\u0e2d\u0e49",
  91         "\u0e2e\u0e42\u0e25",
  92         "\u0e2e\u0e44\u0e1f",
  93         "\u0e2e\u0e49"
  94     };
  95 
  96     private static final String[] primaryTargetData = {
  97         "\u0e01\u0e01",
  98         "\u0e07\u0e42\u0e01\u0e49",
  99         "\u0e10\u0e34\u0e19",
 100         "\u0e16\u0e32\u0e21\u0e23\u0e23\u0e04\u0e40\u0e17\u0e28\u0e19\u0e32",
 101         "\u0e23\u0e21\u0e18\u0e23\u0e23\u0e21\u0e4c\u0e1b\u0e23\u0e30\u0e01\u0e31\u0e19\u0e20\u0e31\u0e22",
 102         "\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e41\u0e25\u0e30\u0e22\u0e35\u0e48\u0e2b\u0e49\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e49\u0e32\u0e02\u0e32\u0e22",
 103         "\u0e23\u0e23\u0e25\u0e38\u0e19\u0e34\u0e15\u0e34\u0e20\u0e32\u0e27\u0e30",
 104         "\u0e01\u0e25\u0e37\u0e2d\u0e41\u0e01\u0e07",
 105         "\u0e21\u0e17\u0e34\u0e25\u0e41\u0e2d\u0e25\u0e01\u0e2d\u0e2e\u0e2d\u0e25\u0e4c",
 106         "\u0e40\u0e2d\u0e35\u0e48\u0e22\u0e21\u0e2d\u0e48\u0e2d\u0e07",
 107         "\u0e2a\u0e14\u0e32\u0e1b\u0e31\u0e15\u0e15\u0e34\u0e1c\u0e25",
 108         "\u0e2d\u0e19\u0e01\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c",
 109         "\u0e21\u0e49\u0e40\u0e17\u0e49\u0e32\u0e22\u0e32\u0e22\u0e21\u0e48\u0e2d\u0e21",
 110         "\u0e2a\u0e49\u0e25\u0e30\u0e21\u0e32\u0e19",
 111         "\u0e2a\u0e49\u0e28\u0e36\u0e01",
 112         "\u0e2a\u0e49\u0e2d\u0e31\u0e48\u0e27",
 113         "\u0e2a\u0e49\u0e40\u0e14\u0e37\u0e2d\u0e19",
 114         "\u0e2a\u0e49\u0e40\u0e25\u0e37\u0e48\u0e2d\u0e19",
 115         "\u0e2a\u0e49\u0e41\u0e02\u0e27\u0e19",
 116         "\u0e2a\u0e49\u0e41\u0e2b\u0e49\u0e07",
 117         "\u0e2a\u0e49\u0e44\u0e01\u0e48",
 118         "\u0e2b",
 119         "\u0e2b\u0e0b\u0e2d\u0e07",
 120         "\u0e2b\u0e19",
 121         "\u0e2b\u0e1b\u0e25\u0e32\u0e23\u0e49\u0e32",
 122         "\u0e2b\u0e21",
 123         "\u0e2b\u0e21\u0e17\u0e2d\u0e07",
 124         "\u0e2b\u0e21\u0e2a\u0e31\u0e1a\u0e1b\u0e30\u0e23\u0e14",
 125         "\u0e2b\u0e21\u0e49",
 126         "\u0e2b\u0e23\u0e13\u0e22\u0e4c",
 127         "\u0e2b\u0e25",
 128         "\u0e2b\u0e25\u0e19\u0e49\u0e33",
 129         "\u0e2b\u0e25\u0e48",
 130         "\u0e2b\u0e25\u0e48\u0e16\u0e19\u0e19",
 131         "\u0e2b\u0e25\u0e48\u0e17\u0e27\u0e35\u0e1b",
 132         "\u0e2b\u0e25\u0e48\u0e17\u0e32\u0e07",
 133         "\u0e2b\u0e25\u0e48\u0e23\u0e27\u0e1a",
 134         "\u0e2b\u0e49",
 135         "\u0e2d",
 136         "\u0e2d\u0e49",
 137         "\u0e2e\u0e42\u0e25",
 138         "\u0e2e\u0e44\u0e1f",
 139         "\u0e2e\u0e49"
 140     };
 141 
 142     private static final int[] primaryResults = {
 143          0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 144          0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 145          0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 146          0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 147          0,  0,  0
 148     };
 149 
 150     public void TestPrimary() {
 151         doTest(myCollation, Collator.PRIMARY,
 152                primarySourceData, primaryTargetData, primaryResults);
 153     }
 154 
 155     private final Collator myCollation = Collator.getInstance(new Locale("th"));
 156 }