modes:single:tests: rename for test_footstool

This commit is contained in:
2026-04-04 04:14:22 +01:00
committed by oreodave
parent c2842c02e4
commit b7e511cbe8

View File

@@ -27,6 +27,7 @@ impl Hand for Single {
let self_abs = self.0.deck_abs(); let self_abs = self.0.deck_abs();
let other_abs = other.0.deck_abs(); let other_abs = other.0.deck_abs();
// Trivial implementation
if self_abs == other_abs { if self_abs == other_abs {
Footstool::Full Footstool::Full
} else if self_abs == other_abs + 1 { } else if self_abs == other_abs + 1 {
@@ -49,7 +50,7 @@ mod tests {
use super::*; use super::*;
use crate::{ use crate::{
card::{make_decks, PlayingCard, Rank, Suit}, card::{make_decks, PlayingCard, Rank, Suit},
modes::tests::test_footstool_non_reflexivity, modes::tests::test_footstool,
}; };
#[test] #[test]
@@ -84,9 +85,9 @@ mod tests {
assert!(s1.footstool(&s1) == Footstool::Full); assert!(s1.footstool(&s1) == Footstool::Full);
// TEST: non-reflexivity of footstool on neighbours. // TEST: non-reflexivity of footstool on neighbours.
let (_, s2_on_s1) = test_footstool_non_reflexivity(&s1, &s2); let (_, s2_on_s1) = test_footstool(&s1, &s2);
let (_, s3_on_s2) = test_footstool_non_reflexivity(&s2, &s3); let (_, s3_on_s2) = test_footstool(&s2, &s3);
let (s1_on_s3, s3_on_s1) = test_footstool_non_reflexivity(&s1, &s3); let (s1_on_s3, s3_on_s1) = test_footstool(&s1, &s3);
// TEST: s2 is half-footstooled by s3, and s1 is half footstooled by // TEST: s2 is half-footstooled by s3, and s1 is half footstooled by
// s2. // s2.
@@ -103,7 +104,7 @@ mod tests {
.iter() .iter()
.map(|&other_single| { .map(|&other_single| {
// TEST: All footstool results are non-reflexive. // TEST: All footstool results are non-reflexive.
test_footstool_non_reflexivity(single, &other_single) test_footstool(single, &other_single)
}) })
.map(|x| x.0) .map(|x| x.0)
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@@ -154,23 +155,20 @@ mod tests {
// TEST: a single may be footstooled by a single from another deck with // TEST: a single may be footstooled by a single from another deck with
// the same rank and suit. // the same rank and suit.
let (piv_on_piv_copy, _) = let (piv_on_piv_copy, _) = test_footstool(&pivot, &piv_copy);
test_footstool_non_reflexivity(&pivot, &piv_copy);
assert!(piv_on_piv_copy == Footstool::Full); assert!(piv_on_piv_copy == Footstool::Full);
// TEST: A single may be half footstooled by singles from another deck. // TEST: A single may be half footstooled by singles from another deck.
let (piv_on_piv_before, _) = let (piv_on_piv_before, _) = test_footstool(&pivot, &piv_before);
test_footstool_non_reflexivity(&pivot, &piv_before);
assert!(piv_on_piv_before == Footstool::Half); assert!(piv_on_piv_before == Footstool::Half);
let (_, piv_after_on_piv) = let (_, piv_after_on_piv) = test_footstool(&pivot, &piv_after);
test_footstool_non_reflexivity(&pivot, &piv_after);
assert!(piv_after_on_piv == Footstool::Half); assert!(piv_after_on_piv == Footstool::Half);
// TEST: A single is still not footstooled by singles from other // TEST: A single is still not footstooled by singles from other
// decks that aren't adjacent. // decks that aren't adjacent.
let (piv_on_piv_way_after, _) = let (piv_on_piv_way_after, _) =
test_footstool_non_reflexivity(&pivot, &piv_way_after); test_footstool(&pivot, &piv_way_after);
assert!(piv_on_piv_way_after == Footstool::None); assert!(piv_on_piv_way_after == Footstool::None);
} }
} }