增加测试用例

This commit is contained in:
GoEdgeLab
2023-11-06 18:36:11 +08:00
parent d9a4a170a7
commit 19d6ef4703

View File

@@ -6,6 +6,7 @@ import (
"github.com/TeaOSLab/EdgeNode/internal/caches" "github.com/TeaOSLab/EdgeNode/internal/caches"
"github.com/TeaOSLab/EdgeNode/internal/zero" "github.com/TeaOSLab/EdgeNode/internal/zero"
"github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/assert"
"github.com/iwind/TeaGo/rands" "github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types" "github.com/iwind/TeaGo/types"
stringutil "github.com/iwind/TeaGo/utils/string" stringutil "github.com/iwind/TeaGo/utils/string"
@@ -112,6 +113,18 @@ func TestFileListHashMap_Load(t *testing.T) {
} }
} }
func TestFileListHashMap_Delete(t *testing.T) {
var a = assert.NewAssertion(t)
var m = caches.NewFileListHashMap()
m.SetIsReady(true)
m.SetIsAvailable(true)
m.Add("a")
a.IsTrue(m.Len() == 1)
m.Delete("a")
a.IsTrue(m.Len() == 0)
}
func Benchmark_BigInt(b *testing.B) { func Benchmark_BigInt(b *testing.B) {
var hash = stringutil.Md5("123456") var hash = stringutil.Md5("123456")
b.ResetTimer() b.ResetTimer()