void () { LongRangeSet set = modRange(0, 24, 10, 0b111100); assertEquals("{2..24}: <2, 3, 4, 5> mod 10", set.toString()); Set<Integer> members = Set.of(2, 3, 4, 5, 12, 13, 14, 15, 22, 23, 24); assertFalse(set.contains(-1)); assertFalse(set.contains(26)); assertEquals(members, set.stream().mapToObj(val -> (int)val).collect(Collectors.toSet())); assertTrue(set.contains(range(2, 5))); assertFalse(set.contains(range(2, 6))); assertTrue(set.contains(range(12, 15))); assertFalse(set.contains(range(11, 15))); assertTrue(set.contains(modRange(0, 25, 10, 0b11000))); assertFalse(set.contains(modRange(0, 23, 10, 0b11001))); LongRangeSet wrappedSet = modRange(0, 24, 10, 0b1110000011); assertTrue(wrappedSet.contains(range(8, 10))); assertTrue(wrappedSet.contains(range(7, 11))); assertFalse(wrappedSet.contains(range(6, 11))); assertFalse(wrappedSet.contains(range(7, 12))); LongRangeSet byFour = modRange(0, 100, 4, 0b0111); assertFalse(byFour.contains(range(0, 70))); assertTrue(byFour.contains(modRange(0, 70, 4, 0b0001))); assertTrue(byFour.contains(modRange(0, 70, 2, 0b01))); assertFalse(byFour.contains(modRange(0, 70, 2, 0b10))); assertFalse(byFour.contains(modRange(0, 70, 6, 0b011101))); assertTrue(byFour.contains(modRange(0, 70, 6, 0b010001))); }