mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
add some unittest
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"github.com/hdt3213/godis/lib/utils"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -267,3 +268,14 @@ func TestConcurrentRandomKey(t *testing.T) {
|
||||
t.Errorf("get duplicated keys in result")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConcurrentDict_Keys(t *testing.T) {
|
||||
d := MakeConcurrent(0)
|
||||
size := 10
|
||||
for i := 0; i < size; i++ {
|
||||
d.Put(utils.RandString(5), utils.RandString(5))
|
||||
}
|
||||
if len(d.Keys()) != size {
|
||||
t.Errorf("expect %d keys, actual: %d", size, len(d.Keys()))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user