fix test file

This commit is contained in:
Xiang Li 2013-08-05 21:28:42 -07:00
parent d239e5e0dd
commit 65c34457de
3 changed files with 14 additions and 23 deletions

View File

@ -150,7 +150,7 @@ func BenchmarkStoreSet(b *testing.B) {
func BenchmarkStoreGet(b *testing.B) {
s := CreateStore(100)
keys := GenKeys(100, 5)
keys := GenKeys(10000, 5)
for i, key := range keys {
s.Set(key, "barbarbarbarbar", time.Unix(0, 0), uint64(i))

View File

@ -11,7 +11,7 @@ func GenKeys(num int, depth int) []string {
for i := 0; i < num; i++ {
keys[i] = "/foo/"
depth := rand.Intn(depth)
depth := rand.Intn(depth) + 1
for j := 0; j < depth; j++ {
keys[i] += "/" + strconv.Itoa(rand.Int())

View File

@ -1,7 +1,7 @@
package store
import (
"fmt"
//"fmt"
"math/rand"
"strconv"
"testing"
@ -64,20 +64,20 @@ func TestStoreGet(t *testing.T) {
ts.set("/hello/fooo", NewTestNode("barbarbar"))
ts.set("/hello/foooo/foo", NewTestNode("barbarbar"))
nodes, keys, ok := ts.list("/hello")
//nodes, keys, ok := ts.list("/hello")
if !ok {
t.Fatalf("cannot list!")
} else {
nodes, _ := nodes.([]*Node)
length := len(nodes)
// if !ok {
// t.Fatalf("cannot list!")
// } else {
// nodes, _ := nodes.([]*Node)
// length := len(nodes)
for i := 0; i < length; i++ {
fmt.Println(keys[i], "=", nodes[i].Value)
}
}
// for i := 0; i < length; i++ {
// fmt.Println(keys[i], "=", nodes[i].Value)
// }
// }
keys = GenKeys(100, 10)
keys := GenKeys(100, 10)
for i := 0; i < 100; i++ {
value := strconv.Itoa(rand.Int())
@ -206,15 +206,6 @@ func BenchmarkTreeStoreCopy(b *testing.B) {
}
}
func BenchmarkMakeSlice(b *testing.B) {
for i := 0; i < b.N; i++ {
for i := 0; i < 100000; i++ {
_ = make([]Node, 1)
}
}
}
func BenchmarkTreeStoreList(b *testing.B) {
keys := GenKeys(10000, 10)