aliyunpan/internal/utils/utils_test.go

54 lines
1.3 KiB
Go
Raw Normal View History

2021-10-24 22:25:40 +08:00
package utils
import (
"fmt"
"testing"
"time"
)
func TestConvertTime(t *testing.T) {
seconds := time.Duration(50) * time.Second
fmt.Println(ConvertTime(seconds))
seconds = time.Duration(150) * time.Second
fmt.Println(ConvertTime(seconds))
seconds = time.Duration(3600) * time.Second
fmt.Println(ConvertTime(seconds))
seconds = time.Duration(1246852) * time.Second
fmt.Println(ConvertTime(seconds))
}
2022-05-24 19:56:06 +08:00
func TestUuidStr(t *testing.T) {
fmt.Println(UuidStr())
}
2022-06-01 21:55:03 +08:00
func TestMd5Str(t *testing.T) {
fmt.Println(Md5Str("123456"))
}
2022-06-04 13:20:33 +08:00
func TestParseTimeStr(t *testing.T) {
fmt.Println(ParseTimeStr(""))
}
func TestIsAbsPath_ReturnTrue(t *testing.T) {
fmt.Println(IsLocalAbsPath("D:\\my\\folder\\test"))
}
func TestIsAbsPath_ReturnFalse(t *testing.T) {
fmt.Println(IsLocalAbsPath("my\\folder\\test"))
}
func TestResizeUploadBlockSize_ReturnDefaultBlockSize(t *testing.T) {
MB := int64(1024 * 1024) // 1048576
fileSize := int64(1073741824) // 90GB
fmt.Println(ResizeUploadBlockSize(fileSize, 10*MB)) // 10485760 = 10240KB
}
func TestResizeUploadBlockSize_ReturnNewBlockSize(t *testing.T) {
MB := int64(1024 * 1024) // 1048576
fileSize := int64(107374182400) // 100GB
fmt.Println(ResizeUploadBlockSize(fileSize, 10*MB)) // 10737664 = 10486KB
}