use std::cli; use kestrel; fn check(ok: bool, label: str) { if !ok { stderr_line(label); process_exit(1); } } fn main() { let stalled = ke_clock(5.0, 50.0, 10.0, 3); check(at(stalled, 0) == 3.0 && at(stalled, 1) == 5.0 && at(stalled, 2) == 20.0 && at(stalled, 3) == 0.5, "bounded catch-up"); let first = ke_clock(0.0, 9.0, 10.0, 8); let next = ke_clock(at(first, 1), 11.0, 10.0, 8); check(at(first, 0) + at(next, 0) == at(ke_clock(0.0, 20.0, 10.0, 8), 0), "frame partition invariant"); check(len(ke_clock(10.0, 1.0, 10.0, 4)) == 0 && len(ke_clock(0.0, 1.5, 10.0, 4)) == 0, "invalid time inputs"); check(ke_lerp(2.0, 4.0, 0.25) == 2.5, "render interpolation"); let upper = ke_bounce(1.0, 3.0, 1.0, 0.0, 4.0); check(at(upper, 0) == 4.0 && at(upper, 1) == -3.0, "exact upper wall"); let lower = ke_bounce(0.0, -3.0, 1.0, 0.0, 4.0); check(at(lower, 0) == 3.0 && at(lower, 1) == 3.0, "moving outward at lower wall"); let mult = ke_bounce(0.0, 2.0, 5.0, 0.0, 4.0); check(at(mult, 0) == 2.0 && at(mult, 1) == 2.0, "cross several walls"); check(len(ke_bounce(5.0, 1.0, 1.0, 0.0, 4.0)) == 0, "invalid position"); println!("kestrel checks passed"); }