Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
digit_test.go127 linesDownload Raw Back to unicode
1// Copyright 2009 The Go Authors. All rights reserved.2// Use of this source code is governed by a BSD-style3// license that can be found in the LICENSE file.4 5package unicode_test6 7import (8	"testing"9	. "unicode"10)11 12var testDigit = []rune{13	0x0030,14	0x0039,15	0x0661,16	0x06F1,17	0x07C9,18	0x0966,19	0x09EF,20	0x0A66,21	0x0AEF,22	0x0B66,23	0x0B6F,24	0x0BE6,25	0x0BEF,26	0x0C66,27	0x0CEF,28	0x0D66,29	0x0D6F,30	0x0E50,31	0x0E59,32	0x0ED0,33	0x0ED9,34	0x0F20,35	0x0F29,36	0x1040,37	0x1049,38	0x1090,39	0x1091,40	0x1099,41	0x17E0,42	0x17E9,43	0x1810,44	0x1819,45	0x1946,46	0x194F,47	0x19D0,48	0x19D9,49	0x1B50,50	0x1B59,51	0x1BB0,52	0x1BB9,53	0x1C40,54	0x1C49,55	0x1C50,56	0x1C59,57	0xA620,58	0xA629,59	0xA8D0,60	0xA8D9,61	0xA900,62	0xA909,63	0xAA50,64	0xAA59,65	0xFF10,66	0xFF19,67	0x104A1,68	0x1D7CE,69}70 71var testLetter = []rune{72	0x0041,73	0x0061,74	0x00AA,75	0x00BA,76	0x00C8,77	0x00DB,78	0x00F9,79	0x02EC,80	0x0535,81	0x06E6,82	0x093D,83	0x0A15,84	0x0B99,85	0x0DC0,86	0x0EDD,87	0x1000,88	0x1200,89	0x1312,90	0x1401,91	0x1885,92	0x2C00,93	0xA800,94	0xF900,95	0xFA30,96	0xFFDA,97	0xFFDC,98	0x10000,99	0x10300,100	0x10400,101	0x20000,102	0x2F800,103	0x2FA1D,104}105 106func TestDigit(t *testing.T) {107	for _, r := range testDigit {108		if !IsDigit(r) {109			t.Errorf("IsDigit(U+%04X) = false, want true", r)110		}111	}112	for _, r := range testLetter {113		if IsDigit(r) {114			t.Errorf("IsDigit(U+%04X) = true, want false", r)115		}116	}117}118 119// Test that the special case in IsDigit agrees with the table120func TestDigitOptimization(t *testing.T) {121	for i := rune(0); i <= MaxLatin1; i++ {122		if Is(Digit, i) != IsDigit(i) {123			t.Errorf("IsDigit(U+%04X) disagrees with Is(Digit)", i)124		}125	}126}127 
codekingpro/portable-devtools · Team Ai