From 025ba9bb47b4731070a973a09d81327226d29502 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 8 Aug 2020 18:53:00 +0400 Subject: [PATCH] Tests: added non-ascii symbols checks in card numbers and names; --- .../test/java/mage/verify/VerifyCardDataTest.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index 896246e28b..e4da05ec29 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -1,5 +1,6 @@ package mage.verify; +import com.google.common.base.CharMatcher; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.effects.keyword.ScryEffect; @@ -683,17 +684,15 @@ public class VerifyCardDataTest { Collection sets = Sets.getInstance().values(); - // 1. wrong UsesVariousArt settings (set have duplicated card name without that setting -- e.g. cards will have same image) + // CHECK: wrong UsesVariousArt settings (set have duplicated card name without that setting -- e.g. cards will have same image) for (ExpansionSet set : sets) { - // double names Map doubleNames = new HashMap<>(); for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) { int count = doubleNames.getOrDefault(card.getName(), 0); doubleNames.put(card.getName(), count + 1); } - // check double names for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) { boolean cardHaveDoubleName = (doubleNames.getOrDefault(card.getName(), 0) > 1); boolean cardHaveVariousSetting = card.getGraphicInfo() != null && card.getGraphicInfo().getUsesVariousArt(); @@ -711,14 +710,19 @@ public class VerifyCardDataTest { cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo())); Assert.assertNotNull(card); - // 2. all planeswalkers must be legendary + // CHECK: all planeswalkers must be legendary if (card.getCardType().contains(CardType.PLANESWALKER) && !card.getSuperType().contains(SuperType.LEGENDARY)) { errorsList.add("error, planeswalker must have legendary type: " + set.getCode() + " - " + set.getName() + " - " + card.getName() + " - " + card.getCardNumber()); } - // 3. check that getMana works without NPE errors (it uses getNetMana with empty game param for AI score calcs) + // CHECK: getMana must works without NPE errors (it uses getNetMana with empty game param for AI score calcs) // https://github.com/magefree/mage/issues/6300 card.getMana(); + + // CHECK: non ascii symbols in card numbers + if (!CharMatcher.ascii().matchesAllOf(card.getName()) || !CharMatcher.ascii().matchesAllOf(card.getCardNumber())) { + errorsList.add("error, card name or number contains non-ascii symbols: " + set.getCode() + " - " + set.getName() + " - " + card.getName() + " - " + card.getCardNumber()); + } } }