use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testRemoveLexRangeTail.
@Test
public void testRemoveLexRangeTail() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
Assertions.assertTrue(set.add("a"));
Assertions.assertFalse(set.add("a"));
Assertions.assertTrue(set.add("b"));
Assertions.assertTrue(set.add("c"));
Assertions.assertTrue(set.add("d"));
Assertions.assertTrue(set.add("e"));
Assertions.assertTrue(set.add("f"));
Assertions.assertTrue(set.add("g"));
Assertions.assertEquals(0, (int) set.removeRangeTail("z", false));
Assertions.assertEquals(4, (int) set.removeRangeTail("c", false));
assertThat(set).containsExactly("a", "b", "c");
Assertions.assertEquals(1, (int) set.removeRangeTail("c", true));
assertThat(set).containsExactly("a", "b");
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testLexRangeReversed.
@Test
public void testLexRangeReversed() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
set.add("e");
set.add("f");
set.add("g");
assertThat(set.rangeReversed("aaa", true, "g", false)).containsExactly("f", "e", "d", "c", "b");
assertThat(set.rangeReversed("aaa", true, "g", false, 1, 2)).containsExactly("e", "d");
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testFirstLast.
@Test
public void testFirstLast() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
Assertions.assertEquals("a", set.first());
Assertions.assertEquals("d", set.last());
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testLexCount.
@Test
public void testLexCount() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
set.add("e");
set.add("f");
set.add("g");
assertThat(set.count("b", true, "f", true)).isEqualTo(5);
assertThat(set.count("b", false, "f", false)).isEqualTo(3);
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testPollLast.
@Test
public void testPollLast() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
Assertions.assertNull(set.pollLast());
set.add("a");
set.add("b");
set.add("c");
Assertions.assertEquals("c", set.pollLast());
assertThat(set).containsExactly("a", "b");
}
Aggregations