@Test(expected = UnsupportedOperationException.class) public void addAll2() throws Exception { Set<Integer> hashSet = new HashSet<>(); hashSet.add(1); hashSet.add(4); RangeSet rs = new RangeSet(4); rs.addAll(hashSet); }
@Test(expected = UnsupportedOperationException.class) public void add1() throws Exception { RangeSet rs = new RangeSet(4); rs.add(Integer.valueOf(1)); }
@Test(expected = UnsupportedOperationException.class) public void testRemoveAll() throws Exception { IntSet rs = new RangeSet(6); es.removeAll(rs); }
@Test(expected = UnsupportedOperationException.class) public void remove() throws Exception { RangeSet rs = new RangeSet(4); rs.remove(1); }
@Test public void intStream() throws Exception { IntSet rs = new RangeSet(5); assertEquals(10, rs.intStream().sum()); }
@Test public void forEachObject() { IntSet rs = new RangeSet(4); Set<Integer> results = new HashSet<>(); rs.forEach((Consumer<? super Integer>) results::add); assertEquals(4, results.size()); assertTrue(results.contains(0)); assertTrue(results.contains(1)); assertTrue(results.contains(2)); assertTrue(results.contains(3)); }
@Test public void forEachPrimitive() { IntSet rs = new RangeSet(4); Set<Integer> results = new HashSet<>(); rs.forEach((IntConsumer) results::add); assertEquals(4, results.size()); assertTrue(results.contains(0)); assertTrue(results.contains(1)); assertTrue(results.contains(2)); assertTrue(results.contains(3)); }
@Test public void contains1() throws Exception { RangeSet rs = new RangeSet(4); assertFalse(rs.contains(Integer.valueOf(5))); assertTrue(rs.contains(Integer.valueOf(1))); }
@Test(expected = UnsupportedOperationException.class) public void testRemoveAll() throws Exception { IntSet sis = new SingletonIntSet(3); IntSet rs = new RangeSet(6); sis.removeAll(rs); }
@Test(expected = UnsupportedOperationException.class) public void addAll1() throws Exception { RangeSet rs = new RangeSet(4); SmallIntSet sis = new SmallIntSet(); rs.addAll(sis); }
@Test(expected = UnsupportedOperationException.class) public void removeAll1() throws Exception { RangeSet rs = new RangeSet(5); SmallIntSet sis = new SmallIntSet(); rs.removeAll(sis); }
@Test(expected = UnsupportedOperationException.class) public void retainAll1() throws Exception { IntSet rs = new RangeSet(5); SmallIntSet sis = new SmallIntSet(); rs.retainAll(sis); }
@Test public void testAddAll1() throws Exception { IntSet rangeSet = new RangeSet(4); intSet.addAll(rangeSet); assertEquals(4, intSet.size()); }
@Test public void testRemoveAll1() throws Exception { intSet.add(1); intSet.add(4); intSet.add(7); assertEquals(3, intSet.size()); // (1 - 4) IntSet rs = new RangeSet(5); assertTrue(intSet.removeAll(rs)); assertEquals(CollectionFactory.makeSet((Object) 7), intSet); }
@Test public void testContainsAll() throws Exception { IntSet sis2 = new SingletonIntSet(3); assertFalse(es.containsAll(sis2)); assertTrue(sis2.containsAll(es)); IntSet sis3 = new RangeSet(0); assertTrue(sis3.containsAll(es)); assertTrue(es.containsAll(sis3)); }
@Test public void testContainsAll() throws Exception { IntSet sis = new SingletonIntSet(3); IntSet sis2 = new SingletonIntSet(3); assertTrue(sis.containsAll(sis2)); assertTrue(sis2.containsAll(sis)); IntSet sis3 = new RangeSet(4); assertTrue(sis3.containsAll(sis)); assertFalse(sis.containsAll(sis3)); }