package com.github.lwhite1.tablesaw.util.collections;

import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import com.google.common.collect.TreeRangeSet;
import org.junit.Test;

import java.util.Set;

import static org.junit.Assert.*;

/**
 *
 */
public class IntTreeRangeSetTest {

  IntTreeRangeSet intTreeRangeSet = IntTreeRangeSet.create();
  TreeRangeSet<Integer> treeRangeSet = TreeRangeSet.create();

  @Test
  public void testAdd() {
    intTreeRangeSet.add(IntRange.closed(0, 4));
    treeRangeSet.add(Range.closed(0, 4));
    System.out.println(intTreeRangeSet);
    System.out.println(treeRangeSet);

    intTreeRangeSet.add(IntRange.open(5, 7));
    treeRangeSet.add(Range.open(5, 7));
    System.out.println(intTreeRangeSet);
    System.out.println(treeRangeSet);

    intTreeRangeSet.add(IntRange.closedOpen(4, 5));
    treeRangeSet.add(Range.closedOpen(4, 5));
    System.out.println(intTreeRangeSet);
    System.out.println(treeRangeSet);

    IntRange intSpan = intTreeRangeSet.span();
    Range<Integer> span = treeRangeSet.span();
    System.out.println(intSpan);
    System.out.println(span);

    assertEquals(IntRange.closedOpen(0, 7), intSpan);
    Set<IntRange> ranges = intTreeRangeSet.asRanges();
    assertEquals(2, ranges.size());

    IntRangeSet intComplement = intTreeRangeSet.complement();
    RangeSet<Integer> complement = treeRangeSet.complement();
    System.out.println(intComplement);
    System.out.println(complement);

    System.out.println(intTreeRangeSet);
  }

}
@@ -266,17 +266,52 @@
 %0A%0A/**%0A *
+  Tests for primitive int rangesets
 %0A
-
  */%0Apubl
@@ -344,16 +344,24 @@
 st %7B%0A%0A  
+private 
 IntTreeR
@@ -414,16 +414,24 @@
 te();%0A  
+private 
 TreeRang
@@ -606,24 +606,26 @@
 (0, 4));%0A   
+//
  System.out.
@@ -645,32 +645,34 @@
 eeRangeSet);%0A   
+//
  System.out.prin
@@ -773,32 +773,34 @@
 pen(5, 7));%0A    
+//
 System.out.print
@@ -816,32 +816,34 @@
 eRangeSet);%0A    
+//
 System.out.print
@@ -959,24 +959,26 @@
 4, 5));%0A    
+//
 System.out.p
@@ -998,32 +998,34 @@
 eRangeSet);%0A    
+//
 System.out.print
@@ -1133,32 +1133,34 @@
 Set.span();%0A    
+//
 System.out.print
@@ -1172,24 +1172,26 @@
 tSpan);%0A    
+//
 System.out.p
@@ -1475,24 +1475,26 @@
 ment();%0A    
+//
 System.out.p
@@ -1516,24 +1516,26 @@
 ement);%0A    
+//
 System.out.p
@@ -1554,21 +1554,22 @@
 ement);%0A
-%0A
     
+//
 System.o
@@ -1601,10 +1601,9 @@
 t);%0A  %7D%0A
-%0A
 %7D

clean up test output