map tests

This commit is contained in:
Llywelwyn 2023-08-31 01:27:58 +01:00
parent a5f13d72c6
commit a48d85e056

View file

@ -1,5 +1,32 @@
// tests/map_test.rs
use rust_rl::map::TileType;
use rust_rl::map::*;
use std::collections::HashSet;
#[test]
fn map_settings() {
let (overmap, id, width, height, difficulty, name, short_name, depth) = (
false,
0,
80,
50,
0,
"Test Map",
"Test Map",
0,
);
let map = Map::new(overmap, id, width, height, difficulty, name, short_name, depth);
assert_eq!(map.overmap, overmap);
assert_eq!(map.id, id);
assert_eq!(map.width, width);
assert_eq!(map.height, height);
assert_eq!(map.difficulty, difficulty);
assert_eq!(map.name, name);
assert_eq!(map.short_name, short_name);
assert_eq!(map.depth, depth);
assert_eq!(map.tiles.len(), (width * height) as usize);
assert_eq!(map.messages, HashSet::new());
}
#[test]
fn tiletype_equality() {