test omnibus (officially / with permission)
This commit is contained in:
parent
ff70efd115
commit
c1cac86c1a
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,3 @@
|
||||
/target
|
||||
/Cargo.lock
|
||||
/.idea/
|
||||
/src/test-resources/
|
||||
/src/test-resources/omnibus/
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "src/test-resources/omnibus"]
|
||||
path = src/test-resources/omnibus
|
||||
url = https://github.com/Ragzouken/bitsy-archive.git
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bitsy-parser"
|
||||
version = "0.72.2"
|
||||
version = "0.72.3"
|
||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||
edition = "2018"
|
||||
description = "A parser and utilities for working with Bitsy game data"
|
||||
|
||||
1
src/test-resources/omnibus
Submodule
1
src/test-resources/omnibus
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c3834a9c21db8f6d3120320201b8472cfa7aad9f
|
||||
517
src/test_omnibus.rs
Normal file
517
src/test_omnibus.rs
Normal file
@ -0,0 +1,517 @@
|
||||
mod test {
|
||||
use crate::game::Game;
|
||||
|
||||
/// bitsy-parser will parse these games correctly
|
||||
/// but the output does not match the input, due to game data errors
|
||||
/// todo this array of game names does not work for unnamed games or duplicate game names
|
||||
const ACCEPTED_FAILURES: [&str; 27] = [
|
||||
// position out of bounds e.g. "5, -1"
|
||||
"SweetPea Village",
|
||||
"Sunset Shore",
|
||||
"==GIRLS OWN THE VOID=={br}a faux platformer",
|
||||
// extra tiles in room (this was an old editor bug)
|
||||
"I can't run anymore. They won't give up. I need water.",
|
||||
"Picnic at Castle Island",
|
||||
"whatever you were doing ran later than expected and now it's",
|
||||
"Goodfishas",
|
||||
"Dont Go South",
|
||||
"stars",
|
||||
"We live in an increasingly connected world where we are incentivised to share every visual stimulus and emotional trigger that we encounter. ",
|
||||
"No Snow",
|
||||
"Cryptid Hunt feat. Mothman",
|
||||
"SCREEECH! THUNK.",
|
||||
"Vitreous",
|
||||
// extraneous character at end of file
|
||||
"I Dream of Pixels",
|
||||
"You arrive at a party.",
|
||||
// extraneous whitespace
|
||||
"sun machine",
|
||||
"THE BITSY MYSTERY DUNGEON{br}A game by everyone",
|
||||
"THE UNSEEN LIGHT{br}For Gothic Novel Jam 2018",
|
||||
// extra pixels in image (another old editor bug)
|
||||
"Write your game's title hevery blind (just without glasses but look my eyesight is very my eye sight is not good ok) (also i had a drink but am barely even tipsy but whatever)",
|
||||
"Dog Walking, Dog Running, and Dog Still.",
|
||||
"startup sequence...",
|
||||
"A Bit of Reverie",
|
||||
"I am lost on this planet Alone, yet crowded by thoughts",
|
||||
"Four Corners",
|
||||
"the fox and the moon",
|
||||
// unexpected ordering of game data
|
||||
"here are my cats",
|
||||
];
|
||||
|
||||
fn str(s: &str) {
|
||||
let result = Game::from(s.to_string());
|
||||
|
||||
if result.is_err() {
|
||||
print!("{:?}", result);
|
||||
}
|
||||
|
||||
assert!(result.is_ok());
|
||||
|
||||
let game = result.expect("failed to parse game");
|
||||
|
||||
if ACCEPTED_FAILURES.contains(&&*game.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
game.to_string().trim_matches('\n'),
|
||||
s.to_string().trim_matches('\n'),
|
||||
"output does not match input"
|
||||
);
|
||||