We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8562e08 commit bdb2b60Copy full SHA for bdb2b60
map_test.go
@@ -1,30 +1,23 @@
1
package lrc
2
3
import (
4
- "math/rand"
5
- "sync"
6
"testing"
7
)
8
9
func TestLRMap(t *testing.T) {
10
lrmap := newIntMap()
11
12
- wg := sync.WaitGroup{}
13
-
14
- for i := 0; i < 100000; i++ {
15
- wg.Add(1)
16
- go func() {
17
- lrmap.Get(rand.Intn(10000))
18
- wg.Done()
19
- }()
+ _, exist := lrmap.Get(1)
+ if exist {
+ t.Error("should not exist")
20
}
21
22
23
24
- k := rand.Intn(10000)
25
- lrmap.Put(k, k)
26
27
28
29
- wg.Wait()
+ lrmap.Put(1, 1)
+ v, exist := lrmap.Get(1)
+ if v != 1 {
+ t.Error("not equal")
+ }
+ if !exist {
+ t.Error("should exist")
30
0 commit comments