github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/agents/ip_cache_map_test.go (about) 1 // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package agents 4 5 import ( 6 "github.com/iwind/TeaGo/logs" 7 "testing" 8 ) 9 10 func TestNewIPCacheMap(t *testing.T) { 11 var cacheMap = NewIPCacheMap(3) 12 13 t.Log("====") 14 cacheMap.Add("1") 15 cacheMap.Add("2") 16 logs.PrintAsJSON(cacheMap.m, t) 17 logs.PrintAsJSON(cacheMap.list, t) 18 19 t.Log("====") 20 cacheMap.Add("3") 21 logs.PrintAsJSON(cacheMap.m, t) 22 logs.PrintAsJSON(cacheMap.list, t) 23 24 t.Log("====") 25 cacheMap.Add("4") 26 logs.PrintAsJSON(cacheMap.m, t) 27 logs.PrintAsJSON(cacheMap.list, t) 28 29 t.Log("====") 30 cacheMap.Add("3") 31 logs.PrintAsJSON(cacheMap.m, t) 32 logs.PrintAsJSON(cacheMap.list, t) 33 }