Tests: Add Rarity Verify Test out of mtgjson data. (#10782)

* Tests: Add Rarity Verify Test out of mtgjson data.

* skip some of the Special rarity.

* remove skip (fixed in master)
This commit is contained in:
Susucre 2023-08-12 22:16:22 +02:00 committed by GitHub
parent 2d53668c96
commit 23cc483a09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 3 deletions

View file

@ -74,6 +74,7 @@ public class VerifyCardDataTest {
private static final String SKIP_LIST_TYPE = "TYPE";
private static final String SKIP_LIST_SUBTYPE = "SUBTYPE";
private static final String SKIP_LIST_NUMBER = "NUMBER";
private static final String SKIP_LIST_RARITY = "RARITY";
private static final String SKIP_LIST_MISSING_ABILITIES = "MISSING_ABILITIES";
private static final String SKIP_LIST_DOUBLE_RARE = "DOUBLE_RARE";
private static final String SKIP_LIST_UNSUPPORTED_SETS = "UNSUPPORTED_SETS";
@ -137,6 +138,10 @@ public class VerifyCardDataTest {
// number
skipListCreate(SKIP_LIST_NUMBER);
// rarity
skipListCreate(SKIP_LIST_RARITY);
skipListAddName(SKIP_LIST_RARITY, "CMR", "The Prismatic Piper"); // Collation is not yet set up for CMR https://www.lethe.xyz/mtg/collation/cmr.html
// missing abilities
skipListCreate(SKIP_LIST_MISSING_ABILITIES);
@ -1605,7 +1610,7 @@ public class VerifyCardDataTest {
checkSupertypes(card, ref);
checkTypes(card, ref);
checkColors(card, ref);
checkBasicLands(card, ref);
checkRarityAndBasicLands(card, ref);
checkMissingAbilities(card, ref);
checkWrongSymbolsInRules(card);
checkCardCanBeCopied(card);
@ -2291,7 +2296,10 @@ public class VerifyCardDataTest {
|| name.equals("Mountain");
}
private void checkBasicLands(Card card, MtgJsonCard ref) {
private void checkRarityAndBasicLands(Card card, MtgJsonCard ref) {
if (skipListHaveName(SKIP_LIST_RARITY, card.getExpansionSetCode(), card.getName())) {
return;
}
// basic lands must have Rarity.LAND and SuperType.BASIC
// other cards can't have that stats
@ -2314,6 +2322,8 @@ public class VerifyCardDataTest {
// non lands
if (card.getRarity() == Rarity.LAND) {
fail(card, "rarity", "only basic land can be Rarity.LAND");
} else if (!card.getRarity().equals(ref.getRarity())) {
fail(card, "rarity", "mismatched. MtgJson has " + ref.getRarity() + " while set file has " + card.getRarity());
}
if (card.isBasic()) {