test(core): possible_instructions Foundation→Tableau coverage
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>
This commit is contained in:
@@ -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 ---
|
// --- P2: waste multi-card move must be rejected ---
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user