From 34f1795a5f8a374e8b8db64d679a1e835633e717 Mon Sep 17 00:00:00 2001 From: wenyekui Date: Thu, 14 Aug 2014 16:10:07 +0800 Subject: [PATCH] modify unit test --- server/cmd_zset_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/server/cmd_zset_test.go b/server/cmd_zset_test.go index e6a6a70..8c74bdc 100644 --- a/server/cmd_zset_test.go +++ b/server/cmd_zset_test.go @@ -704,4 +704,36 @@ func TestZInterStore(t *testing.T) { t.Fatal("invalid value ", n) } } + + if _, err := c.Do("zadd", "k3", "3", "three"); err != nil { + t.Fatal(err.Error()) + } + + if n, err := ledis.Int64(c.Do("zinterstore", "out", "3", "k1", "k2", "k3", "aggregate", "sum")); err != nil { + t.Fatal(err.Error()) + } else { + if n != 0 { + t.Fatal("invalid value ", n) + } + } + + if _, err := c.Do("zadd", "k3", "3", "two"); err != nil { + t.Fatal(err.Error()) + } + + if n, err := ledis.Int64(c.Do("zinterstore", "out", "3", "k1", "k2", "k3", "aggregate", "sum", "weights", "3", "2", "2")); err != nil { + t.Fatal(err.Error()) + } else { + if n != 1 { + t.Fatal("invalid value ", n) + } + } + + if n, err := ledis.Int64(c.Do("zscore", "out", "two")); err != nil { + t.Fatal(err.Error()) + } else { + if n != 14 { + t.Fatal("invalid value ", n) + } + } }