新版IP库管理阶段性提交(未完成)

This commit is contained in:
GoEdgeLab
2022-08-13 23:55:48 +08:00
parent 0388d6c557
commit 0e411ff59f
42 changed files with 2628 additions and 172 deletions

View File

@@ -1,22 +1,30 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package utils
package utils_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/utils"
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestSplitStrings(t *testing.T) {
t.Log(SplitStrings("a, b, c", ","))
t.Log(SplitStrings("a, b, c, ", ","))
t.Log(utils.SplitStrings("a, b, c", ","))
t.Log(utils.SplitStrings("a, b, c, ", ","))
}
func TestContainsStringInsensitive(t *testing.T) {
var a = assert.NewAssertion(t)
a.IsTrue(ContainsStringInsensitive([]string{"a", "b", "C"}, "A"))
a.IsTrue(ContainsStringInsensitive([]string{"a", "b", "C"}, "b"))
a.IsTrue(ContainsStringInsensitive([]string{"a", "b", "C"}, "c"))
a.IsFalse(ContainsStringInsensitive([]string{"a", "b", "C"}, "d"))
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "A"))
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "b"))
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "c"))
a.IsFalse(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "d"))
}
func TestSimilar(t *testing.T) {
t.Log(utils.Similar("", ""))
t.Log(utils.Similar("", "a"))
t.Log(utils.Similar("abc", "bcd"))
t.Log(utils.Similar("efgj", "hijk"))
t.Log(utils.Similar("efgj", "klmn"))
}