Skip to content

Commit

Permalink
Add missing unreleased ships (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Antony Saba <antony@sabatechconsulting.com>
  • Loading branch information
awsaba and Antony Saba authored Jun 21, 2024
1 parent 2a82d48 commit 9cf543d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/expansions/expansions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12442,6 +12442,31 @@
"count": 1,
"type": "ship",
"xws": "upsilonclassshuttle"
},
{
"count": 1,
"type": "ship",
"xws": "tiecapunisher"
},
{
"count": 1,
"type": "ship",
"xws": "tiephphantom"
},
{
"count": 1,
"type": "ship",
"xws": "aggressorassaultfighter"
},
{
"count": 1,
"type": "ship",
"xws": "raiderclasscorvette"
},
{
"count": 1,
"type": "ship",
"xws": "gr75mediumtransport"
}
],
"name": "Unreleased for 2nd Edition",
Expand Down
21 changes: 21 additions & 0 deletions src/expansions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,25 @@ mod test {
}
}
}

#[test]
fn test_for_missing_ships() {
// checks if all the contents are valid xwsdata
let cat = Catalog::load().unwrap();

let data = Data::load_from_manifest(Path::new("xwing-data2")).unwrap();

for s in &data.ships {
let mut found = false;
'search: for (_, e) in &cat.expansions {
for i in &e.contents {
if i.item.r#type == ItemType::Ship && i.item.xws == s.xws {
found = true;
break 'search;
}
}
}
assert!(found, "ship not found in expansions: {}", s.xws);
}
}
}

0 comments on commit 9cf543d

Please sign in to comment.