move test resources into /test/resources
This commit is contained in:
35
src/main.rs
35
src/main.rs
@@ -241,7 +241,7 @@ fn test_room() -> Room {
|
||||
}
|
||||
|
||||
fn test_room_string() -> String {
|
||||
"ROOM a\n0,0,0,0,0,0,0,0,1l,0,0,0,0,0,0,0\ny,x,0,0,1j,0,0,1j,1l,0,1j,0,0,1j,0,0\ny,y,x,k,k,1c,1x,1y,1m,0,0,0,0,0,0,0\ny,y,y,x,k,s,s,s,k,k,k,k,k,1g,1f,k\nk,z,z,z,1i,1u,1u,1u,1v,11,19,1b,1a,1e,10,k\nk,z,z,11,12,z,z,z,z,10,17,z,18,1e,12,k\nk,z,z,z,z,z,z,z,z,1k,14,15,16,1h,z,k\nk,z,z,z,z,z,z,10,1d,1v,1r,1s,1r,1q,1z,k\nk,z,z,12,10,z,z,z,1i,1n,1o,1o,1o,1p,z,k\nk,z,z,z,z,z,z,z,z,z,z,z,10,z,z,k\nk,z,z,z,z,z,11,z,z,z,z,z,z,z,z,k\nk,z,z,z,z,z,z,z,z,z,12,z,z,10,12,k\nk,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k\n0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nNAME cellar 7\nITM d 11,5\nITM e 8,3\nITM 5 1,0\nITM 6 2,1\nITM 6 3,2\nEXT 3,3 3 10,6\nEND undefined 8,7\nPAL 9".to_string()
|
||||
include_str!("../test/resources/room").to_string()
|
||||
}
|
||||
|
||||
fn image_from_string(string: String) -> Image {
|
||||
@@ -257,7 +257,7 @@ fn image_from_string(string: String) -> Image {
|
||||
#[test]
|
||||
fn test_image_from_string() {
|
||||
let output = image_from_string(
|
||||
"11111111\n11001111\n10111111\n11111111\n11111111\n11111111\n11111111\n11111111".to_string()
|
||||
include_str!("../test/resources/image").to_string()
|
||||
);
|
||||
|
||||
let expected = Image {
|
||||
@@ -299,7 +299,7 @@ fn image_to_string_opts(image: Image, hd: bool) -> String {
|
||||
#[test]
|
||||
fn test_image_to_string() {
|
||||
let output = image_to_string(test_image_chequers_1());
|
||||
let expected = "10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101".to_string();
|
||||
let expected = include_str!("../test/resources/image-chequers-1").to_string();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
@@ -353,7 +353,9 @@ fn tile_from_string(string: String) -> Tile {
|
||||
|
||||
#[test]
|
||||
fn test_tile_from_string() {
|
||||
let output = tile_from_string("TIL z\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\nNAME concrete 1\nWAL true".to_string());
|
||||
let output = tile_from_string(
|
||||
include_str!("../test/resources/tile").to_string()
|
||||
);
|
||||
|
||||
let expected = Tile {
|
||||
id: "z".to_string(),
|
||||
@@ -391,7 +393,7 @@ fn test_tile_to_string() {
|
||||
]
|
||||
});
|
||||
|
||||
let expected = "TIL 7a\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n>\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\nNAME chequers".to_string();
|
||||
let expected = include_str!("../test/resources/tile-chequers").to_string();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
@@ -553,7 +555,10 @@ fn sprite_from_string(string: String) -> Sprite {
|
||||
|
||||
#[test]
|
||||
fn test_sprite_from_string() {
|
||||
let output = sprite_from_string("SPR a\n00000000\n01111000\n01001000\n00111100\n00111100\n01011110\n01011110\n01101111\nNAME hatch\nDLG SPR_0\nPOS 4 9,7".to_string());
|
||||
let output = sprite_from_string(
|
||||
include_str!("../test/resources/sprite").to_string()
|
||||
);
|
||||
|
||||
let expected = test_sprite();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
@@ -574,7 +579,7 @@ fn sprite_to_string(sprite: Sprite) -> String {
|
||||
#[test]
|
||||
fn test_sprite_to_string() {
|
||||
let output = sprite_to_string(test_sprite());
|
||||
let expected = "SPR a\n00000000\n01111000\n01001000\n00111100\n00111100\n01011110\n01011110\n01101111\nNAME hatch\nDLG SPR_0\nPOS 4 9,7".to_string();
|
||||
let expected = include_str!("../test/resources/sprite").to_string();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
@@ -610,7 +615,10 @@ fn item_from_string(string: String) -> Item {
|
||||
|
||||
#[test]
|
||||
fn test_item_from_string() {
|
||||
let output = item_from_string("ITM 6\n01000000\n00000000\n00000000\n00000100\n00100000\n00000000\n00000000\n00000010\nNAME door\nDLG ITM_2".to_string());
|
||||
let output = item_from_string(
|
||||
include_str!("../test/resources/item").to_string()
|
||||
);
|
||||
|
||||
let expected = test_item();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
@@ -629,7 +637,7 @@ fn item_to_string(item: Item) -> String {
|
||||
#[test]
|
||||
fn test_item_to_string() {
|
||||
let output = item_to_string(test_item());
|
||||
let expected = "ITM 6\n01000000\n00000000\n00000000\n00000100\n00100000\n00000000\n00000000\n00000010\nNAME door\nDLG ITM_2".to_string();
|
||||
let expected = include_str!("../test/resources/item").to_string();
|
||||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
@@ -658,7 +666,7 @@ fn exit_to_string(exit: Exit) -> String {
|
||||
#[test]
|
||||
fn test_exit_to_string() {
|
||||
assert_eq!(
|
||||
exit_to_string(Exit { room: "8".to_string(), position: Position { x: 5, y: 6 }}),
|
||||
exit_to_string(Exit { room: "8".to_string(), position: Position { x: 5, y: 6 } }),
|
||||
"8 5,6".to_string()
|
||||
);
|
||||
}
|
||||
@@ -675,8 +683,11 @@ fn ending_from_string(string: String) -> Ending {
|
||||
#[test]
|
||||
fn test_ending_from_string() {
|
||||
assert_eq!(
|
||||
ending_from_string("END a\nThis is a long line of dialogue. Blah blah blah".to_string()),
|
||||
Ending { id: "a".to_string(), dialogue: "This is a long line of dialogue. Blah blah blah".to_string() }
|
||||
ending_from_string(include_str!("../test/resources/ending").to_string()),
|
||||
Ending {
|
||||
id: "a".to_string(),
|
||||
dialogue: "This is a long line of dialogue. Blah blah blah".to_string()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user