Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbedard committed Sep 8, 2024
1 parent 47cbd5d commit d4a9513
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/game/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,6 @@ pub fn get_step(position: Position, direction: u8) -> Option<Position> {
#[cfg(test)]
mod tests {
use super::*;
use crate::constants::EMPTY_BOARD;

#[test]
fn test_get_step() {
Expand Down Expand Up @@ -2667,14 +2666,14 @@ mod tests {
fn test_stringify_board_empty() {
let board = Board::new();

assert_eq!(EMPTY_BOARD, board.to_string());
assert_eq!(crate::constants::EMPTY_BOARD, board.to_string());
}

#[test]
fn test_stringify_board_initial() {
let board = Board::initial();

assert_eq!(INITIAL_BOARD, board.to_string());
assert_eq!(crate::constants::INITIAL_BOARD, board.to_string());
}

#[test]
Expand Down
11 changes: 5 additions & 6 deletions src/game/hexchess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ impl fmt::Display for Hexchess {
#[cfg(test)]
mod tests {
use super::*;
use crate::{constants::{EMPTY_HEXCHESS, INITIAL_HEXCHESS}, game::targets};

#[test]
fn test_create_hexchess_from_initial_board_fen() {
Expand Down Expand Up @@ -741,14 +740,14 @@ mod tests {
fn test_stringify_hexchess_empty() {
let hexchess = Hexchess::new();

assert_eq!(EMPTY_HEXCHESS, hexchess.to_string());
assert_eq!(crate::constants::EMPTY_HEXCHESS, hexchess.to_string());
}

#[test]
fn test_stringify_hexchess_initial() {
let hexchess = Hexchess::initial();

assert_eq!(INITIAL_HEXCHESS, hexchess.to_string());
assert_eq!(crate::constants::INITIAL_HEXCHESS, hexchess.to_string());
}

#[test]
Expand Down Expand Up @@ -952,7 +951,7 @@ mod tests {
let mut hexchess = Hexchess::initial();
let result = hexchess.apply_sequence("g4g5 whoops");

assert_eq!(hexchess.to_string(), INITIAL_HEXCHESS); // <- the board has not changed
assert_eq!(hexchess.to_string(), crate::constants::INITIAL_HEXCHESS); // <- the board has not changed
assert_eq!(Err(String::from("invalid notation at index 1: whoops")), result);
}

Expand All @@ -961,7 +960,7 @@ mod tests {
let mut hexchess = Hexchess::initial();
let result = hexchess.apply_sequence("g4g5 b7a1"); // <- b7 is a black pawn, it cannot move to a1

assert_eq!(hexchess.to_string(), INITIAL_HEXCHESS); // <- the board has not changed
assert_eq!(hexchess.to_string(), crate::constants::INITIAL_HEXCHESS); // <- the board has not changed
assert_eq!(Err(String::from("Illegal move at index 1: b7a1")), result);
}

Expand All @@ -970,7 +969,7 @@ mod tests {
let mut hexchess = Hexchess::initial();
let result = hexchess.apply_sequence("f2d4 g10g9");

assert_eq!(hexchess.to_string(), INITIAL_HEXCHESS);
assert_eq!(hexchess.to_string(), crate::constants::INITIAL_HEXCHESS);
assert_eq!(Err(String::from("Illegal move at index 1: g10g9")), result);
}
}

0 comments on commit d4a9513

Please sign in to comment.