move test resources into /test/resources
This commit is contained in:
parent
3e98f3acba
commit
f73f55b581
|
@ -49,8 +49,6 @@ migrate to idiomatic rust etc.
|
|||
for consistency, `_from_string` functions should handle their own labels
|
||||
e.g. "DLG SPR_1..." instead of just "SPR_1..."
|
||||
|
||||
replace huge inline strings with `include_str!()`
|
||||
|
||||
### documentation
|
||||
|
||||
examples of use cases (dedupe tiles, merge games, etc.)
|
||||
|
|
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()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
Write your game's title here
|
||||
|
||||
# BITSY VERSION 6.5
|
||||
|
||||
! ROOM_FORMAT 1
|
||||
|
||||
PAL 0
|
||||
0,82,204
|
||||
128,159,255
|
||||
255,255,255
|
||||
|
||||
ROOM 0
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
0,a,a,a,a,a,a,a,a,a,a,a,a,a,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0
|
||||
0,a,a,a,a,a,a,a,a,a,a,a,a,a,a,0
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
PAL 0
|
||||
|
||||
TIL a
|
||||
11111111
|
||||
10000001
|
||||
10000001
|
||||
10011001
|
||||
10011001
|
||||
10000001
|
||||
10000001
|
||||
11111111
|
||||
|
||||
SPR A
|
||||
00011000
|
||||
00011000
|
||||
00011000
|
||||
00111100
|
||||
01111110
|
||||
10111101
|
||||
00100100
|
||||
00100100
|
||||
POS 0 4,4
|
||||
|
||||
SPR a
|
||||
00000000
|
||||
00000000
|
||||
01010001
|
||||
01110001
|
||||
01110010
|
||||
01111100
|
||||
00111100
|
||||
00100100
|
||||
DLG SPR_0
|
||||
POS 0 8,12
|
||||
|
||||
ITM 0
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00111100
|
||||
01100100
|
||||
00100100
|
||||
00011000
|
||||
00000000
|
||||
NAME tea
|
||||
DLG ITM_0
|
||||
|
||||
DLG SPR_0
|
||||
I'm a cat
|
||||
|
||||
DLG ITM_0
|
||||
You found a nice warm cup of tea
|
||||
|
||||
VAR a
|
||||
42
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
END a
|
||||
This is a long line of dialogue. Blah blah blah
|
|
@ -0,0 +1,8 @@
|
|||
11111111
|
||||
11001111
|
||||
10111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
|
@ -0,0 +1,8 @@
|
|||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
|
@ -0,0 +1,11 @@
|
|||
ITM 6
|
||||
01000000
|
||||
00000000
|
||||
00000000
|
||||
00000100
|
||||
00100000
|
||||
00000000
|
||||
00000000
|
||||
00000010
|
||||
NAME door
|
||||
DLG ITM_2
|
|
@ -0,0 +1,26 @@
|
|||
ROOM a
|
||||
0,0,0,0,0,0,0,0,1l,0,0,0,0,0,0,0
|
||||
y,x,0,0,1j,0,0,1j,1l,0,1j,0,0,1j,0,0
|
||||
y,y,x,k,k,1c,1x,1y,1m,0,0,0,0,0,0,0
|
||||
y,y,y,x,k,s,s,s,k,k,k,k,k,1g,1f,k
|
||||
k,z,z,z,1i,1u,1u,1u,1v,11,19,1b,1a,1e,10,k
|
||||
k,z,z,11,12,z,z,z,z,10,17,z,18,1e,12,k
|
||||
k,z,z,z,z,z,z,z,z,1k,14,15,16,1h,z,k
|
||||
k,z,z,z,z,z,z,10,1d,1v,1r,1s,1r,1q,1z,k
|
||||
k,z,z,12,10,z,z,z,1i,1n,1o,1o,1o,1p,z,k
|
||||
k,z,z,z,z,z,z,z,z,z,z,z,10,z,z,k
|
||||
k,z,z,z,z,z,11,z,z,z,z,z,z,z,z,k
|
||||
k,z,z,z,z,z,z,z,z,z,12,z,z,10,12,k
|
||||
k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
NAME cellar 7
|
||||
ITM d 11,5
|
||||
ITM e 8,3
|
||||
ITM 5 1,0
|
||||
ITM 6 2,1
|
||||
ITM 6 3,2
|
||||
EXT 3,3 3 10,6
|
||||
END undefined 8,7
|
||||
PAL 9
|
|
@ -0,0 +1,12 @@
|
|||
SPR a
|
||||
00000000
|
||||
01111000
|
||||
01001000
|
||||
00111100
|
||||
00111100
|
||||
01011110
|
||||
01011110
|
||||
01101111
|
||||
NAME hatch
|
||||
DLG SPR_0
|
||||
POS 4 9,7
|
|
@ -0,0 +1,11 @@
|
|||
TIL z
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
11111111
|
||||
NAME concrete 1
|
||||
WAL true
|
|
@ -0,0 +1,19 @@
|
|||
TIL 7a
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
>
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
01010101
|
||||
10101010
|
||||
NAME chequers
|
Loading…
Reference in New Issue