add unit test

This commit is contained in:
wenyekui 2014-08-13 10:26:35 +08:00
parent e1a2ebc27a
commit 87fdc9125e
2 changed files with 21 additions and 0 deletions

View File

@ -995,6 +995,9 @@ func (db *DB) ZInterStore(destKey []byte, srcKeys [][]byte, weights []int64, agg
}
}
if _, err := db.zIncrSize(t, destKey, num); err != nil {
return 0, err
}
//todo add binlog
if err := t.Commit(); err != nil {
return 0, err

View File

@ -314,6 +314,16 @@ func TestZUnionStore(t *testing.T) {
if v != 4 {
t.Fatal("invalid value ", v)
}
pairs, _ := db.ZRange(out, 0, -1)
n, err = db.ZCount(out, 0, 0XFFFE)
if err != nil {
t.Fatal(err.Error())
}
if n != 3 {
t.Fatal("invalid value ", v)
}
}
func TestZInterStore(t *testing.T) {
@ -365,4 +375,12 @@ func TestZInterStore(t *testing.T) {
t.Fatal("invalid value ", v)
}
n, err = db.ZCount(out, 0, 0XFFFF)
if err != nil {
t.Fatal(err.Error())
}
if n != 1 {
t.Fatal("invalid value ", n)
}
}