From 32ee94748e666fe76ce054ceb9bdf45cd8194041 Mon Sep 17 00:00:00 2001 From: shockerli Date: Wed, 5 Jan 2022 14:49:02 +0800 Subject: [PATCH] add 4 unit test case for int* --- README.md | 1 - README_ZH.md | 1 - int_test.go | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4998c0a..9e86053 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![PkgGoDev](https://pkg.go.dev/badge/github.com/shockerli/cvt)](https://pkg.go.dev/github.com/shockerli/cvt) [![Go Report Card](https://goreportcard.com/badge/github.com/shockerli/cvt)](https://goreportcard.com/report/github.com/shockerli/cvt) [![Build Status](https://travis-ci.com/shockerli/cvt.svg?branch=master)](https://travis-ci.com/shockerli/cvt) -![GitHub top language](https://img.shields.io/github/languages/top/shockerli/cvt) [![codecov](https://codecov.io/gh/shockerli/cvt/branch/master/graph/badge.svg)](https://codecov.io/gh/shockerli/cvt) ![GitHub](https://img.shields.io/github/license/shockerli/cvt) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) diff --git a/README_ZH.md b/README_ZH.md index 03d12e7..873d6ad 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -3,7 +3,6 @@ [![PkgGoDev](https://pkg.go.dev/badge/github.com/shockerli/cvt)](https://pkg.go.dev/github.com/shockerli/cvt) [![Go Report Card](https://goreportcard.com/badge/github.com/shockerli/cvt)](https://goreportcard.com/report/github.com/shockerli/cvt) [![Build Status](https://travis-ci.com/shockerli/cvt.svg?branch=master)](https://travis-ci.com/shockerli/cvt) -![GitHub top language](https://img.shields.io/github/languages/top/shockerli/cvt) [![codecov](https://codecov.io/gh/shockerli/cvt/branch/master/graph/badge.svg)](https://codecov.io/gh/shockerli/cvt) ![GitHub](https://img.shields.io/github/license/shockerli/cvt) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) diff --git a/int_test.go b/int_test.go index a0d8214..c1be868 100644 --- a/int_test.go +++ b/int_test.go @@ -977,6 +977,8 @@ func TestUint64E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"00100.01", 100, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, @@ -1098,6 +1100,8 @@ func TestUint32E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"00100.01", 100, false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -1212,6 +1216,8 @@ func TestUint16E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"00100.01", 100, false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -1328,6 +1334,8 @@ func TestUint8E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"00100.01", 100, false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -1444,6 +1452,8 @@ func TestUintE(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"00100.01", 100, false}, {uint64(math.MaxUint32), uint(math.MaxUint32), false}, {uint32(math.MaxUint32), uint(math.MaxUint32), false}, {nil, 0, false}, @@ -1567,11 +1577,17 @@ func TestInt64E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"-00100", -100, false}, + {"00100.00", 100, false}, + {"-00100.01", -100, false}, {[]byte("-8"), -8, false}, {[]byte("-8.01"), -8, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, + {math.MaxInt64, math.MaxInt64, false}, + {math.MinInt64, math.MinInt64, false}, {uint32(math.MaxUint32), int64(math.MaxUint32), false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, @@ -1689,12 +1705,17 @@ func TestInt32E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"-00100", -100, false}, + {"00100.00", 100, false}, + {"-00100.01", -100, false}, {[]byte("-8"), -8, false}, {[]byte("-8.01"), -8, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, {math.MaxInt32, int32(math.MaxInt32), false}, + {math.MinInt32, int32(math.MinInt32), false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -1808,12 +1829,17 @@ func TestInt16E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"-00100", -100, false}, + {"00100.00", 100, false}, + {"-00100.01", -100, false}, {[]byte("-8"), -8, false}, {[]byte("-8.01"), -8, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, {math.MaxInt16, int16(math.MaxInt16), false}, + {math.MinInt16, int16(math.MinInt16), false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -1929,12 +1955,17 @@ func TestInt8E(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"-00100", -100, false}, + {"00100.00", 100, false}, + {"-00100.01", -100, false}, {[]byte("-8"), -8, false}, {[]byte("-8.01"), -8, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, {int8(math.MaxInt8), math.MaxInt8, false}, + {int8(math.MinInt8), math.MinInt8, false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false}, @@ -2051,12 +2082,16 @@ func TestIntE(t *testing.T) { {"8", 8, false}, {"8.00", 8, false}, {"8.01", 8, false}, + {"00100", 100, false}, + {"-00100", -100, false}, + {"00100.00", 100, false}, + {"-00100.01", -100, false}, {[]byte("-8"), -8, false}, {[]byte("-8.01"), -8, false}, {[]byte("8"), 8, false}, {[]byte("8.00"), 8, false}, {[]byte("8.01"), 8, false}, - {int(math.MaxInt32), int(math.MaxInt32), false}, + {math.MaxInt32, math.MaxInt32, false}, {nil, 0, false}, {aliasTypeInt0, 0, false}, {&aliasTypeInt0, 0, false},