feat:优化项目信息

This commit is contained in:
henry
2022-03-05 15:31:22 +08:00
parent dcb5948e91
commit 4dc8deaadb
27 changed files with 401 additions and 138 deletions

View File

@ -1,6 +1,7 @@
package utils
import (
"math"
"reflect"
"testing"
)
@ -19,13 +20,14 @@ func TestArrayFlip(t *testing.T) {
//d := a & b & c
//t.Log(d)
a := make([]int, 5)
t.Log(a)
t.Log(a[4])
a = append(a, []int{1, 2, 3, 4, 5, 6, 7, 8, 9}...)
t.Log(a)
t.Log(len(a))
t.Log(cap(a))
//a := make([]int, 5)
//t.Log(a)
//t.Log(a[4])
//a = append(a, []int{1, 2, 3, 4, 5, 6, 7, 8, 9}...)
//t.Log(a)
//t.Log(len(a))
//t.Log(cap(a))
t.Log(math.Sqrt(4))
}
func TestArrayStrings(t *testing.T) {

View File

@ -1,6 +1,7 @@
package utils
import (
"encoding/json"
"fmt"
"sort"
"testing"
@ -107,3 +108,19 @@ func TestCode(t *testing.T) {
t.Log(lengthOfLongestSubstring("dvdf"))
}
type ABC struct {
Key string `json:"key"`
}
func publish(src []*ABC) {
src[1].Key = "测试"
}
func TestNew(t *testing.T) {
src := []*ABC{&ABC{}, &ABC{}}
publish(src)
_bytes, _ := json.Marshal(src)
t.Log(string(_bytes))
}

View File

@ -2,6 +2,7 @@ package utils
import (
"gopkg.in/yaml.v2"
"io"
"os"
"testing"
)
@ -36,3 +37,23 @@ func TestNewFile(t *testing.T) {
return
}
}
func TestNewOpenFile(t *testing.T) {
file, err := os.Open("BizChat(1).db-shm")
if err != nil {
t.Log(err)
return
}
defer file.Close()
_bytes := make([]byte, 0)
if _bytes, err = io.ReadAll(file); err != nil {
t.Log(err)
return
}
t.Log(_bytes)
t.Log(string(_bytes[0:2]))
}

1
utils/handler.go Normal file
View File

@ -0,0 +1 @@
package utils