use std::cli; use shrike; fn check(ok: bool, label: str) { if !ok { stderr_line(label); process_exit(1); } } fn main() { check(sh_next([], [], 60.0, -1.0) == -1.0, "two empty rankings"); check(sh_score([7, 7, 3], [], 7.0, 0.0) == 1.0, "one vote per ranker"); check(sh_score([7, 7, 3], [], 3.0, 0.0) == 1.0 / 3.0, "original rank position"); check(sh_score([1], [2], 3.0, 0.0) == 0.0, "missing item"); check(sh_next([8], [2], 60.0, -1.0) == 2.0, "tie by lower ID"); check(sh_next([8], [2], 60.0, 2.0) == 8.0, "cursor through tie"); check(sh_next([8], [2], 60.0, 8.0) == -1.0, "end of results"); check(sh_next([8], [2], 60.0, 100.0) == -1.0, "unknown cursor"); check(sh_score([2.5], [], 1.0, 0.0) == -1.0, "invalid ID"); check(!sh_valid_inputs([], [], -1.0) && !sh_valid_inputs([9007199254740992.0], [], 60.0), "input bounds"); check(sh_next([3, 5], [7, 5], 60.0, -1.0) == 5.0, "consensus winner"); println!("shrike checks passed"); }