usesuper::*;usecrate::ink::shipped;fn stream() -> Contest { *shipped().surfaces.get("stream").expect("the alphabet names the stream")}fn lift(from: (f64, f64), to: (f64, f64), lettered: bool) -> Lifted { stream().at_lift(Point::new(from.0, from.1), Point::new(to.0, to.1), lettered, &shipped().knobs)}/// RULE (owner, 15 Nov 2026): only Messages' stream is contested; every other surface reads its ink as it did.#[test]fn only_the_stream_is_contested() { assert_eq!(shipped().surfaces.keys().collect::<Vec<_>>(), ["stream"]); assert_eq!(stream(), Contest { bend: 22.0, bend_ratio: 0.5, turn_back: 1.6, swipe: 70.0, swipe_level: 0.5 });}/// RULE: a straight stroke is the scroll's however long; one that bends is the ink's.#[test]fn a_stroke_that_bends_is_the_inks() {let contest = stream(); assert!(!contest.claims(6.0, 300.0, 300.0), "a scroll, the thumb drifting a little"); assert!(!contest.claims(40.0, 300.0, 300.0), "a long scroll on a thumb's arc"); assert!(!contest.claims(4.0, 60.0, 60.0), "an l is the scroll's"); assert!(!contest.claims(200.0, 30.0, 200.0), "a sideways swipe"); assert!(!contest.claims(18.0, 20.0, 20.0), "too small to tell yet"); assert!(contest.claims(40.0, 60.0, 60.0), "a c"); assert!(contest.claims(50.0, 100.0, 100.0), "an h, once its hump is drawn"); assert!(contest.claims(120.0, 60.0, 120.0), "a tall scratch-out");// A flat scratch-out never bends that much: it turns back on itself. assert!(!contest.claims(150.0, 20.0, 150.0), "its first leg is a swipe so far"); assert!(contest.claims(150.0, 30.0, 300.0), "doubled back across the chat: the ink's"); assert!(!contest.claims(20.0, 200.0, 420.0), "a scroll that turns back up is still the scroll's");}/// RULE (owner, 15 Nov 2026): a sideways swipe cuts to the next or the previous chat, decided at the lift.#[test]fn a_level_stroke_long_enough_steps() { assert_eq!(lift((300.0, 400.0), (200.0, 410.0), false), Lifted::Step(1), "leftward is the next chat"); assert_eq!(lift((100.0, 400.0), (200.0, 380.0), false), Lifted::Step(-1), "rightward is the one before"); assert_eq!(lift((300.0, 400.0), (231.0, 400.0), false), Lifted::Nothing, "69 points is no swipe"); assert_eq!(lift((300.0, 400.0), (230.0, 400.0), false), Lifted::Step(1), "70 is"); assert_eq!(lift((300.0, 400.0), (200.0, 460.0), false), Lifted::Nothing, "a slanted drag is the scroll's"); assert_eq!(lift((300.0, 400.0), (300.0, 100.0), false), Lifted::Nothing, "a scroll");}/// RULE: with letters written, a short level stroke edits them as it does on a deck; a long one still steps.#[test]fn a_short_level_stroke_edits_the_letters_written() { assert_eq!(lift((300.0, 400.0), (200.0, 400.0), true), Lifted::Ink); assert_eq!(lift((200.0, 400.0), (240.0, 400.0), true), Lifted::Ink); assert_eq!(lift((300.0, 400.0), (120.0, 400.0), true), Lifted::Step(1)); assert_eq!(lift((300.0, 400.0), (300.0, 100.0), true), Lifted::Nothing, "a scroll, letters or none");}