diff --git a/utils/gourl/gourl_test.go b/utils/gourl/gourl_test.go index 33e3e331..632a83b5 100644 --- a/utils/gourl/gourl_test.go +++ b/utils/gourl/gourl_test.go @@ -1,14 +1,68 @@ package gourl import ( - "log" "testing" + "time" ) func TestLenCode(t *testing.T) { - log.Println(LenCode("https://www.dtapp.net")) + type args struct { + s string + } + tests := []struct { + name string + args args + want string + }{{ + name: "https://www.dtapp.net", + }, { + name: "https://www.dtapp.net", + }, { + name: "https://www.dtapp.net", + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + start := time.Now() + t.Log(LenCode(tt.name)) + elapsed := time.Since(start) + t.Log("run time", elapsed) + }) + } +} + +func BenchmarkLenCode(b *testing.B) { + for n := 0; n < b.N; n++ { + LenCode("https://www.dtapp.net") + } } func TestDeCode(t *testing.T) { - log.Println(DeCode(LenCode("https://www.dtapp.net"))) + type args struct { + s string + } + tests := []struct { + name string + args args + want string + }{{ + name: "https%3A%2F%2Fwww.dtapp.net", + }, { + name: "https%3A%2F%2Fwww.dtapp.net", + }, { + name: "https%3A%2F%2Fwww.dtapp.net", + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + start := time.Now() + t.Log(DeCode(tt.name)) + elapsed := time.Since(start) + t.Log("run time", elapsed) + }) + } +} + +func BenchmarkDeCode(b *testing.B) { + for n := 0; n < b.N; n++ { + DeCode("https%3A%2F%2Fwww.dtapp.net") + } } diff --git a/utils/gouuid/gouuid_test.go b/utils/gouuid/gouuid_test.go index 50cc2d98..36e39e17 100644 --- a/utils/gouuid/gouuid_test.go +++ b/utils/gouuid/gouuid_test.go @@ -1,11 +1,23 @@ -package gouuid_test +package gouuid import ( - "fmt" - "gopkg.in/dtapps/go-library.v3/utils/gouuid" "testing" ) func TestGetUuId(t *testing.T) { - fmt.Println(gouuid.GetUuId()) + tests := []struct { + name string + want string + }{{}, {}, {}} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Log(GetUuId()) + }) + } +} + +func BenchmarkGetUuId(b *testing.B) { + for n := 0; n < b.N; n++ { + GetUuId() + } }