mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-14 02:33:03 +02:00
fix(contrib/log): test case error (#2487)
* fix(contrib/log): test case error * fix float32 * add nil case
This commit is contained in:
parent
2a65502be2
commit
511f1917ce
@ -116,21 +116,22 @@ func TestToString(t *testing.T) {
|
||||
{"float64", 6.66, "6.66"},
|
||||
{"max float64", math.MaxFloat64, "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, //nolint:lll
|
||||
{"float32", float32(6.66), "6.66"},
|
||||
{"max float32", math.MaxFloat32, "340282346638528860000000000000000000000"},
|
||||
{"int", int(math.MaxInt64), "9223372036854775807"},
|
||||
{"max float32", float32(math.MaxFloat32), "340282350000000000000000000000000000000"},
|
||||
{"int", math.MaxInt64, "9223372036854775807"},
|
||||
{"uint", uint(math.MaxUint64), "18446744073709551615"},
|
||||
{"int8", math.MaxInt8, "127"},
|
||||
{"uint8", math.MaxUint8, "255"},
|
||||
{"int16", math.MaxInt16, "32767"},
|
||||
{"uint16", math.MaxUint16, "65535"},
|
||||
{"int32", math.MaxInt32, "2147483647"},
|
||||
{"uint32", math.MaxUint32, "4294967295"},
|
||||
{"int64", math.MaxInt64, "9223372036854775807"},
|
||||
{"int8", int8(math.MaxInt8), "127"},
|
||||
{"uint8", uint8(math.MaxUint8), "255"},
|
||||
{"int16", int16(math.MaxInt16), "32767"},
|
||||
{"uint16", uint16(math.MaxUint16), "65535"},
|
||||
{"int32", int32(math.MaxInt32), "2147483647"},
|
||||
{"uint32", uint32(math.MaxUint32), "4294967295"},
|
||||
{"int64", int64(math.MaxInt64), "9223372036854775807"},
|
||||
{"uint64", uint64(math.MaxUint64), "18446744073709551615"},
|
||||
{"string", "abc", "abc"},
|
||||
{"bool", false, "false"},
|
||||
{"[]byte", []byte("abc"), "abc"},
|
||||
{"struct", struct{ Name string }{}, `{"Name":""}`},
|
||||
{"nil", nil, ""},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
@ -120,21 +120,22 @@ func TestToString(t *testing.T) {
|
||||
{"float64", 6.66, "6.66"},
|
||||
{"max float64", math.MaxFloat64, "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, //nolint:lll
|
||||
{"float32", float32(6.66), "6.66"},
|
||||
{"max float32", math.MaxFloat32, "340282346638528860000000000000000000000"},
|
||||
{"int", int(math.MaxInt64), "9223372036854775807"},
|
||||
{"max float32", float32(math.MaxFloat32), "340282350000000000000000000000000000000"},
|
||||
{"int", math.MaxInt64, "9223372036854775807"},
|
||||
{"uint", uint(math.MaxUint64), "18446744073709551615"},
|
||||
{"int8", math.MaxInt8, "127"},
|
||||
{"uint8", math.MaxUint8, "255"},
|
||||
{"int16", math.MaxInt16, "32767"},
|
||||
{"uint16", math.MaxUint16, "65535"},
|
||||
{"int32", math.MaxInt32, "2147483647"},
|
||||
{"uint32", math.MaxUint32, "4294967295"},
|
||||
{"int64", math.MaxInt64, "9223372036854775807"},
|
||||
{"int8", int8(math.MaxInt8), "127"},
|
||||
{"uint8", uint8(math.MaxUint8), "255"},
|
||||
{"int16", int16(math.MaxInt16), "32767"},
|
||||
{"uint16", uint16(math.MaxUint16), "65535"},
|
||||
{"int32", int32(math.MaxInt32), "2147483647"},
|
||||
{"uint32", uint32(math.MaxUint32), "4294967295"},
|
||||
{"int64", int64(math.MaxInt64), "9223372036854775807"},
|
||||
{"uint64", uint64(math.MaxUint64), "18446744073709551615"},
|
||||
{"string", "abc", "abc"},
|
||||
{"bool", false, "false"},
|
||||
{"[]byte", []byte("abc"), "abc"},
|
||||
{"struct", struct{ Name string }{}, `{"Name":""}`},
|
||||
{"nil", nil, ""},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user