添加支持处理区间的工具类

This commit is contained in:
huangchengxing
2022-09-30 14:41:12 +08:00
parent 8ebe748990
commit 130dc689ba
6 changed files with 1876 additions and 0 deletions

View File

@@ -0,0 +1,211 @@
package cn.hutool.core.lang.range;
import org.junit.Assert;
import org.junit.Test;
/**
* test for {@link Bound}
*/
public class BoundTest {
@Test
public void testEquals() {
Bound<Integer> bound = new Bound.FiniteBound<>(1, BoundType.OPEN_UPPER_BOUND);
Assert.assertEquals(bound, bound);
Assert.assertEquals(bound, new Bound.FiniteBound<>(1, BoundType.OPEN_UPPER_BOUND));
Assert.assertNotEquals(bound, new Bound.FiniteBound<>(2, BoundType.OPEN_UPPER_BOUND));
Assert.assertNotEquals(bound, new Bound.FiniteBound<>(1, BoundType.OPEN_LOWER_BOUND));
Assert.assertNotEquals(bound, null);
}
@Test
public void testHashCode() {
int hashCode = new Bound.FiniteBound<>(1, BoundType.OPEN_UPPER_BOUND).hashCode();
Assert.assertEquals(hashCode, new Bound.FiniteBound<>(1, BoundType.OPEN_UPPER_BOUND).hashCode());
Assert.assertNotEquals(hashCode, new Bound.FiniteBound<>(2, BoundType.OPEN_UPPER_BOUND).hashCode());
Assert.assertNotEquals(hashCode, new Bound.FiniteBound<>(1, BoundType.OPEN_LOWER_BOUND).hashCode());
}
@Test
public void testNoneLowerBound() {
Bound<Integer> bound = Bound.noneLowerBound();
// negate
Assert.assertEquals(bound, bound.negate());
// test
Assert.assertTrue(bound.test(Integer.MAX_VALUE));
// getType
Assert.assertEquals(BoundType.OPEN_LOWER_BOUND, bound.getType());
// getValue
Assert.assertNull(bound.getValue());
// toString
Assert.assertEquals("(" + "-\u221e", bound.descBound());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(-1, bound.compareTo(Bound.atMost(1)));
Assert.assertEquals(BoundedRange.all(), bound.toRange());
Assert.assertEquals("{x | x > -\u221e}", bound.toString());
}
@Test
public void testNoneUpperBound() {
Bound<Integer> bound = Bound.noneUpperBound();
// negate
Assert.assertEquals(bound, bound.negate());
// test
Assert.assertTrue(bound.test(Integer.MAX_VALUE));
// getType
Assert.assertEquals(BoundType.OPEN_UPPER_BOUND, bound.getType());
// getValue
Assert.assertNull(bound.getValue());
// toString
Assert.assertEquals("+\u221e" + ")", bound.descBound());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(1, bound.compareTo(Bound.atMost(1)));
Assert.assertEquals(BoundedRange.all(), bound.toRange());
Assert.assertEquals("{x | x < +\u221e}", bound.toString());
}
@Test
public void testGreatThan() {
// { x | x > 0}
Bound<Integer> bound = Bound.greaterThan(0);
// test
Assert.assertTrue(bound.test(1));
Assert.assertFalse(bound.test(0));
Assert.assertFalse(bound.test(-1));
// getType
Assert.assertEquals(BoundType.OPEN_LOWER_BOUND, bound.getType());
// getValue
Assert.assertEquals((Integer)0, bound.getValue());
// toString
Assert.assertEquals("(0", bound.descBound());
Assert.assertEquals("{x | x > 0}", bound.toString());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(-1, bound.compareTo(Bound.noneUpperBound()));
Assert.assertEquals(1, bound.compareTo(Bound.atLeast(-1)));
Assert.assertEquals(-1, bound.compareTo(Bound.atLeast(2)));
Assert.assertEquals(1, bound.compareTo(Bound.lessThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.atMost(0)));
Assert.assertEquals(-1, bound.compareTo(Bound.atMost(2)));
Assert.assertEquals(1, bound.compareTo(Bound.noneLowerBound()));
// { x | x >= 0}
bound = bound.negate();
Assert.assertEquals((Integer)0, bound.getValue());
Assert.assertEquals(BoundType.CLOSE_UPPER_BOUND, bound.getType());
Assert.assertNotNull(bound.toRange());
}
@Test
public void testAtLeast() {
// { x | x >= 0}
Bound<Integer> bound = Bound.atLeast(0);
// test
Assert.assertTrue(bound.test(1));
Assert.assertTrue(bound.test(0));
Assert.assertFalse(bound.test(-1));
// getType
Assert.assertEquals(BoundType.CLOSE_LOWER_BOUND, bound.getType());
// getValue
Assert.assertEquals((Integer)0, bound.getValue());
// toString
Assert.assertEquals("[0", bound.descBound());
Assert.assertEquals("{x | x >= 0}", bound.toString());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(-1, bound.compareTo(Bound.noneUpperBound()));
Assert.assertEquals(1, bound.compareTo(Bound.greaterThan(-1)));
Assert.assertEquals(-1, bound.compareTo(Bound.greaterThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.lessThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.atMost(0)));
Assert.assertEquals(-1, bound.compareTo(Bound.atMost(2)));
Assert.assertEquals(1, bound.compareTo(Bound.noneLowerBound()));
// { x | x < 0}
bound = bound.negate();
Assert.assertEquals((Integer)0, bound.getValue());
Assert.assertEquals(BoundType.OPEN_UPPER_BOUND, bound.getType());
Assert.assertNotNull(bound.toRange());
}
@Test
public void testLessThan() {
// { x | x < 0}
Bound<Integer> bound = Bound.lessThan(0);
// test
Assert.assertFalse(bound.test(1));
Assert.assertFalse(bound.test(0));
Assert.assertTrue(bound.test(-1));
// getType
Assert.assertEquals(BoundType.OPEN_UPPER_BOUND, bound.getType());
// getValue
Assert.assertEquals((Integer)0, bound.getValue());
// toString
Assert.assertEquals("0)", bound.descBound());
Assert.assertEquals("{x | x < 0}", bound.toString());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(-1, bound.compareTo(Bound.noneUpperBound()));
Assert.assertEquals(1, bound.compareTo(Bound.greaterThan(-1)));
Assert.assertEquals(-1, bound.compareTo(Bound.greaterThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.lessThan(-1)));
Assert.assertEquals(-1, bound.compareTo(Bound.atMost(0)));
Assert.assertEquals(1, bound.compareTo(Bound.atMost(-1)));
Assert.assertEquals(1, bound.compareTo(Bound.noneLowerBound()));
// { x | x >= 0}
bound = bound.negate();
Assert.assertEquals((Integer)0, bound.getValue());
Assert.assertEquals(BoundType.CLOSE_LOWER_BOUND, bound.getType());
Assert.assertNotNull(bound.toRange());
}
@Test
public void testAtMost() {
// { x | x <= 0}
Bound<Integer> bound = Bound.atMost(0);
// test
Assert.assertFalse(bound.test(1));
Assert.assertTrue(bound.test(0));
Assert.assertTrue(bound.test(-1));
// getType
Assert.assertEquals(BoundType.CLOSE_UPPER_BOUND, bound.getType());
// getValue
Assert.assertEquals((Integer)0, bound.getValue());
// toString
Assert.assertEquals("0]", bound.descBound());
Assert.assertEquals("{x | x <= 0}", bound.toString());
// compareTo
Assert.assertEquals(0, bound.compareTo(bound));
Assert.assertEquals(-1, bound.compareTo(Bound.noneUpperBound()));
Assert.assertEquals(1, bound.compareTo(Bound.greaterThan(-1)));
Assert.assertEquals(-1, bound.compareTo(Bound.greaterThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.atMost(-1)));
Assert.assertEquals(1, bound.compareTo(Bound.lessThan(0)));
Assert.assertEquals(1, bound.compareTo(Bound.lessThan(-1)));
Assert.assertEquals(1, bound.compareTo(Bound.noneLowerBound()));
// { x | x > 0}
bound = bound.negate();
Assert.assertEquals((Integer)0, bound.getValue());
Assert.assertEquals(BoundType.OPEN_LOWER_BOUND, bound.getType());
Assert.assertNotNull(bound.toRange());
}
}

