Srki Rakic
07/08/2021, 1:55 AMlistOf(localDate: LocalDate)
if one date is in the past, the function should return false. I see that Arb.localDate
takes a min and max date, but what I’d like is to have a mix of valid and invalid dates, or empty list. How would I setup that property test?
Shouldn’t this pass?
test("debug") {
Arb.list(
Arb.localDate(maxDate = LocalDate.now().minusDays(30)),
1..6
).merge(
Arb.list(
Arb.localDate(minDate = LocalDate.now().plusDays(30)),
0..6
)
).forAll {
it.any { date -> date.isBefore(LocalDate.now()) }
}
}
This should have at least one date in the past?Emil Kantis
07/08/2021, 6:00 AMArb.localDate().withEdgecases(LocalDate.now(), LocalDate.now().minusDays(1))
Srki Rakic
07/08/2021, 12:32 PMEmil Kantis
07/08/2021, 1:21 PMforAll
means that every arbitrarily generated list must pass the condition. You have 2 list generators, one which will always generate 1-6 dates before today, and one which will generate 0-6 dates after today. The last generator will generate failing inputsSrki Rakic
07/08/2021, 1:57 PM