@@ -13,12 +13,12 @@ var ctx = context.Background()
13
13
type args struct {
14
14
ctx context.Context
15
15
exp string
16
- n int
16
+ n int64
17
17
}
18
18
type tCase struct {
19
19
name string
20
20
args args
21
- want int
21
+ want int64
22
22
wantErr bool
23
23
}
24
24
@@ -46,11 +46,11 @@ func okCase() []tCase {
46
46
}
47
47
48
48
// 拉脱维亚语 Latvian 三种复数,0特殊
49
- for i := 0 ; i < 215 ; i ++ {
49
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
50
50
tests = append (tests ,
51
51
tCase {fmt .Sprintf ("test-case-3-#%v" , i ),
52
52
args {ctx , "n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2" , i },
53
- func (n int ) int {
53
+ func (n int64 ) int64 {
54
54
// n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2
55
55
if n % 10 == 1 && n % 100 != 11 {
56
56
return 0
@@ -63,11 +63,11 @@ func okCase() []tCase {
63
63
)
64
64
}
65
65
// 三种复数,00 [2-9][0-9] Romanian 罗马尼亚
66
- for i := 0 ; i < 215 ; i ++ {
66
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
67
67
tests = append (tests ,
68
68
tCase {fmt .Sprintf ("test-case-4-#%v" , i ),
69
69
args {ctx , "n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2" , i },
70
- func (n int ) int {
70
+ func (n int64 ) int64 {
71
71
// n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2
72
72
if n == 1 {
73
73
return 0
@@ -80,11 +80,11 @@ func okCase() []tCase {
80
80
)
81
81
}
82
82
// 三种复数,1[2-9] 立陶宛 Lithuanian
83
- for i := 0 ; i < 215 ; i ++ {
83
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
84
84
tests = append (tests ,
85
85
tCase {fmt .Sprintf ("test-case-5-#%v" , i ),
86
86
args {ctx , "n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2" , i },
87
- func (n int ) int {
87
+ func (n int64 ) int64 {
88
88
// n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2
89
89
if n % 10 == 1 && n % 100 != 11 {
90
90
return 0
@@ -97,11 +97,11 @@ func okCase() []tCase {
97
97
)
98
98
}
99
99
// 三种复数,1234结尾的特殊,但不是 1[1-4] Russian, Ukrainian, Belarusian, Serbian, Croatian
100
- for i := 0 ; i < 215 ; i ++ {
100
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
101
101
tests = append (tests ,
102
102
tCase {fmt .Sprintf ("test-case-6-#%v" , i ),
103
103
args {ctx , "n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2" , i },
104
- func (n int ) int {
104
+ func (n int64 ) int64 {
105
105
// n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
106
106
if n % 10 == 1 && n % 100 != 11 {
107
107
return 0
@@ -114,11 +114,11 @@ func okCase() []tCase {
114
114
)
115
115
}
116
116
// 三种复数,1234结尾的特殊 Czech, Slovak
117
- for i := 0 ; i < 215 ; i ++ {
117
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
118
118
tests = append (tests ,
119
119
tCase {fmt .Sprintf ("test-case-7-#%v" , i ),
120
120
args {ctx , "(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2" , i },
121
- func (n int ) int {
121
+ func (n int64 ) int64 {
122
122
// (n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2
123
123
if n == 1 {
124
124
return 0
@@ -132,11 +132,11 @@ func okCase() []tCase {
132
132
}
133
133
// 三种复数,Three forms, special case for one and some numbers ending in 2, 3, or 4
134
134
// Polish
135
- for i := 0 ; i < 215 ; i ++ {
135
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
136
136
tests = append (tests ,
137
137
tCase {fmt .Sprintf ("test-case-8-#%v" , i ),
138
138
args {ctx , "n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2" , i },
139
- func (n int ) int {
139
+ func (n int64 ) int64 {
140
140
// n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
141
141
if n == 1 {
142
142
return 0
@@ -150,11 +150,11 @@ func okCase() []tCase {
150
150
}
151
151
// Four forms, special case for one and all numbers ending in 02, 03, or 04
152
152
// Slovenian
153
- for i := 0 ; i < 215 ; i ++ {
153
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
154
154
tests = append (tests ,
155
155
tCase {fmt .Sprintf ("test-case-9-#%v" , i ),
156
156
args {ctx , "n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3" , i },
157
- func (n int ) int {
157
+ func (n int64 ) int64 {
158
158
//n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3
159
159
if n % 100 == 1 {
160
160
return 0
@@ -171,11 +171,11 @@ func okCase() []tCase {
171
171
}
172
172
// Six forms, special cases for one, two, all numbers ending in 02, 03, … 10, all numbers ending in 11 … 99, and others
173
173
// Arabic
174
- for i := 0 ; i < 215 ; i ++ {
174
+ for i := int64 ( 0 ) ; i < 215 ; i ++ {
175
175
tests = append (tests ,
176
176
tCase {fmt .Sprintf ("test-case-10-#%v" , i ),
177
177
args {ctx , " n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5" , i },
178
- func (n int ) int {
178
+ func (n int64 ) int64 {
179
179
if n == 0 {
180
180
return 0
181
181
}
0 commit comments