From 59d2b59a4fda1329b41c9215d4197cea7af9c63b Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 7 Apr 2023 00:31:02 +0400 Subject: [PATCH] Tests: added verify check for wrong set names (disabled until 40k cards merge) --- .../java/mage/verify/VerifyCardDataTest.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index c8ab225c80..8c2103193c 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -877,8 +877,8 @@ public class VerifyCardDataTest { // CHECK: wrong basic lands settings (it's for lands search, not booster construct) for (ExpansionSet set : sets) { - Boolean needLand = set.hasBasicLands(); - Boolean foundLand = false; + boolean needLand = set.hasBasicLands(); + boolean foundLand = false; Map foundLandsList = new HashMap<>(); for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) { if (isBasicLandName(card.getName())) { @@ -924,6 +924,24 @@ public class VerifyCardDataTest { } } + // CHECK: wrong set name + for (ExpansionSet set : sets) { + if (true) continue; // TODO: enable after merge of 40k's cards pull requests (needs before set rename) + MtgJsonSet jsonSet = MtgJsonService.sets().getOrDefault(set.getCode().toUpperCase(Locale.ENGLISH), null); + if (jsonSet == null) { + // unofficial or inner set + continue; + } + if (!Objects.equals(set.getName(), jsonSet.name)) { + // how-to fix: rename xmage set to the json version or fix a set's code + // also don't forget to change names in mtg-cards-data.txt + errorsList.add(String.format("Error: wrong set name or set code: %s (mtgjson set for same code: %s)", + set.getCode() + " - " + set.getName(), + jsonSet.name + )); + } + } + // TODO: add test to check num cards for rarity (rarityStats > 0 and numRarity > 0) printMessages(warningsList); printMessages(errorsList);