View File

@@ -0,0 +1,83 @@
package cn.hutool.core.lang.range;
import org.junit.Assert;
import org.junit.Test;
/**
* test for {@link BoundType}
*/
public class BoundTypeTest {
@Test
public void testIsDislocated() {
Assert.assertTrue(BoundType.CLOSE_LOWER_BOUND.isDislocated(BoundType.CLOSE_UPPER_BOUND));
Assert.assertTrue(BoundType.CLOSE_LOWER_BOUND.isDislocated(BoundType.OPEN_UPPER_BOUND));
Assert.assertFalse(BoundType.CLOSE_LOWER_BOUND.isDislocated(BoundType.CLOSE_LOWER_BOUND));
Assert.assertFalse(BoundType.CLOSE_LOWER_BOUND.isDislocated(BoundType.OPEN_LOWER_BOUND));
}
@Test
public void testIsLowerBound() {
Assert.assertFalse(BoundType.CLOSE_UPPER_BOUND.isLowerBound());
Assert.assertFalse(BoundType.OPEN_UPPER_BOUND.isLowerBound());
Assert.assertTrue(BoundType.CLOSE_LOWER_BOUND.isLowerBound());
Assert.assertTrue(BoundType.OPEN_LOWER_BOUND.isLowerBound());
}
@Test
public void testIsUpperBound() {
Assert.assertTrue(BoundType.CLOSE_UPPER_BOUND.isUpperBound());
Assert.assertTrue(BoundType.OPEN_UPPER_BOUND.isUpperBound());
Assert.assertFalse(BoundType.CLOSE_LOWER_BOUND.isUpperBound());
Assert.assertFalse(BoundType.OPEN_LOWER_BOUND.isUpperBound());
}
@Test
public void testIsOpen() {
Assert.assertFalse(BoundType.CLOSE_UPPER_BOUND.isOpen());
Assert.assertTrue(BoundType.OPEN_UPPER_BOUND.isOpen());
Assert.assertFalse(BoundType.CLOSE_LOWER_BOUND.isOpen());
Assert.assertTrue(BoundType.OPEN_LOWER_BOUND.isOpen());
}
@Test
public void testIsClose() {
Assert.assertTrue(BoundType.CLOSE_UPPER_BOUND.isClose());
Assert.assertFalse(BoundType.OPEN_UPPER_BOUND.isClose());
Assert.assertTrue(BoundType.CLOSE_LOWER_BOUND.isClose());
Assert.assertFalse(BoundType.OPEN_LOWER_BOUND.isClose());
}
@Test
public void testNegate() {
Assert.assertEquals(BoundType.CLOSE_UPPER_BOUND, BoundType.OPEN_LOWER_BOUND.negate());
Assert.assertEquals(BoundType.OPEN_UPPER_BOUND, BoundType.CLOSE_LOWER_BOUND.negate());
Assert.assertEquals(BoundType.OPEN_LOWER_BOUND, BoundType.CLOSE_UPPER_BOUND.negate());
Assert.assertEquals(BoundType.CLOSE_LOWER_BOUND, BoundType.OPEN_UPPER_BOUND.negate());
}
@Test
public void testGetSymbol() {
Assert.assertEquals("]", BoundType.CLOSE_UPPER_BOUND.getSymbol());
Assert.assertEquals(")", BoundType.OPEN_UPPER_BOUND.getSymbol());
Assert.assertEquals("[", BoundType.CLOSE_LOWER_BOUND.getSymbol());
Assert.assertEquals("(", BoundType.OPEN_LOWER_BOUND.getSymbol());
}
@Test
public void testGetCode() {
Assert.assertEquals(2, BoundType.CLOSE_UPPER_BOUND.getCode());
Assert.assertEquals(1, BoundType.OPEN_UPPER_BOUND.getCode());
Assert.assertEquals(-1, BoundType.OPEN_LOWER_BOUND.getCode());
Assert.assertEquals(-2, BoundType.CLOSE_LOWER_BOUND.getCode());
}
@Test
public void testGetOperator() {
Assert.assertEquals("<=", BoundType.CLOSE_UPPER_BOUND.getOperator());
Assert.assertEquals("<", BoundType.OPEN_UPPER_BOUND.getOperator());
Assert.assertEquals(">", BoundType.OPEN_LOWER_BOUND.getOperator());
Assert.assertEquals(">=", BoundType.CLOSE_LOWER_BOUND.getOperator());
}
}

