From fa4d8efb786d232a8e64ea41b25ea3721f0327bd Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 5 Apr 2026 02:54:38 +0100 Subject: [PATCH] modes:mod:tests: test_footstool revert to basic pattern My previous impl was based on some testing for different Pair footstool implementations. However, I've decided to fix it to this set of patterns: 1) any half footstool must come from a more dominant hand. 2) full footstools are symmetric and require both hands to be equivalent --- src/modes/mod.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/modes/mod.rs b/src/modes/mod.rs index f69b4e7..1861b74 100644 --- a/src/modes/mod.rs +++ b/src/modes/mod.rs @@ -25,33 +25,32 @@ pub trait Hand: Ord { #[cfg(test)] mod tests { - use std::fmt::Display; + use std::fmt::{Debug, Display}; use super::*; /** Given two hands, assert that applying a footstool both ways fits a - recognised pattern. Return the results of the two footstool checks (x on y, - y on x). + recognised basic pattern for footstools (in a generic sense). Return the + results of the two footstool checks (x on y, y on x). + + Obviously may panic. */ pub fn test_footstool(x: &T, y: &T) -> (Footstool, Footstool) where - T: Hand + Copy + Display, + T: Hand + Copy + Display + Debug, { let res1 = x.footstool(y); let res2 = y.footstool(x); assert!( match (res1, res2) { - // Default patterns we'd expect - (Footstool::Half, Footstool::None) - | (Footstool::None, Footstool::Half) - | (Footstool::None, Footstool::None) - => true, - - // Patterns that require an exact examination to be certain + (Footstool::None, Footstool::None) => true, + (Footstool::Half, Footstool::None) => x > y, + (Footstool::None, Footstool::Half) => y > x, (Footstool::Full, Footstool::Full) => x == y, - _ => true, + _ => false, }, - "Expected footstool on {}, {} ({:?}, {:?}) to match a recognised pattern", + "Expected footstool on {}, {} ({:?}, {:?}) to match a recognised + pattern", x, y, res1,