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, 7.0.0 and 8.0.0
18 // mostly to discover when new scripts and categories arise.
22 {0x14646, "Anatolian_Hieroglyphs"},
26 {0x11c00, "Bhaiksuki"},
29 {0x16ada, "Bassa_Vah"},
37 {0x156d, "Canadian_Aboriginal"},
39 {0x10563, "Caucasian_Albanian"},
46 {0x12420, "Cuneiform"},
50 {0x094a, "Devanagari"},
51 {0x1BC00, "Duployan"},
52 {0x13001, "Egyptian_Hieroglyphs"},
56 {0x2c40, "Glagolitic"},
68 {0x10841, "Imperial_Aramaic"},
69 {0x20e6, "Inherited"},
70 {0x10b70, "Inscriptional_Pahlavi"},
71 {0x10b5a, "Inscriptional_Parthian"},
77 {0x10a11, "Kharoshthi"},
80 {0x112df, "Khudawadi"},
85 {0x10755, "Linear_A"},
86 {0x1003c, "Linear_B"},
90 {0x11173, "Mahajani"},
91 {0x0d42, "Malayalam"},
93 {0x10ac8, "Manichaean"},
95 {0xabd0, "Meetei_Mayek"},
96 {0x1e800, "Mende_Kikakui"},
97 {0x1099f, "Meroitic_Hieroglyphs"},
98 {0x109a0, "Meroitic_Cursive"},
101 {0x1822, "Mongolian"},
103 {0x11293, "Multani"},
105 {0x10880, "Nabataean"},
107 {0x19c3, "New_Tai_Lue"},
110 {0x1c6a, "Ol_Chiki"},
111 {0x10C80, "Old_Hungarian"},
112 {0x10310, "Old_Italic"},
113 {0x10a80, "Old_North_Arabian"},
114 {0x10350, "Old_Permic"},
115 {0x103c9, "Old_Persian"},
116 {0x10a6f, "Old_South_Arabian"},
117 {0x10c20, "Old_Turkic"},
120 {0x10491, "Osmanya"},
121 {0x16b2b, "Pahawh_Hmong"},
122 {0x10876, "Palmyrene"},
123 {0x11ACE, "Pau_Cin_Hau"},
124 {0xa860, "Phags_Pa"},
125 {0x10918, "Phoenician"},
126 {0x10baf, "Psalter_Pahlavi"},
129 {0x081d, "Samaritan"},
130 {0xa892, "Saurashtra"},
131 {0x111a0, "Sharada"},
132 {0x10463, "Shavian"},
133 {0x115c1, "Siddham"},
134 {0x1D920, "SignWriting"},
136 {0x110d0, "Sora_Sompeng"},
137 {0x1ba3, "Sundanese"},
138 {0xa803, "Syloti_Nagri"},
141 {0x176f, "Tagbanwa"},
143 {0x1a62, "Tai_Tham"},
144 {0xaadc, "Tai_Viet"},
152 {0x2d55, "Tifinagh"},
153 {0x114d9, "Tirhuta"},
154 {0x10388, "Ugaritic"},
156 {0x118ff, "Warang_Citi"},
160 var outTest
= []T
{ // not really worth being thorough
164 var inCategoryTest
= []T
{
204 var inPropTest
= []T
{
205 {0x0046, "ASCII_Hex_Digit"},
206 {0x200F, "Bidi_Control"},
208 {0xE0001, "Deprecated"},
209 {0x00B7, "Diacritic"},
210 {0x30FE, "Extender"},
211 {0xFF46, "Hex_Digit"},
213 {0x2FFB, "IDS_Binary_Operator"},
214 {0x2FF3, "IDS_Trinary_Operator"},
215 {0xFA6A, "Ideographic"},
216 {0x200D, "Join_Control"},
217 {0x0EC4, "Logical_Order_Exception"},
218 {0x2FFFF, "Noncharacter_Code_Point"},
219 {0x065E, "Other_Alphabetic"},
220 {0x2065, "Other_Default_Ignorable_Code_Point"},
221 {0x0BD7, "Other_Grapheme_Extend"},
222 {0x0387, "Other_ID_Continue"},
223 {0x212E, "Other_ID_Start"},
224 {0x2094, "Other_Lowercase"},
225 {0x2040, "Other_Math"},
226 {0x216F, "Other_Uppercase"},
227 {0x0027, "Pattern_Syntax"},
228 {0x0020, "Pattern_White_Space"},
229 {0x06DD, "Prepended_Concatenation_Mark"},
230 {0x300D, "Quotation_Mark"},
232 {0x061F, "STerm"}, // Deprecated alias of Sentence_Terminal
233 {0x061F, "Sentence_Terminal"},
234 {0x2071, "Soft_Dotted"},
235 {0x003A, "Terminal_Punctuation"},
236 {0x9FC3, "Unified_Ideograph"},
237 {0xFE0F, "Variation_Selector"},
238 {0x0020, "White_Space"},
241 func TestScripts(t
*testing
.T
) {
242 notTested
:= make(map[string]bool)
243 for k
:= range Scripts
{
246 for _
, test
:= range inTest
{
247 if _
, ok
:= Scripts
[test
.script
]; !ok
{
248 t
.Fatal(test
.script
, "not a known script")
250 if !Is(Scripts
[test
.script
], test
.rune
) {
251 t
.Errorf("IsScript(%U, %s) = false, want true", test
.rune
, test
.script
)
253 delete(notTested
, test
.script
)
255 for _
, test
:= range outTest
{
256 if Is(Scripts
[test
.script
], test
.rune
) {
257 t
.Errorf("IsScript(%U, %s) = true, want false", test
.rune
, test
.script
)
260 for k
:= range notTested
{
261 t
.Error("script not tested:", k
)
265 func TestCategories(t
*testing
.T
) {
266 notTested
:= make(map[string]bool)
267 for k
:= range Categories
{
270 for _
, test
:= range inCategoryTest
{
271 if _
, ok
:= Categories
[test
.script
]; !ok
{
272 t
.Fatal(test
.script
, "not a known category")
274 if !Is(Categories
[test
.script
], test
.rune
) {
275 t
.Errorf("IsCategory(%U, %s) = false, want true", test
.rune
, test
.script
)
277 delete(notTested
, test
.script
)
279 for k
:= range notTested
{
280 t
.Error("category not tested:", k
)
284 func TestProperties(t
*testing
.T
) {
285 notTested
:= make(map[string]bool)
286 for k
:= range Properties
{
289 for _
, test
:= range inPropTest
{
290 if _
, ok
:= Properties
[test
.script
]; !ok
{
291 t
.Fatal(test
.script
, "not a known prop")
293 if !Is(Properties
[test
.script
], test
.rune
) {
294 t
.Errorf("IsCategory(%U, %s) = false, want true", test
.rune
, test
.script
)
296 delete(notTested
, test
.script
)
298 for k
:= range notTested
{
299 t
.Error("property not tested:", k
)