mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-22 22:40:30 +08:00
增加固定Map定义
This commit is contained in:
26
internal/utils/maps/map_fixed_test.go
Normal file
26
internal/utils/maps/map_fixed_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package maputils_test
|
||||
|
||||
import (
|
||||
maputils "github.com/TeaOSLab/EdgeNode/internal/utils/maps"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewFixedMap(t *testing.T) {
|
||||
var m = maputils.NewFixedMap[string, int](3)
|
||||
m.Put("a", 1)
|
||||
t.Log(m.RawMap())
|
||||
t.Log(m.Get("a"))
|
||||
t.Log(m.Get("b"))
|
||||
|
||||
m.Put("b", 2)
|
||||
m.Put("c", 3)
|
||||
t.Log(m.RawMap(), m.Keys())
|
||||
|
||||
m.Put("d", 4)
|
||||
t.Log(m.RawMap(), m.Keys())
|
||||
|
||||
m.Put("b", 200)
|
||||
t.Log(m.RawMap(), m.Keys())
|
||||
}
|
||||
Reference in New Issue
Block a user