代码拉取完成,页面将自动刷新
同步操作将从 开源中国/git-repo-clean 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package main
import (
"testing"
)
func TestUnitConvert(t *testing.T) {
var Data_t = []struct {
input string
expected uint64
}{
{"0B,", 0},
{"123b", 123},
{"1k", 1024},
{"1000K", 1000 * 1024},
{"1M", 1024 * 1024},
{"1G", 1024 * 1024 * 1024},
{"4g", 4 * 1024 * 1024 * 1024},
}
for _, data := range Data_t {
out, _ := UnitConvert(data.input)
if out != data.expected {
t.Errorf("test UnitConvert error: expect: %v actual: %v", data.expected, out)
}
}
}
func TestShowScanResult(t *testing.T) {
var Data_t = []HistoryRecord{
// for test, the first one is the biggest one
{"4fd1482c27853b935c11108688f63e3f4f0f9c80", 100000, "loooooooooooooooooooooooooong file"},
{"e288c8793273629cf7a0679f4410eaf74c7108f0", 10, "short file1"},
{"5266b09a8b363e8c50ec25488c821c441c3809a0", 100, "looooooong file"},
{"4fd1482c27853b935c11108688f63e3f4f0f9c80", 1000, "looooooooooooooong file"},
}
ShowScanResult(Data_t)
}
func TestEndcodePath(t *testing.T) {
var Data_t = []struct {
input string
expected string
}{
{"dir/sub", "dir/sub"},
{"顶级\\\\次级", "顶级\\次级"},
}
for _, data := range Data_t {
actual := EndcodePath(data.input)
if data.expected != actual {
t.Errorf("test UnitConvert error: expect: %v actual: %v", data.expected, actual)
}
}
}
func TestTrimeDoubleQuote(t *testing.T) {
var Data_t = []struct {
input string
expected string
}{
{"\"quoted\"", "quoted"},
{"non-quoted", "non-quoted"},
}
for _, data := range Data_t {
actual := TrimeDoubleQuote(data.input)
if data.expected != actual {
t.Errorf("test UnitConvert error: expect: %v actual: %v", data.expected, actual)
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。