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, mostly to discover when new
18 // scripts and categories arise.
32 {0x156d, "Canadian_Aboriginal"},
39 {0x12420, "Cuneiform"},
43 {0x094a, "Devanagari"},
44 {0x13001, "Egyptian_Hieroglyphs"},
47 {0x2c40, "Glagolitic"},
57 {0x10841, "Imperial_Aramaic"},
58 {0x20e6, "Inherited"},
59 {0x10b70, "Inscriptional_Pahlavi"},
60 {0x10b5a, "Inscriptional_Parthian"},
66 {0x10a11, "Kharoshthi"},
72 {0x1003c, "Linear_B"},
76 {0x0d42, "Malayalam"},
78 {0xabd0, "Meetei_Mayek"},
79 {0x1822, "Mongolian"},
81 {0x19c3, "New_Tai_Lue"},
85 {0x10310, "Old_Italic"},
86 {0x103c9, "Old_Persian"},
87 {0x10a6f, "Old_South_Arabian"},
88 {0x10c20, "Old_Turkic"},
92 {0x10918, "Phoenician"},
95 {0x081d, "Samaritan"},
96 {0xa892, "Saurashtra"},
99 {0x1ba3, "Sundanese"},
100 {0xa803, "Syloti_Nagri"},
103 {0x176f, "Tagbanwa"},
105 {0x1a62, "Tai_Tham"},
106 {0xaadc, "Tai_Viet"},
112 {0x2d55, "Tifinagh"},
113 {0x10388, "Ugaritic"},
118 var outTest = []T{ // not really worth being thorough
122 var inCategoryTest = []T{
155 var inPropTest = []T{
156 {0x0046, "ASCII_Hex_Digit"},
157 {0x200F, "Bidi_Control"},
159 {0xE0001, "Deprecated"},
160 {0x00B7, "Diacritic"},
161 {0x30FE, "Extender"},
162 {0xFF46, "Hex_Digit"},
164 {0x2FFB, "IDS_Binary_Operator"},
165 {0x2FF3, "IDS_Trinary_Operator"},
166 {0xFA6A, "Ideographic"},
167 {0x200D, "Join_Control"},
168 {0x0EC4, "Logical_Order_Exception"},
169 {0x2FFFF, "Noncharacter_Code_Point"},
170 {0x065E, "Other_Alphabetic"},
171 {0x2069, "Other_Default_Ignorable_Code_Point"},
172 {0x0BD7, "Other_Grapheme_Extend"},
173 {0x0387, "Other_ID_Continue"},
174 {0x212E, "Other_ID_Start"},
175 {0x2094, "Other_Lowercase"},
176 {0x2040, "Other_Math"},
177 {0x216F, "Other_Uppercase"},
178 {0x0027, "Pattern_Syntax"},
179 {0x0020, "Pattern_White_Space"},
180 {0x300D, "Quotation_Mark"},
183 {0x2071, "Soft_Dotted"},
184 {0x003A, "Terminal_Punctuation"},
185 {0x9FC3, "Unified_Ideograph"},
186 {0xFE0F, "Variation_Selector"},
187 {0x0020, "White_Space"},
190 func TestScripts(t *testing.T) {
191 notTested := make(map[string]bool)
192 for k := range Scripts {
195 for _, test := range inTest {
196 if _, ok := Scripts[test.script]; !ok {
197 t.Fatal(test.script, "not a known script")
199 if !Is(Scripts[test.script], test.rune) {
200 t.Errorf("IsScript(%#x, %s) = false, want true", test.rune, test.script)
202 notTested[test.script] = false, false
204 for _, test := range outTest {
205 if Is(Scripts[test.script], test.rune) {
206 t.Errorf("IsScript(%#x, %s) = true, want false", test.rune, test.script)
209 for k := range notTested {
210 t.Error("script not tested:", k)
214 func TestCategories(t *testing.T) {
215 notTested := make(map[string]bool)
216 for k := range Categories {
219 for _, test := range inCategoryTest {
220 if _, ok := Categories[test.script]; !ok {
221 t.Fatal(test.script, "not a known category")
223 if !Is(Categories[test.script], test.rune) {
224 t.Errorf("IsCategory(%#x, %s) = false, want true", test.rune, test.script)
226 notTested[test.script] = false, false
228 for k := range notTested {
229 t.Error("category not tested:", k)
233 func TestProperties(t *testing.T) {
234 notTested := make(map[string]bool)
235 for k := range Properties {
238 for _, test := range inPropTest {
239 if _, ok := Properties[test.script]; !ok {
240 t.Fatal(test.script, "not a known prop")
242 if !Is(Properties[test.script], test.rune) {
243 t.Errorf("IsCategory(%#x, %s) = false, want true", test.rune, test.script)
245 notTested[test.script] = false, false
247 for k := range notTested {
248 t.Error("property not tested:", k)