tests don't need `test_` prefix

This commit is contained in:
Max Bradbury 2020-07-26 12:37:41 +01:00
parent f2ae43e85f
commit b5050720d8
13 changed files with 37 additions and 37 deletions

View File

@ -35,7 +35,7 @@ mod test {
use crate::colour::Colour; use crate::colour::Colour;
#[test] #[test]
fn test_colour_from_string() { fn colour_from_string() {
assert_eq!( assert_eq!(
Colour::from("0,255,0").unwrap(), Colour::from("0,255,0").unwrap(),
Colour { red: 0, green: 255, blue: 0 } Colour { red: 0, green: 255, blue: 0 }
@ -43,22 +43,22 @@ mod test {
} }
#[test] #[test]
fn test_colour_to_string() { fn colour_to_string() {
assert_eq!(Colour { red: 22, green: 33, blue: 44, }.to_string(), "22,33,44".to_string()); assert_eq!(Colour { red: 22, green: 33, blue: 44, }.to_string(), "22,33,44".to_string());
} }
#[test] #[test]
fn test_colour_missing_value() { fn colour_missing_value() {
assert!(Colour::from("0,0").is_err()); assert!(Colour::from("0,0").is_err());
} }
#[test] #[test]
fn test_colour_ambiguous_value() { fn colour_ambiguous_value() {
assert!(Colour::from("0,0,").is_err()); assert!(Colour::from("0,0,").is_err());
} }
#[test] #[test]
fn test_colour_extraneous_value() { fn colour_extraneous_value() {
assert!(Colour::from("0,0,0,0").is_err()); assert!(Colour::from("0,0,0,0").is_err());
} }
} }

View File

@ -41,7 +41,7 @@ mod test {
use crate::dialogue::Dialogue; use crate::dialogue::Dialogue;
#[test] #[test]
fn test_dialogue_from_string() { fn dialogue_from_string() {
let output = Dialogue::from( let output = Dialogue::from(
"DLG h\nhello\nNAME not a dialogue name\nNAME a dialogue name".to_string() "DLG h\nhello\nNAME not a dialogue name\nNAME a dialogue name".to_string()
); );
@ -56,7 +56,7 @@ mod test {
} }
#[test] #[test]
fn test_dialogue_to_string() { fn dialogue_to_string() {
let output = Dialogue { let output = Dialogue {
id: "y".to_string(), id: "y".to_string(),
contents: "This is a bit of dialogue,\nblah blah\nblah blah".to_string(), contents: "This is a bit of dialogue,\nblah blah\nblah blah".to_string(),

View File

@ -35,7 +35,7 @@ mod test {
use std::str::FromStr; use std::str::FromStr;
#[test] #[test]
fn test_ending_from_string() { fn ending_from_string() {
assert_eq!( assert_eq!(
Ending::from_str(include_str!("test-resources/ending")).unwrap(), Ending::from_str(include_str!("test-resources/ending")).unwrap(),
Ending { Ending {
@ -46,7 +46,7 @@ mod test {
} }
#[test] #[test]
fn test_ending_to_string() { fn ending_to_string() {
assert_eq!( assert_eq!(
Ending { Ending {
id: "7".to_string(), id: "7".to_string(),

View File

@ -103,7 +103,7 @@ mod test {
use std::str::FromStr; use std::str::FromStr;
#[test] #[test]
fn test_exit_from_string() { fn exit_from_string() {
assert_eq!( assert_eq!(
Exit::from_str("a 12,13").unwrap(), Exit::from_str("a 12,13").unwrap(),
Exit { Exit {
@ -115,7 +115,7 @@ mod test {
} }
#[test] #[test]
fn test_exit_from_string_with_fx() { fn exit_from_string_with_fx() {
assert_eq!( assert_eq!(
Exit::from_str("a 12,13 FX slide_u").unwrap(), Exit::from_str("a 12,13 FX slide_u").unwrap(),
Exit { Exit {
@ -127,7 +127,7 @@ mod test {
} }
#[test] #[test]
fn test_exit_to_string() { fn exit_to_string() {
assert_eq!( assert_eq!(
Exit { Exit {
room_id: "8".to_string(), room_id: "8".to_string(),
@ -139,7 +139,7 @@ mod test {
} }
#[test] #[test]
fn test_exit_to_string_with_fx() { fn exit_to_string_with_fx() {
assert_eq!( assert_eq!(
Exit { Exit {
room_id: "8".to_string(), room_id: "8".to_string(),

View File

@ -100,7 +100,7 @@ mod test {
use crate::mock; use crate::mock;
#[test] #[test]
fn test_image_from_string() { fn image_from_string() {
let output = Image::from( let output = Image::from(
include_str!("test-resources/image").to_string() include_str!("test-resources/image").to_string()
); );
@ -122,7 +122,7 @@ mod test {
} }
#[test] #[test]
fn test_image_to_string() { fn image_to_string() {
let output = mock::image::chequers_1().to_string(); let output = mock::image::chequers_1().to_string();
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);
@ -142,7 +142,7 @@ mod test {
/// lots of Bitsy games have editor errors where pixels can be placed out of bounds /// lots of Bitsy games have editor errors where pixels can be placed out of bounds
/// check that these extraneous pixels are stripped out /// check that these extraneous pixels are stripped out
#[test] #[test]
fn test_image_out_of_bounds() { fn image_out_of_bounds() {
let output = Image::from( let output = Image::from(
include_str!("test-resources/image-oob").to_string() include_str!("test-resources/image-oob").to_string()
); );

View File

@ -81,14 +81,14 @@ mod test {
use crate::mock; use crate::mock;
#[test] #[test]
fn test_item_from_string() { fn item_from_string() {
let output = Item::from(include_str!("test-resources/item").to_string()); let output = Item::from(include_str!("test-resources/item").to_string());
let expected = mock::item(); let expected = mock::item();
assert_eq!(output, expected); assert_eq!(output, expected);
} }
#[test] #[test]
fn test_item_to_string() { fn item_to_string() {
let output = mock::item().to_string(); let output = mock::item().to_string();
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);

View File

@ -189,7 +189,7 @@ mod test {
use crate::{ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote, new_unique_id, try_id}; use crate::{ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote, new_unique_id, try_id};
#[test] #[test]
fn test_to_base36() { fn to_base36() {
assert_eq!((37 as u64).to_base36(), "11"); assert_eq!((37 as u64).to_base36(), "11");
} }
@ -200,7 +200,7 @@ mod test {
} }
#[test] #[test]
fn test_string_to_segments() { fn string_to_segments() {
let output = segments_from_string( let output = segments_from_string(
include_str!("./test-resources/segments").to_string() include_str!("./test-resources/segments").to_string()
); );
@ -216,14 +216,14 @@ mod test {
} }
#[test] #[test]
fn test_quote() { fn quote() {
let output = "this is a string.\nIt has 2 lines".to_string().quote(); let output = "this is a string.\nIt has 2 lines".to_string().quote();
let expected = "\"\"\"\nthis is a string.\nIt has 2 lines\n\"\"\"".to_string(); let expected = "\"\"\"\nthis is a string.\nIt has 2 lines\n\"\"\"".to_string();
assert_eq!(output, expected); assert_eq!(output, expected);
} }
#[test] #[test]
fn test_unquote() { fn unquote() {
let output = "\"\"\"\nwho the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off\n\"\"\"".to_string().unquote(); let output = "\"\"\"\nwho the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off\n\"\"\"".to_string().unquote();
let expected = "who the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off".to_string(); let expected = "who the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off".to_string();
assert_eq!(output, expected); assert_eq!(output, expected);

View File

@ -53,7 +53,7 @@ mod test {
use crate::palette::Palette; use crate::palette::Palette;
#[test] #[test]
fn test_palette_from_string() { fn palette_from_string() {
let output = Palette::from("PAL 1\nNAME lamplight\n45,45,59\n66,60,39\n140,94,1".to_string()); let output = Palette::from("PAL 1\nNAME lamplight\n45,45,59\n66,60,39\n140,94,1".to_string());
let expected = Palette { let expected = Palette {
@ -82,7 +82,7 @@ mod test {
} }
#[test] #[test]
fn test_palette_from_string_no_name() { fn palette_from_string_no_name() {
let output = Palette::from("PAL 9\n45,45,59\n66,60,39\n140,94,1".to_string()); let output = Palette::from("PAL 9\n45,45,59\n66,60,39\n140,94,1".to_string());
let expected = Palette { let expected = Palette {
@ -111,7 +111,7 @@ mod test {
} }
#[test] #[test]
fn test_palette_to_string() { fn palette_to_string() {
let output = Palette { let output = Palette {
id: "g".to_string(), id: "g".to_string(),
name: Some("moss".to_string()), name: Some("moss".to_string()),

View File

@ -42,7 +42,7 @@ mod test {
use std::str::FromStr; use std::str::FromStr;
#[test] #[test]
fn test_position_from_str() { fn position_from_str() {
assert_eq!( assert_eq!(
Position::from_str(&"4,12").unwrap(), Position::from_str(&"4,12").unwrap(),
Position { x: 4, y: 12 } Position { x: 4, y: 12 }
@ -50,7 +50,7 @@ mod test {
} }
#[test] #[test]
fn test_position_to_string() { fn position_to_string() {
assert_eq!(Position { x: 4, y: 12 }.to_string(), "4,12".to_string()) assert_eq!(Position { x: 4, y: 12 }.to_string(), "4,12".to_string())
} }
} }

View File

@ -234,7 +234,7 @@ mod test {
use crate::game::{RoomType, RoomFormat}; use crate::game::{RoomType, RoomFormat};
#[test] #[test]
fn test_room_from_string() { fn room_from_string() {
assert_eq!( assert_eq!(
Room::from(include_str!("test-resources/room").to_string()), Room::from(include_str!("test-resources/room").to_string()),
crate::mock::room() crate::mock::room()
@ -242,7 +242,7 @@ mod test {
} }
#[test] #[test]
fn test_room_to_string() { fn room_to_string() {
assert_eq!( assert_eq!(
crate::mock::room().to_string(RoomFormat::CommaSeparated, RoomType::Room), crate::mock::room().to_string(RoomFormat::CommaSeparated, RoomType::Room),
include_str!("test-resources/room").to_string() include_str!("test-resources/room").to_string()
@ -250,7 +250,7 @@ mod test {
} }
#[test] #[test]
fn test_room_walls_array() { fn room_walls_array() {
let output = Room::from(include_str!("test-resources/room-with-walls").to_string()); let output = Room::from(include_str!("test-resources/room-with-walls").to_string());
assert_eq!(output.walls, vec!["a".to_string(), "f".to_string()]); assert_eq!(output.walls, vec!["a".to_string(), "f".to_string()]);

View File

@ -132,7 +132,7 @@ mod test {
use crate::sprite::Sprite; use crate::sprite::Sprite;
#[test] #[test]
fn test_sprite_from_string() { fn sprite_from_string() {
let string = include_str!("test-resources/sprite").to_string(); let string = include_str!("test-resources/sprite").to_string();
let output = Sprite::from(string).unwrap(); let output = Sprite::from(string).unwrap();
let expected = mock::sprite(); let expected = mock::sprite();
@ -141,7 +141,7 @@ mod test {
} }
#[test] #[test]
fn test_sprite_to_string() { fn sprite_to_string() {
assert_eq!(mock::sprite().to_string(), include_str!("test-resources/sprite").to_string()); assert_eq!(mock::sprite().to_string(), include_str!("test-resources/sprite").to_string());
} }
} }

View File

@ -135,7 +135,7 @@ mod test {
use crate::mock; use crate::mock;
#[test] #[test]
fn test_tile_from_string() { fn tile_from_string() {
let output = Tile::from(include_str!("test-resources/tile").to_string()); let output = Tile::from(include_str!("test-resources/tile").to_string());
let expected = Tile { let expected = Tile {
@ -152,7 +152,7 @@ mod test {
} }
#[test] #[test]
fn test_tile_to_string() { fn tile_to_string() {
let output = Tile { let output = Tile {
id: "7a".to_string(), id: "7a".to_string(),
name: Some("chequers".to_string()), name: Some("chequers".to_string()),
@ -171,7 +171,7 @@ mod test {
} }
#[test] #[test]
fn test_partial_eq() { fn partial_eq() {
let tile_a = crate::mock::tile_default(); let tile_a = crate::mock::tile_default();
let mut tile_b = crate::mock::tile_default(); let mut tile_b = crate::mock::tile_default();
tile_b.id = "0".to_string(); tile_b.id = "0".to_string();

View File

@ -30,7 +30,7 @@ mod test {
use crate::variable::Variable; use crate::variable::Variable;
#[test] #[test]
fn test_variable_from_string() { fn variable_from_string() {
assert_eq!( assert_eq!(
Variable::from("VAR a\n42".to_string()), Variable::from("VAR a\n42".to_string()),
Variable { Variable {
@ -41,7 +41,7 @@ mod test {
} }
#[test] #[test]
fn test_variable_to_string() { fn variable_to_string() {
let output = Variable { let output = Variable {
id: "c".to_string(), id: "c".to_string(),
initial_value: "57".to_string(), initial_value: "57".to_string(),