public void testInvalidIntRange() { try { ContiguousSet.closed(2, 1); fail(); } catch (IllegalArgumentException expected) { } try { ContiguousSet.closedOpen(2, 1); fail(); } catch (IllegalArgumentException expected) { } }
public void testInvalidLongRange() { try { ContiguousSet.closed(2L, 1L); fail(); } catch (IllegalArgumentException expected) { } try { ContiguousSet.closedOpen(2L, 1L); fail(); } catch (IllegalArgumentException expected) { } }
public void testIntersection_empty() { ContiguousSet<Integer> set = ContiguousSet.closed(1, 3); ContiguousSet<Integer> emptySet = ContiguousSet.closedOpen(2, 2); assertEquals(ImmutableSet.of(), set.intersection(emptySet)); assertEquals(ImmutableSet.of(), emptySet.intersection(set)); assertEquals( ImmutableSet.of(), ContiguousSet.create(Range.closed(-5, -1), integers()) .intersection(ContiguousSet.create(Range.open(3, 64), integers()))); }
public void testCreate_empty() { assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.closedOpen(1, 1), integers())); assertEquals(ImmutableSet.of(), ContiguousSet.closedOpen(1, 1)); assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.openClosed(5, 5), integers())); assertEquals( ImmutableSet.of(), ContiguousSet.create(Range.lessThan(Integer.MIN_VALUE), integers())); assertEquals( ImmutableSet.of(), ContiguousSet.create(Range.greaterThan(Integer.MAX_VALUE), integers())); }
ContiguousSet.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()), ContiguousSet.closedOpen(1, 4), ContiguousSet.create(Range.openClosed(0, 3), integers()), ContiguousSet.create(Range.open(0, 4), integers()), .addEqualityGroup( ContiguousSet.create(Range.closedOpen(1, 1), integers()), ContiguousSet.closedOpen(1, 1), ContiguousSet.closedOpen(Integer.MIN_VALUE, Integer.MIN_VALUE), ImmutableSortedSet.of(), ImmutableSet.of())
assertEquals( Range.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()).range()); assertEquals(Range.closed(1, 3), ContiguousSet.closedOpen(1, 4).range()); assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.open(0, 4), integers()).range()); assertEquals(
public void testInvalidLongRange() { try { ContiguousSet.closed(2L, 1L); fail(); } catch (IllegalArgumentException expected) {} try { ContiguousSet.closedOpen(2L, 1L); fail(); } catch (IllegalArgumentException expected) {} }
public void testInvalidIntRange() { try { ContiguousSet.closed(2, 1); fail(); } catch (IllegalArgumentException expected) {} try { ContiguousSet.closedOpen(2, 1); fail(); } catch (IllegalArgumentException expected) {} }
public void testIntersection_empty() { ContiguousSet<Integer> set = ContiguousSet.closed(1, 3); ContiguousSet<Integer> emptySet = ContiguousSet.closedOpen(2, 2); assertEquals(ImmutableSet.of(), set.intersection(emptySet)); assertEquals(ImmutableSet.of(), emptySet.intersection(set)); assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.closed(-5, -1), integers()).intersection( ContiguousSet.create(Range.open(3, 64), integers()))); }
public void testCreate_empty() { assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.closedOpen(1, 1), integers())); assertEquals(ImmutableSet.of(), ContiguousSet.closedOpen(1, 1)); assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.openClosed(5, 5), integers())); assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.lessThan(Integer.MIN_VALUE), integers())); assertEquals(ImmutableSet.of(), ContiguousSet.create(Range.greaterThan(Integer.MAX_VALUE), integers())); }
ContiguousSet.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()), ContiguousSet.closedOpen(1, 4), ContiguousSet.create(Range.openClosed(0, 3), integers()), ContiguousSet.create(Range.open(0, 4), integers()), .addEqualityGroup( ContiguousSet.create(Range.closedOpen(1, 1), integers()), ContiguousSet.closedOpen(1, 1), ContiguousSet.closedOpen(Integer.MIN_VALUE, Integer.MIN_VALUE), ImmutableSortedSet.of(), ImmutableSet.of())
assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()).range()); assertEquals(Range.closed(1, 3), ContiguousSet.closedOpen(1, 4).range()); assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.open(0, 4), integers()).range()); assertEquals(Range.closed(1, 3),