use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method rangeEndsAfterTest.
@Test
public void rangeEndsAfterTest() {
final Range former = Range.between(1, 5);
final Range latter = Range.between(1, 6);
assertTrue("latter should end after former", latter.endsAfter(former));
assertTrue("former shouldn't end after latter", !former.endsAfter(latter));
assertTrue("no overlap allowed", !Range.between(0, 10).endsAfter(Range.between(5, 10)));
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method restrictTo_notInterstecting.
@Test
public void restrictTo_notInterstecting() {
Range r1 = Range.between(5, 10);
Range r2 = Range.between(15, 20);
Range r3 = r1.restrictTo(r2);
assertTrue("Non-intersecting ranges should produce an empty result", r3.isEmpty());
Range r4 = r2.restrictTo(r1);
assertTrue("Non-intersecting ranges should produce an empty result", r4.isEmpty());
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method rangeStartsBeforeTest.
@Test
public void rangeStartsBeforeTest() {
final Range former = Range.between(0, 5);
final Range latter = Range.between(1, 5);
assertTrue("former should starts before latter", former.startsBefore(latter));
assertTrue("latter shouldn't start before latter", !latter.startsBefore(former));
assertTrue("no overlap allowed", !Range.between(0, 5).startsBefore(Range.between(0, 10)));
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method rangeStartsAfterTest.
@Test
public void rangeStartsAfterTest() {
final Range former = Range.between(0, 5);
final Range latter = Range.between(5, 10);
assertTrue("latter should start after former", latter.startsAfter(former));
assertTrue("former shouldn't start after latter", !former.startsAfter(latter));
assertTrue("no overlap allowed", !Range.between(5, 10).startsAfter(Range.between(0, 6)));
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method expand_negativeLegal.
@Test
public void expand_negativeLegal() {
Range r1 = Range.between(5, 10);
Range r2 = r1.expand(-2, -2);
assertEquals(Range.between(7, 8), r2);
Range r3 = r1.expand(-3, -2);
assertEquals(Range.between(8, 8), r3);
Range r4 = r1.expand(3, -8);
assertEquals(Range.between(2, 2), r4);
}
Aggregations