refactor: use speculoos for all test assertions

This commit is contained in:
Ryan Walters
2025-09-05 19:34:01 -05:00
parent b60888219b
commit cac490565e
14 changed files with 244 additions and 297 deletions

View File

@@ -1,13 +1,14 @@
use glam::Vec2;
use pacman::constants::{CELL_SIZE, RAW_BOARD};
use pacman::map::builder::Map;
use speculoos::prelude::*;
#[test]
fn test_map_creation() {
let map = Map::new(RAW_BOARD).unwrap();
assert!(map.graph.nodes().count() > 0);
assert!(!map.grid_to_node.is_empty());
assert_that(&map.graph.nodes().count()).is_greater_than(0);
assert_that(&map.grid_to_node.is_empty()).is_false();
// Check that some connections were made
let mut has_connections = false;
@@ -17,7 +18,7 @@ fn test_map_creation() {
break;
}
}
assert!(has_connections);
assert_that(&has_connections).is_true();
}
#[test]
@@ -31,6 +32,6 @@ fn test_map_node_positions() {
(grid_pos.y as i32 * CELL_SIZE as i32) as f32,
) + Vec2::splat(CELL_SIZE as f32 / 2.0);
assert_eq!(node.position, expected_pos);
assert_that(&node.position).is_equal_to(expected_pos);
}
}