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