1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
17 // Hand-chosen tests from Unicode 5.1.0, 6.0.0, 6.2.0, 6.3.0 and 7.0.0 mostly to
18 // discover when new scripts and categories arise.
25 {0x16ada, "Bassa_Vah"},
33 {0x156d, "Canadian_Aboriginal"},
35 {0x10563, "Caucasian_Albanian"},
42 {0x12420, "Cuneiform"},
46 {0x094a, "Devanagari"},
47 {0x1BC00, "Duployan"},
48 {0x13001, "Egyptian_Hieroglyphs"},
52 {0x2c40, "Glagolitic"},
63 {0x10841, "Imperial_Aramaic"},
64 {0x20e6, "Inherited"},
65 {0x10b70, "Inscriptional_Pahlavi"},
66 {0x10b5a, "Inscriptional_Parthian"},
72 {0x10a11, "Kharoshthi"},
75 {0x112df, "Khudawadi"},
80 {0x10755, "Linear_A"},
81 {0x1003c, "Linear_B"},
85 {0x11173, "Mahajani"},
86 {0x0d42, "Malayalam"},
88 {0x10ac8, "Manichaean"},
89 {0xabd0, "Meetei_Mayek"},
90 {0x1e800, "Mende_Kikakui"},
91 {0x1099f, "Meroitic_Hieroglyphs"},
92 {0x109a0, "Meroitic_Cursive"},
95 {0x1822, "Mongolian"},
98 {0x10880, "Nabataean"},
99 {0x19c3, "New_Tai_Lue"},
102 {0x1c6a, "Ol_Chiki"},
103 {0x10310, "Old_Italic"},
104 {0x10a80, "Old_North_Arabian"},
105 {0x10350, "Old_Permic"},
106 {0x103c9, "Old_Persian"},
107 {0x10a6f, "Old_South_Arabian"},
108 {0x10c20, "Old_Turkic"},
110 {0x10491, "Osmanya"},
111 {0x16b2b, "Pahawh_Hmong"},
112 {0x10876, "Palmyrene"},
113 {0x11ACE, "Pau_Cin_Hau"},
114 {0xa860, "Phags_Pa"},
115 {0x10918, "Phoenician"},
116 {0x10baf, "Psalter_Pahlavi"},
119 {0x081d, "Samaritan"},
120 {0xa892, "Saurashtra"},
121 {0x111a0, "Sharada"},
122 {0x10463, "Shavian"},
123 {0x115c1, "Siddham"},
125 {0x110d0, "Sora_Sompeng"},
126 {0x1ba3, "Sundanese"},
127 {0xa803, "Syloti_Nagri"},
130 {0x176f, "Tagbanwa"},
132 {0x1a62, "Tai_Tham"},
133 {0xaadc, "Tai_Viet"},
140 {0x2d55, "Tifinagh"},
141 {0x114d9, "Tirhuta"},
142 {0x10388, "Ugaritic"},
144 {0x118ff, "Warang_Citi"},
148 var outTest
= []T
{ // not really worth being thorough
152 var inCategoryTest
= []T
{
192 var inPropTest
= []T
{
193 {0x0046, "ASCII_Hex_Digit"},
194 {0x200F, "Bidi_Control"},
196 {0xE0001, "Deprecated"},
197 {0x00B7, "Diacritic"},
198 {0x30FE, "Extender"},
199 {0xFF46, "Hex_Digit"},
201 {0x2FFB, "IDS_Binary_Operator"},
202 {0x2FF3, "IDS_Trinary_Operator"},
203 {0xFA6A, "Ideographic"},
204 {0x200D, "Join_Control"},
205 {0x0EC4, "Logical_Order_Exception"},
206 {0x2FFFF, "Noncharacter_Code_Point"},
207 {0x065E, "Other_Alphabetic"},
208 {0x2065, "Other_Default_Ignorable_Code_Point"},
209 {0x0BD7, "Other_Grapheme_Extend"},
210 {0x0387, "Other_ID_Continue"},
211 {0x212E, "Other_ID_Start"},
212 {0x2094, "Other_Lowercase"},
213 {0x2040, "Other_Math"},
214 {0x216F, "Other_Uppercase"},
215 {0x0027, "Pattern_Syntax"},
216 {0x0020, "Pattern_White_Space"},
217 {0x300D, "Quotation_Mark"},
220 {0x2071, "Soft_Dotted"},
221 {0x003A, "Terminal_Punctuation"},
222 {0x9FC3, "Unified_Ideograph"},
223 {0xFE0F, "Variation_Selector"},
224 {0x0020, "White_Space"},
227 func TestScripts(t
*testing
.T
) {
228 notTested
:= make(map[string]bool)
229 for k
:= range Scripts
{
232 for _
, test
:= range inTest
{
233 if _
, ok
:= Scripts
[test
.script
]; !ok
{
234 t
.Fatal(test
.script
, "not a known script")
236 if !Is(Scripts
[test
.script
], test
.rune
) {
237 t
.Errorf("IsScript(%U, %s) = false, want true", test
.rune
, test
.script
)
239 delete(notTested
, test
.script
)
241 for _
, test
:= range outTest
{
242 if Is(Scripts
[test
.script
], test
.rune
) {
243 t
.Errorf("IsScript(%U, %s) = true, want false", test
.rune
, test
.script
)
246 for k
:= range notTested
{
247 t
.Error("script not tested:", k
)
251 func TestCategories(t
*testing
.T
) {
252 notTested
:= make(map[string]bool)
253 for k
:= range Categories
{
256 for _
, test
:= range inCategoryTest
{
257 if _
, ok
:= Categories
[test
.script
]; !ok
{
258 t
.Fatal(test
.script
, "not a known category")
260 if !Is(Categories
[test
.script
], test
.rune
) {
261 t
.Errorf("IsCategory(%U, %s) = false, want true", test
.rune
, test
.script
)
263 delete(notTested
, test
.script
)
265 for k
:= range notTested
{
266 t
.Error("category not tested:", k
)
270 func TestProperties(t
*testing
.T
) {
271 notTested
:= make(map[string]bool)
272 for k
:= range Properties
{
275 for _
, test
:= range inPropTest
{
276 if _
, ok
:= Properties
[test
.script
]; !ok
{
277 t
.Fatal(test
.script
, "not a known prop")
279 if !Is(Properties
[test
.script
], test
.rune
) {
280 t
.Errorf("IsCategory(%U, %s) = false, want true", test
.rune
, test
.script
)
282 delete(notTested
, test
.script
)
284 for k
:= range notTested
{
285 t
.Error("property not tested:", k
)