You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
766 B
39 lines
766 B
package str
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestReverse(tt *testing.T) {
|
|
a := []byte("hello world")
|
|
fmt.Println(a)
|
|
//[104 101 108 108 111 32 119 111 114 108 100]
|
|
ByteReverse(a)
|
|
fmt.Println(a)
|
|
//[100 108 114 111 119 32 111 108 108 101 104]
|
|
|
|
}
|
|
|
|
func TestBit62Add(t *testing.T) {
|
|
var num int64 = 1234567890
|
|
var num1 int64 = 5
|
|
numB62 := StrTool.Bit62Encode(num)
|
|
num1B62 := StrTool.Bit62Encode(num1)
|
|
fmt.Println(numB62)
|
|
fmt.Println(num1B62)
|
|
num2B62 := StrTool.Bit62Add(numB62, num1B62)
|
|
num2 := StrTool.Bit62Decode(num2B62)
|
|
fmt.Println(num2B62)
|
|
fmt.Println(num2)
|
|
fmt.Println(StrTool.Bit62Add("ly7vp", "1"))
|
|
|
|
}
|
|
|
|
func FuzzStr_Bit62Encode(f *testing.F) {
|
|
f.Fuzz(func(t *testing.T, a int64) {
|
|
fmt.Println(a)
|
|
fmt.Println(StrTool.Bit62Encode(a))
|
|
})
|
|
}
|