增加管理后台

This commit is contained in:
bjd
2020-12-16 16:36:56 +08:00
parent 31b1f12dbe
commit a9584000c6
68 changed files with 2408 additions and 1281 deletions

29
pkg/utils/util_test.go Normal file
View File

@@ -0,0 +1,29 @@
package utils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestInArrStr(t *testing.T) {
assert := assert.New(t)
arr := []string{"a", "b", "c"}
assert.True(InArrStr(arr, "b"))
assert.False(InArrStr(arr, "d"))
}
func TestHumanByte(t *testing.T) {
assert := assert.New(t)
var s string
s = HumanByte(999)
assert.Equal(s, "999.00 B")
s = HumanByte(10256)
assert.Equal(s, "10.02 KB")
s = HumanByte(99 * 1024 * 1024)
assert.Equal(s, "99.00 MB")
s = HumanByte(1023 * 1024 * 1024)
assert.Equal(s, "1023.00 MB")
s = HumanByte(1024 * 1024 * 1024)
assert.Equal(s, "1.00 GB")
}