use of com.bakdata.conquery.models.common.CDateSet in project conquery by bakdata.
the class CDateSetTest method testRemove.
@Test
public void testRemove() {
CDateSet set = CDateSet.create();
set.add(CDateRange.of(LocalDate.of(2000, 1, 1), LocalDate.of(2000, 12, 31)));
set.remove(CDateRange.of(LocalDate.of(2000, 6, 1), LocalDate.of(2000, 6, 20)));
assertThat(set).hasToString("{2000-01-01/2000-05-31, 2000-06-21/2000-12-31}");
}
use of com.bakdata.conquery.models.common.CDateSet in project conquery by bakdata.
the class CDateSetTest method testMaskedAddAtLeastMaskMultiple.
@Test
public void testMaskedAddAtLeastMaskMultiple() {
CDateSet set = CDateSet.create();
CDateSet mask = CDateSet.create(List.of(CDateRange.of(-10, -5), CDateRange.of(1, 10), CDateRange.atLeast(30)));
set.maskedAdd(CDateRange.atLeast(5), mask);
assertThat(set.asRanges()).containsExactly(CDateRange.of(5, 10), CDateRange.atLeast(30));
}
use of com.bakdata.conquery.models.common.CDateSet in project conquery by bakdata.
the class CDateSetTest method testMaskedAddAtLeastMaskClosed.
@Test
public void testMaskedAddAtLeastMaskClosed() {
CDateSet set = CDateSet.create();
CDateSet mask = CDateSet.create(CDateRange.of(-10, 10));
set.maskedAdd(CDateRange.atLeast(5), mask);
assertThat(set.asRanges()).containsExactly(CDateRange.of(5, 10));
}
use of com.bakdata.conquery.models.common.CDateSet in project conquery by bakdata.
the class CDateSetTest method testMaskedAddNoIntersection.
@Test
public void testMaskedAddNoIntersection() {
CDateSet set = CDateSet.create();
CDateSet mask = CDateSet.create(CDateRange.atLeast(4));
set.maskedAdd(CDateRange.of(-5, 5), mask);
assertThat(set.asRanges()).containsExactly(CDateRange.of(4, 5));
}
use of com.bakdata.conquery.models.common.CDateSet in project conquery by bakdata.
the class CDateSetTest method parse.
@ParameterizedTest(name = "{0}")
@MethodSource("argumentsParsing")
public void parse(String input, CDateSet expected) {
CDateSet set = config.getLocale().getDateReader().parseToCDateSet(input);
assertThat(set).isEqualTo(expected);
}
Aggregations