public void testInvalidIntRange() { try { ContiguousSet.closed(2, 1); fail(); } catch (IllegalArgumentException expected) { } try { ContiguousSet.closedOpen(2, 1); fail(); } catch (IllegalArgumentException expected) { } }
public void testPowerSetCreationErrors() { try { Set<Set<Character>> unused = powerSet( newHashSet( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5')); fail(); } catch (IllegalArgumentException expected) { } try { Set<Set<Integer>> unused = powerSet(ContiguousSet.closed(0, Integer.MAX_VALUE / 2)); fail(); } catch (IllegalArgumentException expected) { } try { powerSet(singleton(null)); fail(); } catch (NullPointerException 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()))); }
.addEqualityGroup( ContiguousSet.create(Range.closed(1, 3), integers()), ContiguousSet.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()), ContiguousSet.closedOpen(1, 4), ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.<Integer>all(), integers())); assertEquals( ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.atLeast(Integer.MIN_VALUE), integers())); assertEquals( ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.atMost(Integer.MAX_VALUE), integers()));
public void testRange() { assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.closed(1, 3), integers()).range()); assertEquals(Range.closed(1, 3), ContiguousSet.closed(1, 3).range()); assertEquals( Range.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()).range());
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()))); }
.addEqualityGroup( ContiguousSet.create(Range.closed(1, 3), integers()), ContiguousSet.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()), ContiguousSet.closedOpen(1, 4), ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.<Integer>all(), integers())); assertEquals( ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.atLeast(Integer.MIN_VALUE), integers())); assertEquals( ContiguousSet.closed(Integer.MIN_VALUE, Integer.MAX_VALUE), ContiguousSet.create(Range.atMost(Integer.MAX_VALUE), integers()));
public void testRange() { assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.closed(1, 3), integers()).range()); assertEquals(Range.closed(1, 3), ContiguousSet.closed(1, 3).range()); assertEquals(Range.closed(1, 3), ContiguousSet.create(Range.closedOpen(1, 4), integers()).range());