parent
46cb0a53e2
commit
816b8d975f
@ -1,14 +1,68 @@
|
|||||||
package gourl
|
package gourl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLenCode(t *testing.T) {
|
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) {
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,23 @@
|
|||||||
package gouuid_test
|
package gouuid
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"gopkg.in/dtapps/go-library.v3/utils/gouuid"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetUuId(t *testing.T) {
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue