From a5a81ccc8e7719be304d69ee7029575cd620b203 Mon Sep 17 00:00:00 2001 From: funman300 Date: Wed, 27 May 2026 13:26:42 -0700 Subject: [PATCH] =?UTF-8?q?test(core):=20possible=5Finstructions=20Foundat?= =?UTF-8?q?ion=E2=86=92Tableau=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add two tests verifying that possible_instructions includes Foundation→Tableau moves when take_from_foundation is enabled, and excludes them when it is disabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- solitaire_core/src/game_state.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/solitaire_core/src/game_state.rs b/solitaire_core/src/game_state.rs index 6910b5f..8c41971 100644 --- a/solitaire_core/src/game_state.rs +++ b/solitaire_core/src/game_state.rs @@ -1680,6 +1680,29 @@ mod tests { ); } + #[test] + fn possible_instructions_includes_foundation_to_tableau_when_enabled() { + // Reuse the Foundation→Tableau board setup (Foundation(0): A♠,2♠; Tableau(0): 3♥). + let g = setup_take_from_foundation_game(); + assert!(g.take_from_foundation); + let moves = g.possible_instructions(); + assert!( + moves.contains(&(PileType::Foundation(0), PileType::Tableau(0), 1)), + "possible_instructions must include Foundation→Tableau when take_from_foundation is on; got {moves:?}" + ); + } + + #[test] + fn possible_instructions_excludes_foundation_to_tableau_when_disabled() { + let mut g = setup_take_from_foundation_game(); + g.take_from_foundation = false; + let moves = g.possible_instructions(); + assert!( + !moves.iter().any(|(from, _, _)| matches!(from, PileType::Foundation(_))), + "possible_instructions must not include any Foundation source when take_from_foundation is off; got {moves:?}" + ); + } + // --- P2: waste multi-card move must be rejected --- #[test]