Files
el/lang/tests/calendar/examples/cycle-30hr.el
T
2026-05-05 01:38:51 -05:00

21 lines
699 B
EmacsLisp

// cycle-30hr.el CycleCalendar with a 30-hour period.
// Two CalendarTimes 15 hours apart should have cycle_phase differ by 0.5.
// We compare phases via float subtraction with format_float for determinism.
fn run_test() -> String {
let period: Duration = 30.hours
let cal: Calendar = cycle_calendar(period)
let base: Instant = unix_seconds(0)
let later: Instant = base + 15.hours
let ct1: CalendarTime = in_calendar(base, cal)
let ct2: CalendarTime = in_calendar(later, cal)
let p1: Float = cal_cycle_phase(ct1)
let p2: Float = cal_cycle_phase(ct2)
let diff: Float = p2 - p1
return format_float(diff, 1)
}
fn main() -> Void {
println(run_test())
}