summaryrefslogtreecommitdiff
path: root/dungeon/tests
diff options
context:
space:
mode:
authoralf9310 <alf9310@rit.edu>2025-11-09 17:12:15 -0500
committeralf9310 <alf9310@rit.edu>2025-11-09 17:12:15 -0500
commitba26fa4eb37e78b6dc47cb7f4e96733375e022fc (patch)
treea494ac7fa580fbdc6eab9c8ce06f33626282f9d8 /dungeon/tests
parentdungeon_generation: variables changed from usize to u16 for pos compatability (diff)
downloadDungeonCrawl-ba26fa4eb37e78b6dc47cb7f4e96733375e022fc.tar.gz
DungeonCrawl-ba26fa4eb37e78b6dc47cb7f4e96733375e022fc.tar.bz2
DungeonCrawl-ba26fa4eb37e78b6dc47cb7f4e96733375e022fc.zip
dungeon_generation: added stair generation and fixed room center vs rabdom point recursion
Diffstat (limited to 'dungeon/tests')
-rw-r--r--dungeon/tests/bsp_tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/dungeon/tests/bsp_tests.rs b/dungeon/tests/bsp_tests.rs
index 2e3a781..6bd0153 100644
--- a/dungeon/tests/bsp_tests.rs
+++ b/dungeon/tests/bsp_tests.rs
@@ -3,6 +3,7 @@
mod tests {
use dungeon::*;
+ /// Basic integration test for BSP generation
#[test]
fn test_bsp_integration() {
let seed = 12345u64;
@@ -12,4 +13,17 @@ mod tests {
assert!(player_start.x() < map::MAP_SIZE);
assert!(player_start.y() < map::MAP_SIZE);
}
+
+ /// Test that BSP-generated floors have a valid player start
+ #[test]
+ fn test_bsp_player_start() {
+ let seed = 12345u64;
+ let (tiles, player_start) = bsp::generate(seed);
+ // Ensure player start is within bounds
+ assert!(player_start.x() < map::MAP_SIZE);
+ assert!(player_start.y() < map::MAP_SIZE);
+ // Ensure player start is an air tile
+ let idx = player_start.idx();
+ assert_eq!(tiles[idx], map::Tile::Air);
+ }
}