LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package unicode_test | 5 package unicode_test |
6 | 6 |
7 import ( | 7 import ( |
8 "testing" | 8 "testing" |
9 . "unicode" | 9 . "unicode" |
10 ) | 10 ) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 for _, c := range letterTest { | 316 for _, c := range letterTest { |
317 if IsSpace(c) { | 317 if IsSpace(c) { |
318 t.Errorf("IsSpace(U+%04X) = true; want false", c) | 318 t.Errorf("IsSpace(U+%04X) = true; want false", c) |
319 } | 319 } |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 // Check that the optimizations for IsLetter etc. agree with the tables. | 323 // Check that the optimizations for IsLetter etc. agree with the tables. |
324 // We only need to check the Latin-1 range. | 324 // We only need to check the Latin-1 range. |
325 func TestLetterOptimizations(t *testing.T) { | 325 func TestLetterOptimizations(t *testing.T) { |
326 » for i := 0; i < 0x100; i++ { | 326 » for i := 0; i < Latin1Max; i++ { |
327 if Is(Letter, i) != IsLetter(i) { | 327 if Is(Letter, i) != IsLetter(i) { |
328 t.Errorf("IsLetter(U+%04X) disagrees with Is(Letter)", i
) | 328 t.Errorf("IsLetter(U+%04X) disagrees with Is(Letter)", i
) |
329 } | 329 } |
330 if Is(Upper, i) != IsUpper(i) { | 330 if Is(Upper, i) != IsUpper(i) { |
331 t.Errorf("IsUpper(U+%04X) disagrees with Is(Upper)", i) | 331 t.Errorf("IsUpper(U+%04X) disagrees with Is(Upper)", i) |
332 } | 332 } |
333 if Is(Lower, i) != IsLower(i) { | 333 if Is(Lower, i) != IsLower(i) { |
334 t.Errorf("IsLower(U+%04X) disagrees with Is(Lower)", i) | 334 t.Errorf("IsLower(U+%04X) disagrees with Is(Lower)", i) |
335 } | 335 } |
336 if Is(Title, i) != IsTitle(i) { | 336 if Is(Title, i) != IsTitle(i) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 t.Errorf("lower(U+%04X) is U+%04X not U+%04X", u, Turkis
hCase.ToLower(l), l) | 369 t.Errorf("lower(U+%04X) is U+%04X not U+%04X", u, Turkis
hCase.ToLower(l), l) |
370 } | 370 } |
371 if TurkishCase.ToTitle(u) != u { | 371 if TurkishCase.ToTitle(u) != u { |
372 t.Errorf("title(U+%04X) is U+%04X not U+%04X", u, Turkis
hCase.ToTitle(u), u) | 372 t.Errorf("title(U+%04X) is U+%04X not U+%04X", u, Turkis
hCase.ToTitle(u), u) |
373 } | 373 } |
374 if TurkishCase.ToTitle(l) != u { | 374 if TurkishCase.ToTitle(l) != u { |
375 t.Errorf("title(U+%04X) is U+%04X not U+%04X", l, Turkis
hCase.ToTitle(l), u) | 375 t.Errorf("title(U+%04X) is U+%04X not U+%04X", l, Turkis
hCase.ToTitle(l), u) |
376 } | 376 } |
377 } | 377 } |
378 } | 378 } |
LEFT | RIGHT |