mirror of
https://github.com/correl/mage.git
synced 2024-12-03 03:00:10 +00:00
Tests: added non-ascii symbols checks in card numbers and names;
This commit is contained in:
parent
66a8994318
commit
025ba9bb47
1 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
package mage.verify;
|
package mage.verify;
|
||||||
|
|
||||||
|
import com.google.common.base.CharMatcher;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.keyword.ScryEffect;
|
import mage.abilities.effects.keyword.ScryEffect;
|
||||||
|
@ -683,17 +684,15 @@ public class VerifyCardDataTest {
|
||||||
|
|
||||||
Collection<ExpansionSet> sets = Sets.getInstance().values();
|
Collection<ExpansionSet> 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) {
|
for (ExpansionSet set : sets) {
|
||||||
|
|
||||||
// double names
|
|
||||||
Map<String, Integer> doubleNames = new HashMap<>();
|
Map<String, Integer> doubleNames = new HashMap<>();
|
||||||
for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) {
|
for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) {
|
||||||
int count = doubleNames.getOrDefault(card.getName(), 0);
|
int count = doubleNames.getOrDefault(card.getName(), 0);
|
||||||
doubleNames.put(card.getName(), count + 1);
|
doubleNames.put(card.getName(), count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check double names
|
|
||||||
for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) {
|
for (ExpansionSet.SetCardInfo card : set.getSetCardInfo()) {
|
||||||
boolean cardHaveDoubleName = (doubleNames.getOrDefault(card.getName(), 0) > 1);
|
boolean cardHaveDoubleName = (doubleNames.getOrDefault(card.getName(), 0) > 1);
|
||||||
boolean cardHaveVariousSetting = card.getGraphicInfo() != null && card.getGraphicInfo().getUsesVariousArt();
|
boolean cardHaveVariousSetting = card.getGraphicInfo() != null && card.getGraphicInfo().getUsesVariousArt();
|
||||||
|
@ -711,14 +710,19 @@ public class VerifyCardDataTest {
|
||||||
cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo()));
|
cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo()));
|
||||||
Assert.assertNotNull(card);
|
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)) {
|
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());
|
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
|
// https://github.com/magefree/mage/issues/6300
|
||||||
card.getMana();
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue