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

@@ -88,38 +88,44 @@ impl ToString for Tile {
}
}
#[test]
fn test_tile_from_string() {
let output = Tile::from(include_str!("test-resources/tile").to_string());
#[cfg(test)]
mod test {
use crate::tile::Tile;
use crate::image::Image;
let expected = Tile {
id: 35,
name: Some("concrete 1".to_string()),
wall: Some(true),
animation_frames: vec![Image {
pixels: vec![1; 64],
}],
colour_id: None,
};
#[test]
fn test_tile_from_string() {
let output = Tile::from(include_str!("test-resources/tile").to_string());
assert_eq!(output, expected);
}
let expected = Tile {
id: 35,
name: Some("concrete 1".to_string()),
wall: Some(true),
animation_frames: vec![Image {
pixels: vec![1; 64],
}],
colour_id: None,
};
#[test]
fn test_tile_to_string() {
let output = Tile {
id: 262,
name: Some("chequers".to_string()),
wall: None,
animation_frames: vec![
crate::mock::image::chequers_1(),
crate::mock::image::chequers_2(),
],
colour_id: None,
assert_eq!(output, expected);
}
.to_string();
let expected = include_str!("test-resources/tile-chequers").to_string();
#[test]
fn test_tile_to_string() {
let output = Tile {
id: 262,
name: Some("chequers".to_string()),
wall: None,
animation_frames: vec![
crate::mock::image::chequers_1(),
crate::mock::image::chequers_2(),
],
colour_id: None,
}
.to_string();
assert_eq!(output, expected);
let expected = include_str!("test-resources/tile-chequers").to_string();
assert_eq!(output, expected);
}
}