test configurations

This commit is contained in:
2020-04-19 08:13:55 +01:00
parent d0614b6de2
commit 76e6c2477c
15 changed files with 515 additions and 451 deletions

View File

@@ -128,14 +128,6 @@ impl From<String> for Room {
}
}
#[test]
fn test_room_from_string() {
assert_eq!(
Room::from(include_str!("test-resources/room").to_string()),
crate::mock::room()
);
}
impl ToString for Room {
fn to_string(&self) -> String {
let mut tiles = String::new();
@@ -191,17 +183,30 @@ impl ToString for Room {
}
}
#[test]
fn test_room_to_string() {
assert_eq!(
crate::mock::room().to_string(),
include_str!("test-resources/room").to_string()
);
}
#[cfg(test)]
mod test {
use crate::room::Room;
#[test]
fn test_room_walls_array() {
let output = Room::from(include_str!("test-resources/room-with-walls").to_string());
#[test]
fn test_room_from_string() {
assert_eq!(
Room::from(include_str!("test-resources/room").to_string()),
crate::mock::room()
);
}
assert_eq!(output.walls, vec![10, 15]);
#[test]
fn test_room_to_string() {
assert_eq!(
crate::mock::room().to_string(),
include_str!("test-resources/room").to_string()
);
}
#[test]
fn test_room_walls_array() {
let output = Room::from(include_str!("test-resources/room-with-walls").to_string());
assert_eq!(output.walls, vec![10, 15]);
}
}