Skip to content

Commit

Permalink
Tests: improved verify checks for missing/wrong abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Jun 30, 2019
1 parent ec93f50 commit 2de535f
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,15 @@ private String prepareRule(String cardName, String rule) {
String newRule = rule;

// remove reminder text
newRule = newRule.replaceAll("(?i)<i>\\(.+\\)</i>", "");
newRule = newRule.replaceAll("(?i) <i>\\(.+\\)</i>", "");
newRule = newRule.replaceAll("(?i) \\(.+\\)", "");

// replace special text and symbols
newRule = newRule
.replace("{this}", cardName)
.replace("&mdash;", "—");
.replace("{source}", cardName)
.replace("−", "-")
.replace("&mdash;", "-");

// remove html marks
newRule = newRule
Expand All @@ -757,7 +760,7 @@ public void showCardInfo() throws Exception {

private void checkWrongAbilitiesText(Card card, JsonCard ref) {
// checks missing or wrong text
if (!card.getExpansionSetCode().equals("MH1")) {
if (!card.getExpansionSetCode().equals("M20")) {
return;
}

Expand All @@ -781,6 +784,7 @@ private void checkWrongAbilitiesText(Card card, JsonCard ref) {
cardRules[i] = prepareRule(card.getName(), cardRules[i]);
}

boolean isFine = true;
for (String cardRule : cardRules) {
boolean isAbilityFounded = false;
for (String refRule : refRules) {
Expand All @@ -791,9 +795,29 @@ private void checkWrongAbilitiesText(Card card, JsonCard ref) {
}

if (!isAbilityFounded) {
isFine = false;
warn(card, "card ability can't be found in ref [" + card.getName() + ": " + cardRule + "]");
}
}

// extra message for easy checks
if (!isFine) {
System.out.println();

System.out.println("Wrong card " + card.getName());
Arrays.sort(cardRules);
for (String s : cardRules) {
System.out.println(s);
}

System.out.println("ref:");
Arrays.sort(refRules);
for (String s : refRules) {
System.out.println(s);
}

System.out.println();
}
}


Expand Down

0 comments on commit 2de535f

Please sign in to comment.