test configurations
This commit is contained in:
43
src/room.rs
43
src/room.rs
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user