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

@@ -87,52 +87,58 @@ impl ToString for Exit {
}
}
#[test]
fn test_exit_from_string() {
assert_eq!(
Exit::from("a 12,13".to_string()),
Exit {
room_id: 10,
position: Position { x: 12, y: 13 },
effect: Transition::None
}
);
}
#[cfg(test)]
mod test {
use crate::exit::{Transition, Exit};
use crate::position::Position;
#[test]
fn test_exit_from_string_with_fx() {
assert_eq!(
Exit::from("a 12,13 FX slide_u".to_string()),
Exit {
room_id: 10,
position: Position { x: 12, y: 13 },
effect: Transition::SlideUp
}
);
}
#[test]
fn test_exit_from_string() {
assert_eq!(
Exit::from("a 12,13".to_string()),
Exit {
room_id: 10,
position: Position { x: 12, y: 13 },
effect: Transition::None
}
);
}
#[test]
fn test_exit_to_string() {
assert_eq!(
Exit {
room_id: 8,
position: Position { x: 5, y: 6 },
effect: Transition::None
}
.to_string(),
"8 5,6".to_string()
);
}
#[test]
fn test_exit_from_string_with_fx() {
assert_eq!(
Exit::from("a 12,13 FX slide_u".to_string()),
Exit {
room_id: 10,
position: Position { x: 12, y: 13 },
effect: Transition::SlideUp
}
);
}
#[test]
fn test_exit_to_string_with_fx() {
assert_eq!(
Exit {
room_id: 8,
position: Position { x: 5, y: 6 },
effect: Transition::FadeToWhite
}
.to_string(),
"8 5,6 FX fade_w".to_string()
);
#[test]
fn test_exit_to_string() {
assert_eq!(
Exit {
room_id: 8,
position: Position { x: 5, y: 6 },
effect: Transition::None
}
.to_string(),
"8 5,6".to_string()
);
}
#[test]
fn test_exit_to_string_with_fx() {
assert_eq!(
Exit {
room_id: 8,
position: Position { x: 5, y: 6 },
effect: Transition::FadeToWhite
}
.to_string(),
"8 5,6 FX fade_w".to_string()
);
}
}