vieter/src/cron/expression_test.v

40 lines
730 B
Coq
Raw Normal View History

2022-04-12 14:22:40 +02:00
module cron
2022-04-12 20:53:20 +02:00
import time { parse }
2022-04-12 14:22:40 +02:00
fn test_next_simple() ? {
ce := parse_expression('0 3') ?
t := parse('2002-01-01 00:00:00') ?
t2 := ce.next(t) ?
assert t2.year == 2002
assert t2.month == 1
assert t2.day == 1
assert t2.hour == 3
assert t2.minute == 0
}
fn test_next_identical() ? {
ce := parse_expression('0 3') ?
t := parse('2002-01-01 03:00:00') ?
t2 := ce.next(t) ?
assert t2.year == 2002
assert t2.month == 1
assert t2.day == 2
assert t2.hour == 3
assert t2.minute == 0
}
fn test_next_next_day() ? {
ce := parse_expression('0 3') ?
t := parse('2002-01-01 04:00:00') ?
t2 := ce.next(t) ?
assert t2.year == 2002
assert t2.month == 1
assert t2.day == 2
assert t2.hour == 3
assert t2.minute == 0
}