From bcd38ecdc45ef012f083d327dd4a834140c4b7f7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 2 Apr 2026 05:39:08 +0100 Subject: [PATCH] modes:mod: implemented a generic tester for non_reflexivity Given two "Hands", we test that the footstool condition on those two hands are non-reflexive. --- src/modes/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/modes/mod.rs b/src/modes/mod.rs index 4b38077..a29dd89 100644 --- a/src/modes/mod.rs +++ b/src/modes/mod.rs @@ -11,3 +11,22 @@ pub enum Footstool { pub trait Hand { fn footstool(&self, other: Self) -> Footstool; } + +mod tests { + use super::*; + pub fn test_non_reflexivity( + x: &T, + y: &T, + ) -> (Footstool, Footstool) { + let res1 = x.footstool(*y); + let res2 = y.footstool(*x); + assert!(match (res1, res2) { + (Footstool::None, Footstool::None) + | (Footstool::None, Footstool::Half) + | (Footstool::Half, Footstool::None) + | (Footstool::Full, Footstool::Full) => true, + _ => false, + }); + (res1, res2) + } +}