100-days-of-rust/Week-08/Day-50_Tic-Tac-Toe/day50/tests/examples.rs

21 lines
565 B
Rust

#[cfg(test)]
mod examples {
use day50::{tic_tac_toe, Player};
#[test]
fn example1() {
let board = [['X', 'O', 'O'], ['O', 'X', 'O'], ['O', '#', 'X']];
assert_eq!(tic_tac_toe(&board), Some(Player::X));
}
#[test]
fn example2() {
let board = [['X', 'O', 'O'], ['O', 'X', 'O'], ['X', '#', 'O']];
assert_eq!(tic_tac_toe(&board), Some(Player::O));
}
#[test]
fn example3() {
let board = [['X', 'X', 'O'], ['O', 'X', 'O'], ['X', 'O', '#']];
assert_eq!(tic_tac_toe(&board), None);
}
}