@@ -38,6 +38,12 @@ func Test_any_to_int64(t *testing.T) {
38
38
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
39
39
should .Equal (int64 (10 ), val )
40
40
41
+ // bool part
42
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
43
+ should .Equal (int64 (0 ), val )
44
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
45
+ should .Equal (int64 (1 ), val )
46
+
41
47
should .Nil (jsoniter .UnmarshalFromString (`-10` , & val ))
42
48
should .Equal (int64 (- 10 ), val )
43
49
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
@@ -57,6 +63,13 @@ func Test_any_to_int(t *testing.T) {
57
63
should .Equal (10 , val )
58
64
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
59
65
should .Equal (10 , val )
66
+
67
+ // bool part
68
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
69
+ should .Equal (0 , val )
70
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
71
+ should .Equal (1 , val )
72
+
60
73
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
61
74
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
62
75
// large float to int
@@ -74,6 +87,13 @@ func Test_any_to_int16(t *testing.T) {
74
87
should .Equal (int16 (10 ), val )
75
88
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
76
89
should .Equal (int16 (10 ), val )
90
+
91
+ // bool part
92
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
93
+ should .Equal (int16 (0 ), val )
94
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
95
+ should .Equal (int16 (1 ), val )
96
+
77
97
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
78
98
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
79
99
// large float to int
@@ -91,6 +111,13 @@ func Test_any_to_int32(t *testing.T) {
91
111
should .Equal (int32 (10 ), val )
92
112
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
93
113
should .Equal (int32 (10 ), val )
114
+
115
+ // bool part
116
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
117
+ should .Equal (int32 (0 ), val )
118
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
119
+ should .Equal (int32 (1 ), val )
120
+
94
121
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
95
122
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
96
123
// large float to int
@@ -108,6 +135,13 @@ func Test_any_to_int8(t *testing.T) {
108
135
should .Equal (int8 (10 ), val )
109
136
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
110
137
should .Equal (int8 (10 ), val )
138
+
139
+ // bool part
140
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
141
+ should .Equal (int8 (0 ), val )
142
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
143
+ should .Equal (int8 (1 ), val )
144
+
111
145
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
112
146
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
113
147
// large float to int
@@ -125,6 +159,13 @@ func Test_any_to_uint8(t *testing.T) {
125
159
should .Equal (uint8 (10 ), val )
126
160
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
127
161
should .Equal (uint8 (10 ), val )
162
+
163
+ // bool part
164
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
165
+ should .Equal (uint8 (0 ), val )
166
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
167
+ should .Equal (uint8 (1 ), val )
168
+
128
169
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
129
170
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
130
171
// large float to int
@@ -144,6 +185,12 @@ func Test_any_to_uint64(t *testing.T) {
144
185
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
145
186
should .Equal (uint64 (10 ), val )
146
187
188
+ // bool part
189
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
190
+ should .Equal (uint64 (0 ), val )
191
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
192
+ should .Equal (uint64 (1 ), val )
193
+
147
194
// TODO fix?
148
195
should .NotNil (jsoniter .UnmarshalFromString (`-10` , & val ))
149
196
should .Equal (uint64 (0 ), val )
@@ -165,6 +212,12 @@ func Test_any_to_uint32(t *testing.T) {
165
212
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
166
213
should .Equal (uint32 (10 ), val )
167
214
215
+ // bool part
216
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
217
+ should .Equal (uint32 (0 ), val )
218
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
219
+ should .Equal (uint32 (1 ), val )
220
+
168
221
// TODO fix?
169
222
should .NotNil (jsoniter .UnmarshalFromString (`-10` , & val ))
170
223
should .Equal (uint32 (0 ), val )
@@ -186,6 +239,12 @@ func Test_any_to_uint16(t *testing.T) {
186
239
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
187
240
should .Equal (uint16 (10 ), val )
188
241
242
+ // bool part
243
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
244
+ should .Equal (uint16 (0 ), val )
245
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
246
+ should .Equal (uint16 (1 ), val )
247
+
189
248
// TODO fix?
190
249
should .NotNil (jsoniter .UnmarshalFromString (`-10` , & val ))
191
250
should .Equal (uint16 (0 ), val )
@@ -205,6 +264,12 @@ func Test_any_to_uint(t *testing.T) {
205
264
should .Equal (uint (10 ), val )
206
265
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
207
266
should .Equal (uint (10 ), val )
267
+
268
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
269
+ should .Equal (uint (0 ), val )
270
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
271
+ should .Equal (uint (1 ), val )
272
+
208
273
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
209
274
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
210
275
// large float to int
@@ -223,6 +288,13 @@ func Test_any_to_float32(t *testing.T) {
223
288
should .Equal (float32 (10.1 ), val )
224
289
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
225
290
should .Equal (float32 (10 ), val )
291
+
292
+ // bool part
293
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
294
+ should .Equal (float32 (0 ), val )
295
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
296
+ should .Equal (float32 (1 ), val )
297
+
226
298
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
227
299
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
228
300
}
@@ -240,6 +312,13 @@ func Test_any_to_float64(t *testing.T) {
240
312
should .Equal (float64 (10.1 ), val )
241
313
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
242
314
should .Equal (float64 (10 ), val )
315
+
316
+ // bool part
317
+ should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
318
+ should .Equal (float64 (0 ), val )
319
+ should .Nil (jsoniter .UnmarshalFromString (`true` , & val ))
320
+ should .Equal (float64 (1 ), val )
321
+
243
322
should .NotNil (jsoniter .UnmarshalFromString ("{}" , & val ))
244
323
should .NotNil (jsoniter .UnmarshalFromString ("[]" , & val ))
245
324
}
0 commit comments