View File

@@ -0,0 +1,283 @@
package cn.hutool.core.lang.range;
import org.junit.Assert;
import org.junit.Test;
/**
* test for {@link BoundedRange}
*/
public class BoundedRangeTest {
@Test
public void testEquals() {
BoundedRange<Integer> range = new BoundedRange<>(
Bound.greaterThan(0), Bound.lessThan(10)
);
Assert.assertEquals(range, range);
Assert.assertNotEquals(range, null);
Assert.assertEquals(range, new BoundedRange<>(
Bound.greaterThan(0), Bound.lessThan(10)
));
Assert.assertNotEquals(range, new BoundedRange<>(
Bound.greaterThan(1), Bound.lessThan(10)
));
}
@Test
public void testHashCode() {
int hasCode = new BoundedRange<>(
Bound.greaterThan(0), Bound.lessThan(10)
).hashCode();
Assert.assertEquals(hasCode, new BoundedRange<>(
Bound.greaterThan(0), Bound.lessThan(10)
).hashCode());
Assert.assertNotEquals(hasCode, new BoundedRange<>(
Bound.greaterThan(1), Bound.lessThan(10)
).hashCode());
}
@Test
public void testAll() {
BoundedRange<Integer> range = BoundedRange.all();
Assert.assertEquals("(-∞, +∞)", range.toString());
// getBound
Assert.assertFalse(range.hasLowerBound());
Assert.assertFalse(range.hasUpperBound());
Assert.assertNull(range.getLowerBoundValue());
Assert.assertNull(range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertTrue(range.test(Integer.MAX_VALUE));
Assert.assertTrue(range.test(Integer.MIN_VALUE));
// isXXX
Assert.assertFalse(range.isDisjoint(BoundedRange.open(0, 5)));
Assert.assertTrue(range.isEquals(range));
Assert.assertFalse(range.isEquals(BoundedRange.open(0, 5)));
Assert.assertTrue(range.isIntersected(BoundedRange.open(0, 5)));
Assert.assertTrue(range.isIntersected(range));
Assert.assertFalse(range.isSubset(BoundedRange.open(0, 5)));
Assert.assertTrue(range.isSubset(range));
Assert.assertFalse(range.isProperSubset(BoundedRange.open(0, 5)));
Assert.assertFalse(range.isProperSubset(range));
Assert.assertTrue(range.isSuperset(BoundedRange.open(0, 5)));
Assert.assertTrue(range.isSuperset(range));
Assert.assertTrue(range.isProperSuperset(BoundedRange.open(0, 5)));
Assert.assertFalse(range.isProperSuperset(range));
// operate
Assert.assertEquals(range, range.unionIfIntersected(BoundedRange.open(0, 5)));
Assert.assertEquals(range, range.span(BoundedRange.open(0, 5)));
Assert.assertNull(range.gap(BoundedRange.open(0, 5)));
Assert.assertEquals(range, range.intersection(range));
Assert.assertEquals(BoundedRange.open(0, 5), range.intersection(BoundedRange.open(0, 5)));
// sub
Assert.assertEquals("(0, +∞)", range.subGreatThan(0).toString());
Assert.assertEquals("[0, +∞)", range.subAtLeast(0).toString());
Assert.assertEquals("(-∞, 0)", range.subLessThan(0).toString());
Assert.assertEquals("(-∞, 0]", range.subAtMost(0).toString());
}
@Test
public void testOpen() {
BoundedRange<Integer> range = BoundedRange.open(0, 5);
Assert.assertEquals("(0, 5)", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertTrue(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertFalse(range.test(5));
Assert.assertTrue(range.test(3));
Assert.assertFalse(range.test(0));
Assert.assertFalse(range.test(-1));
// isXXX
Assert.assertTrue(range.isEquals(range));
Assert.assertTrue(range.isDisjoint(BoundedRange.open(-5, 0))); // (-5, 0)
Assert.assertTrue(range.isDisjoint(BoundedRange.close(-5, 0))); // [-5, 0]
Assert.assertTrue(range.isIntersected(BoundedRange.close(-5, 1))); // [-5, 1]
Assert.assertTrue(range.isSubset(BoundedRange.close(0, 5))); // [0, 5]
Assert.assertTrue(range.isProperSubset(BoundedRange.close(0, 5))); // [0, 5]
Assert.assertFalse(range.isSuperset(BoundedRange.close(0, 5))); // [0, 5]
Assert.assertFalse(range.isProperSuperset(BoundedRange.close(0, 5))); // [0, 5]
// operate
Assert.assertEquals("(0, 10]", range.unionIfIntersected(BoundedRange.close(4, 10)).toString());
Assert.assertEquals("(0, 10)", range.span(BoundedRange.open(9, 10)).toString());
Assert.assertEquals("(-2, 0]", range.gap(BoundedRange.close(-10, -2)).toString());
Assert.assertEquals("(3, 5)", range.intersection(BoundedRange.open(3, 10)).toString());
// sub
Assert.assertEquals("(3, 5)", range.subGreatThan(3).toString());
Assert.assertEquals("[3, 5)", range.subAtLeast(3).toString());
Assert.assertEquals("(0, 3)", range.subLessThan(3).toString());
Assert.assertEquals("(0, 3]", range.subAtMost(3).toString());
}
@Test
public void testClose() {
BoundedRange<Integer> range = BoundedRange.close(0, 5);
Assert.assertEquals("[0, 5]", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertTrue(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertTrue(range.test(5));
Assert.assertTrue(range.test(0));
Assert.assertFalse(range.test(-1));
// isXXX
Assert.assertTrue(range.isEquals(range));
Assert.assertTrue(range.isDisjoint(BoundedRange.open(-5, 0))); // (-5, 0)
Assert.assertTrue(range.isDisjoint(BoundedRange.close(-5, 0))); // [-5, 0]
Assert.assertTrue(range.isIntersected(BoundedRange.open(-5, 1))); // [-5, 1]
Assert.assertFalse(range.isSubset(BoundedRange.open(0, 5))); // (0, 5)
Assert.assertFalse(range.isProperSubset(BoundedRange.open(0, 5))); // (0, 5)
Assert.assertTrue(range.isSuperset(BoundedRange.open(0, 5))); // (0, 5)
Assert.assertTrue(range.isProperSuperset(BoundedRange.open(0, 5))); // (0, 5)
// operate
Assert.assertEquals("[0, 5]", range.unionIfIntersected(BoundedRange.open(5, 10)).toString());
Assert.assertEquals("[0, 10]", range.unionIfIntersected(BoundedRange.close(4, 10)).toString());
Assert.assertEquals("[0, 10)", range.span(BoundedRange.open(9, 10)).toString());
Assert.assertEquals("(-2, 0)", range.gap(BoundedRange.close(-10, -2)).toString());
Assert.assertEquals("(3, 5]", range.intersection(BoundedRange.open(3, 10)).toString());
Assert.assertNull(range.intersection(BoundedRange.open(5, 10)));
// sub
Assert.assertEquals("(3, 5]", range.subGreatThan(3).toString());
Assert.assertEquals("[3, 5]", range.subAtLeast(3).toString());
Assert.assertEquals("[0, 3)", range.subLessThan(3).toString());
Assert.assertEquals("[0, 3]", range.subAtMost(3).toString());
}
@Test
public void testOpenClose() {
BoundedRange<Integer> range = BoundedRange.openClose(0, 5);
Assert.assertEquals("(0, 5]", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertTrue(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertTrue(range.test(5));
Assert.assertFalse(range.test(0));
Assert.assertFalse(range.test(-1));
}
@Test
public void testCloseOpen() {
BoundedRange<Integer> range = BoundedRange.closeOpen(0, 5);
Assert.assertEquals("[0, 5)", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertTrue(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertFalse(range.test(5));
Assert.assertTrue(range.test(0));
Assert.assertFalse(range.test(-1));
}
@Test
public void testGreatThan() {
BoundedRange<Integer> range = BoundedRange.greaterThan(0);
Assert.assertEquals("(0, +∞)", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertFalse(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertNull(range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertTrue(range.test(6));
Assert.assertTrue(range.test(5));
Assert.assertFalse(range.test(0));
Assert.assertFalse(range.test(-1));
}
@Test
public void testAtLeast() {
BoundedRange<Integer> range = BoundedRange.atLeast(0);
Assert.assertEquals("[0, +∞)", range.toString());
// getBound
Assert.assertTrue(range.hasLowerBound());
Assert.assertFalse(range.hasUpperBound());
Assert.assertEquals((Integer)0, range.getLowerBoundValue());
Assert.assertNull(range.getUpperBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertTrue(range.test(6));
Assert.assertTrue(range.test(5));
Assert.assertTrue(range.test(0));
Assert.assertFalse(range.test(-1));
}
@Test
public void testLessThan() {
BoundedRange<Integer> range = BoundedRange.lessThan(5);
Assert.assertEquals("(-∞, 5)", range.toString());
// getBound
Assert.assertTrue(range.hasUpperBound());
Assert.assertFalse(range.hasLowerBound());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
Assert.assertNull(range.getLowerBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertFalse(range.test(5));
Assert.assertTrue(range.test(0));
Assert.assertTrue(range.test(-1));
}
@Test
public void testAtMost() {
BoundedRange<Integer> range = BoundedRange.atMost(5);
Assert.assertEquals("(-∞, 5]", range.toString());
// getBound
Assert.assertTrue(range.hasUpperBound());
Assert.assertFalse(range.hasLowerBound());
Assert.assertEquals((Integer)5, range.getUpperBoundValue());
Assert.assertNull(range.getLowerBoundValue());
// test
Assert.assertFalse(range.isEmpty());
Assert.assertFalse(range.test(6));
Assert.assertTrue(range.test(5));
Assert.assertTrue(range.test(0));
Assert.assertTrue(range.test(-1));
}
}