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