|
@@ -269,12 +269,12 @@ var unmarshalTests = []struct {
|
|
|
|
|
|
|
|
// int
|
|
// int
|
|
|
{
|
|
{
|
|
|
- "int_max: 2147483647", // math.MaxInt32
|
|
|
|
|
- map[string]int{"int_max": 2147483647},
|
|
|
|
|
|
|
+ "int_max: 2147483647",
|
|
|
|
|
+ map[string]int{"int_max": math.MaxInt32},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "int_min: -2147483648", // math.MinInt32
|
|
|
|
|
- map[string]int{"int_min": -2147483648},
|
|
|
|
|
|
|
+ "int_min: -2147483648",
|
|
|
|
|
+ map[string]int{"int_min": math.MinInt32},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"int_overflow: 9223372036854775808", // math.MaxInt64 + 1
|
|
"int_overflow: 9223372036854775808", // math.MaxInt64 + 1
|
|
@@ -283,20 +283,20 @@ var unmarshalTests = []struct {
|
|
|
|
|
|
|
|
// int64
|
|
// int64
|
|
|
{
|
|
{
|
|
|
- "int64_max: 9223372036854775807", // math.MaxInt64
|
|
|
|
|
- map[string]int64{"int64_max": 9223372036854775807},
|
|
|
|
|
|
|
+ "int64_max: 9223372036854775807",
|
|
|
|
|
+ map[string]int64{"int64_max": math.MaxInt64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111", // math.MaxInt64
|
|
|
|
|
- map[string]int64{"int64_max_base2": 9223372036854775807},
|
|
|
|
|
|
|
+ "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111",
|
|
|
|
|
+ map[string]int64{"int64_max_base2": math.MaxInt64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "int64_min: -9223372036854775808", // math.MinInt64
|
|
|
|
|
- map[string]int64{"int64_min": -9223372036854775808},
|
|
|
|
|
|
|
+ "int64_min: -9223372036854775808",
|
|
|
|
|
+ map[string]int64{"int64_min": math.MinInt64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111", // -math.MaxInt64
|
|
|
|
|
- map[string]int64{"int64_neg_base2": -9223372036854775807},
|
|
|
|
|
|
|
+ "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111",
|
|
|
|
|
+ map[string]int64{"int64_neg_base2": -math.MaxInt64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"int64_overflow: 9223372036854775808", // math.MaxInt64 + 1
|
|
"int64_overflow: 9223372036854775808", // math.MaxInt64 + 1
|
|
@@ -309,8 +309,8 @@ var unmarshalTests = []struct {
|
|
|
map[string]uint{"uint_min": 0},
|
|
map[string]uint{"uint_min": 0},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "uint_max: 4294967295", // math.MaxUint32
|
|
|
|
|
- map[string]uint{"uint_max": 4294967295},
|
|
|
|
|
|
|
+ "uint_max: 4294967295",
|
|
|
|
|
+ map[string]uint{"uint_max": math.MaxUint32},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"uint_underflow: -1",
|
|
"uint_underflow: -1",
|
|
@@ -323,16 +323,16 @@ var unmarshalTests = []struct {
|
|
|
map[string]uint{"uint64_min": 0},
|
|
map[string]uint{"uint64_min": 0},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "uint64_max: 18446744073709551615", // math.MaxUint64
|
|
|
|
|
- map[string]uint64{"uint64_max": 18446744073709551615},
|
|
|
|
|
|
|
+ "uint64_max: 18446744073709551615",
|
|
|
|
|
+ map[string]uint64{"uint64_max": math.MaxUint64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111", // math.MaxUint64
|
|
|
|
|
- map[string]uint64{"uint64_max_base2": 18446744073709551615},
|
|
|
|
|
|
|
+ "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111",
|
|
|
|
|
+ map[string]uint64{"uint64_max_base2": math.MaxUint64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "uint64_maxint64: 9223372036854775807", // math.MaxInt64
|
|
|
|
|
- map[string]uint64{"uint64_maxint64": 9223372036854775807},
|
|
|
|
|
|
|
+ "uint64_maxint64: 9223372036854775807",
|
|
|
|
|
+ map[string]uint64{"uint64_maxint64": math.MaxInt64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"uint64_underflow: -1",
|
|
"uint64_underflow: -1",
|
|
@@ -341,38 +341,38 @@ var unmarshalTests = []struct {
|
|
|
|
|
|
|
|
// float32
|
|
// float32
|
|
|
{
|
|
{
|
|
|
- "float32_max: 3.40282346638528859811704183484516925440e+38", // math.MaxFloat32
|
|
|
|
|
- map[string]float32{"float32_max": 3.40282346638528859811704183484516925440e+38},
|
|
|
|
|
|
|
+ "float32_max: 3.40282346638528859811704183484516925440e+38",
|
|
|
|
|
+ map[string]float32{"float32_max": math.MaxFloat32},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float32_nonzero: 1.401298464324817070923729583289916131280e-45", // math.SmallestNonzeroFloat32
|
|
|
|
|
- map[string]float32{"float32_nonzero": 1.401298464324817070923729583289916131280e-45},
|
|
|
|
|
|
|
+ "float32_nonzero: 1.401298464324817070923729583289916131280e-45",
|
|
|
|
|
+ map[string]float32{"float32_nonzero": math.SmallestNonzeroFloat32},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float32_maxuint64: 18446744073709551615", // math.MaxUint64
|
|
|
|
|
- map[string]float32{"float32_maxuint64": 1.8446744e+19},
|
|
|
|
|
|
|
+ "float32_maxuint64: 18446744073709551615",
|
|
|
|
|
+ map[string]float32{"float32_maxuint64": float32(math.MaxUint64)},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float32_maxuint64+1: 18446744073709551616", // math.MaxUint64 + 1
|
|
|
|
|
- map[string]float32{"float32_maxuint64+1": 1.8446744e+19},
|
|
|
|
|
|
|
+ "float32_maxuint64+1: 18446744073709551616",
|
|
|
|
|
+ map[string]float32{"float32_maxuint64+1": float32(math.MaxUint64 + 1)},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// float64
|
|
// float64
|
|
|
{
|
|
{
|
|
|
- "float64_max: 1.797693134862315708145274237317043567981e+308", // math.MaxFloat64
|
|
|
|
|
- map[string]float64{"float64_max": 1.797693134862315708145274237317043567981e+308},
|
|
|
|
|
|
|
+ "float64_max: 1.797693134862315708145274237317043567981e+308",
|
|
|
|
|
+ map[string]float64{"float64_max": math.MaxFloat64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float64_nonzero: 4.940656458412465441765687928682213723651e-324", // math.SmallestNonzeroFloat64
|
|
|
|
|
- map[string]float64{"float64_nonzero": 4.940656458412465441765687928682213723651e-324},
|
|
|
|
|
|
|
+ "float64_nonzero: 4.940656458412465441765687928682213723651e-324",
|
|
|
|
|
+ map[string]float64{"float64_nonzero": math.SmallestNonzeroFloat64},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float64_maxuint64: 18446744073709551615", // math.MaxUint64
|
|
|
|
|
- map[string]float64{"float64_maxuint64": 1.8446744073709552e+19},
|
|
|
|
|
|
|
+ "float64_maxuint64: 18446744073709551615",
|
|
|
|
|
+ map[string]float64{"float64_maxuint64": float64(math.MaxUint64)},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "float64_maxuint64+1: 18446744073709551616", // math.MaxUint64 + 1
|
|
|
|
|
- map[string]float64{"float64_maxuint64+1": 1.8446744073709552e+19},
|
|
|
|
|
|
|
+ "float64_maxuint64+1: 18446744073709551616",
|
|
|
|
|
+ map[string]float64{"float64_maxuint64+1": float64(math.MaxUint64 + 1)},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// Overflow cases.
|
|
// Overflow cases.
|