rename non-test "test" functions to "examples"

This commit is contained in:
Max Bradbury 2020-04-11 23:04:56 +01:00
parent e547cd341f
commit 46458e2506
1 changed files with 19 additions and 19 deletions

View File

@ -122,7 +122,7 @@ struct Game {
variables: Vec<Variable>,
}
fn test_image_chequers_1() -> Image {
fn example_image_chequers_1() -> Image {
Image {
pixels: vec![
1,0,1,0,1,0,1,0,
@ -137,7 +137,7 @@ fn test_image_chequers_1() -> Image {
}
}
fn test_image_chequers_2() -> Image {
fn example_image_chequers_2() -> Image {
Image {
pixels: vec![
0,1,0,1,0,1,0,1,
@ -152,7 +152,7 @@ fn test_image_chequers_2() -> Image {
}
}
fn test_avatar() -> Avatar {
fn example_avatar() -> Avatar {
Avatar {
animation_frames: vec![
Image {
@ -185,7 +185,7 @@ fn test_avatar() -> Avatar {
}
}
fn test_sprite() -> Sprite {
fn example_sprite() -> Sprite {
Sprite {
id: "a".to_string(),
name: Some("hatch".to_string()),
@ -212,7 +212,7 @@ fn test_sprite() -> Sprite {
}
}
fn test_item() -> Item {
fn example_item() -> Item {
Item {
id: "6".to_string(),
animation_frames: vec![
@ -234,7 +234,7 @@ fn test_item() -> Item {
}
}
fn test_room() -> Room {
fn example_room() -> Room {
Room {
id: "a".to_string(),
palette: "9".to_string(),
@ -276,7 +276,7 @@ fn test_room() -> Room {
}
}
fn test_room_string() -> String {
fn example_room_string() -> String {
include_str!("../test/resources/room").to_string()
}
@ -330,7 +330,7 @@ fn image_to_string(image: Image) -> String {
#[test]
fn test_image_to_string() {
let output = image_to_string(test_image_chequers_1());
let output = image_to_string(example_image_chequers_1());
let expected = include_str!("../test/resources/image-chequers-1").to_string();
assert_eq!(output, expected);
@ -420,8 +420,8 @@ fn test_tile_to_string() {
name: Some("chequers".to_string()),
wall: false,
animation_frames: vec![
test_image_chequers_1(),
test_image_chequers_2(),
example_image_chequers_1(),
example_image_chequers_2(),
]
});
@ -567,7 +567,7 @@ fn test_avatar_from_string() {
let output = avatar_from_string(
include_str!("../test/resources/avatar").to_string()
);
let expected = test_avatar();
let expected = example_avatar();
assert_eq!(output, expected);
}
@ -582,7 +582,7 @@ fn avatar_to_string(avatar: Avatar) -> String {
#[test]
fn test_avatar_to_string() {
let output = avatar_to_string(test_avatar());
let output = avatar_to_string(example_avatar());
let expected = include_str!("../test/resources/avatar");
assert_eq!(output, expected);
}
@ -632,7 +632,7 @@ fn test_sprite_from_string() {
include_str!("../test/resources/sprite").to_string()
);
let expected = test_sprite();
let expected = example_sprite();
assert_eq!(output, expected);
}
@ -651,7 +651,7 @@ fn sprite_to_string(sprite: Sprite) -> String {
#[test]
fn test_sprite_to_string() {
let output = sprite_to_string(test_sprite());
let output = sprite_to_string(example_sprite());
let expected = include_str!("../test/resources/sprite").to_string();
assert_eq!(output, expected);
@ -692,7 +692,7 @@ fn test_item_from_string() {
include_str!("../test/resources/item").to_string()
);
let expected = test_item();
let expected = example_item();
assert_eq!(output, expected);
}
@ -709,7 +709,7 @@ fn item_to_string(item: Item) -> String {
#[test]
fn test_item_to_string() {
let output = item_to_string(test_item());
let output = item_to_string(example_item());
let expected = include_str!("../test/resources/item").to_string();
assert_eq!(output, expected);
@ -906,8 +906,8 @@ fn room_from_string(string: String) -> Room {
#[test]
fn test_room_from_string() {
let output = room_from_string(test_room_string());
let expected = test_room();
let output = room_from_string(example_room_string());
let expected = example_room();
assert_eq!(output, expected);
}
@ -964,7 +964,7 @@ fn room_to_string(room: Room) -> String {
#[test]
fn test_room_to_string() {
assert_eq!(room_to_string(test_room()), test_room_string());
assert_eq!(room_to_string(example_room()), example_room_string());
}
fn game_from_string(string: String ) -> Game {