From d76a824987b016fcd1bd7dba9262b9de2acf54de Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Thu, 5 Oct 2023 12:31:27 -0400 Subject: [PATCH] Resolve tests which call the GameState constructor I changed the constructor from new() to default(), but didn't catch all of the tests. --- kifu/core/src/database.rs | 1 - kifu/core/src/types.rs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/kifu/core/src/database.rs b/kifu/core/src/database.rs index bbc6a35..7e9995f 100644 --- a/kifu/core/src/database.rs +++ b/kifu/core/src/database.rs @@ -83,7 +83,6 @@ mod test { let db = Database::open_path(PathBuf::from("fixtures/five_games/")).expect("database to open"); assert_eq!(db.all_games().count(), 5); - for game in db.all_games() {} assert_matches!(db.all_games().find(|g| g.info.black_player == Some("Steve".to_owned())), Some(game) => { diff --git a/kifu/core/src/types.rs b/kifu/core/src/types.rs index 00850f4..86c00d9 100644 --- a/kifu/core/src/types.rs +++ b/kifu/core/src/types.rs @@ -185,7 +185,7 @@ mod test { #[test] fn current_player_changes_after_move() { - let mut state = GameState::new(); + let mut state = GameState::default(); assert_eq!(state.current_player, Color::Black); state.place_stone(Coordinate { column: 9, row: 9 }).unwrap(); assert_eq!(state.current_player, Color::White); @@ -193,7 +193,7 @@ mod test { #[test] fn current_player_remains_the_same_after_self_capture() { - let mut state = GameState::new(); + let mut state = GameState::default(); state.board = Board::from_coordinates( vec![ (Coordinate { column: 17, row: 0 }, Color::White), @@ -214,7 +214,7 @@ mod test { #[test] fn ko_rules_are_enforced() { - let mut state = GameState::new(); + let mut state = GameState::default(); state.board = Board::from_coordinates( vec![ (Coordinate { column: 7, row: 9 }, Color::White),