Search in sources :

Example 1 with CDateSet

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}");
}
Also used : CDateSet(com.bakdata.conquery.models.common.CDateSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with CDateSet

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));
}
Also used : CDateSet(com.bakdata.conquery.models.common.CDateSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with CDateSet

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));
}
Also used : CDateSet(com.bakdata.conquery.models.common.CDateSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with CDateSet

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));
}
Also used : CDateSet(com.bakdata.conquery.models.common.CDateSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with CDateSet

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);
}
Also used : CDateSet(com.bakdata.conquery.models.common.CDateSet) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

CDateSet (com.bakdata.conquery.models.common.CDateSet)22 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 Test (org.junit.jupiter.api.Test)9 ArrayList (java.util.ArrayList)4 CDateRange (com.bakdata.conquery.models.common.daterange.CDateRange)3 DateContext (com.bakdata.conquery.models.forms.util.DateContext)3 Aggregator (com.bakdata.conquery.models.query.queryplan.aggregators.Aggregator)3 OptionalInt (java.util.OptionalInt)3 EntityResult (com.bakdata.conquery.models.query.results.EntityResult)2 MultilineEntityResult (com.bakdata.conquery.models.query.results.MultilineEntityResult)2 List (java.util.List)2 Getter (lombok.Getter)2 ExportForm (com.bakdata.conquery.apiv1.forms.export_form.ExportForm)1 CQElement (com.bakdata.conquery.apiv1.query.CQElement)1 CQTable (com.bakdata.conquery.apiv1.query.concept.filter.CQTable)1 FilterValue (com.bakdata.conquery.apiv1.query.concept.filter.FilterValue)1 CPSType (com.bakdata.conquery.io.cps.CPSType)1 InternalOnly (com.bakdata.conquery.io.jackson.InternalOnly)1 NsIdRefCollection (com.bakdata.conquery.io.jackson.serializer.NsIdRefCollection)1 LocaleConfig (com.bakdata.conquery.models.config.LocaleConfig)1