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]