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