jedis.zadd("foo", 5.0d, "e");
Set<Tuple> range = jedis.zrevrangeByScoreWithScores("foo", 3d,
Double.NEGATIVE_INFINITY, 0, 1);
Set<Tuple> expected = new LinkedHashSet<Tuple>();
expected.add(new Tuple("c", 3.0d));
assertEquals(expected, range);
range = jedis.zrevrangeByScoreWithScores("foo", 3.5d,
Double.NEGATIVE_INFINITY, 0, 2);
expected = new LinkedHashSet<Tuple>();
expected.add(new Tuple("c", 3.0d));
expected.add(new Tuple("b", 2.0d));
assertEquals(expected, range);
range = jedis.zrevrangeByScoreWithScores("foo", 3.5d,
Double.NEGATIVE_INFINITY, 1, 1);
expected = new LinkedHashSet<Tuple>();
expected.add(new Tuple("b", 2.0d));
assertEquals(expected, range);
range = jedis.zrevrangeByScoreWithScores("foo", 4d, 2d);
expected = new LinkedHashSet<Tuple>();
expected.add(new Tuple("d", 4.0d));
expected.add(new Tuple("c", 3.0d));
expected.add(new Tuple("b", 2.0d));
assertEquals(expected, range);
// Binary
jedis.zadd(bfoo, 1d, ba);
jedis.zadd(bfoo, 10d, bb);
jedis.zadd(bfoo, 0.1d, bc);
jedis.zadd(bfoo, 2d, ba);
Set<Tuple> brange = jedis.zrevrangeByScoreWithScores(bfoo, 2d, 0d);
Set<Tuple> bexpected = new LinkedHashSet<Tuple>();
bexpected.add(new Tuple(bc, 0.1d));
bexpected.add(new Tuple(ba, 2d));
assertEquals(bexpected, brange);
brange = jedis.zrevrangeByScoreWithScores(bfoo, 2d, 0d, 0, 1);
bexpected = new LinkedHashSet<Tuple>();
bexpected.add(new Tuple(ba, 2d));
assertEquals(bexpected, brange);
brange = jedis.zrevrangeByScoreWithScores(bfoo, 2d, 0d, 1, 1);
bexpected = new LinkedHashSet<Tuple>();
bexpected.add(new Tuple(bc, 0.1d));
assertEquals(bexpected, brange);
}