package ciir.jfoley.chai.collections;

import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.*;

public class IntRangeTest {

  @Test
  public void testInclusive() throws Exception {
    IntRange digits = IntRange.inclusive(0,9);
    assertEquals(Arrays.asList(0,1,2,3,4,5,6,7,8,9), digits);
    assertEquals(9, digits.inclusiveEnd());
    assertEquals(10, digits.exclusiveEnd());

    assertEquals(Arrays.asList(7,8,9), IntRange.inclusive(7,9));
  }

  @Test
  public void testExclusive() throws Exception {
    IntRange digits = IntRange.exclusive(0,4);
    assertEquals(Arrays.asList(0,1,2,3), digits);
    assertEquals(Arrays.asList(2,3), IntRange.exclusive(2,4));
  }
}
@@ -576,12 +576,13 @@
 e(0,
+ 
 4);%0A
-
     
@@ -685,17 +685,640 @@
 usive(2,
-4
+ 4));%0A  %7D%0A%0A  @Test%0A  public void intersects() %7B%0A    IntRange a = IntRange.exclusive(0, 4);%0A    IntRange b = IntRange.exclusive(2, 6);%0A    IntRange c = IntRange.exclusive(4, 8);%0A    IntRange d = IntRange.exclusive(6, 10);%0A    assertFalse(a.intersects(c));%0A    assertFalse(c.intersects(a));%0A%0A    assertFalse(a.intersects(d));%0A    assertFalse(d.intersects(a));%0A%0A    assertFalse(b.intersects(d));%0A    assertFalse(d.intersects(b));%0A%0A    assertTrue(a.intersects(b));%0A    assertTrue(b.intersects(a));%0A%0A    assertTrue(b.intersects(c));%0A    assertTrue(c.intersects(b));%0A%0A    assertTrue(c.intersects(d));%0A    assertTrue(d.intersects(c
 ));%0A  %7D%0A

Test IntRange.intersects