mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Tests: added mage-verify warning test for missing sets in xmage (current missing sets: 34 with 1689 cards)
This commit is contained in:
parent
e87db19b7d
commit
c4fe9e3121
3 changed files with 67 additions and 0 deletions
|
@ -10,6 +10,7 @@ class JsonSet {
|
|||
public String gathererCode;
|
||||
public String magicCardsInfoCode;
|
||||
public String[] magicRaritiesCodes;
|
||||
public String[] alternativeNames;
|
||||
public String releaseDate;
|
||||
public String border;
|
||||
public String type;
|
||||
|
|
|
@ -16,6 +16,36 @@ import java.util.Map;
|
|||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public final class MtgJson {
|
||||
|
||||
public static Map<String, String> mtgJsonToXMageCodes = new HashMap<>();
|
||||
public static Map<String, String> xMageToMtgJsonCodes = new HashMap<>();
|
||||
|
||||
static {
|
||||
mtgJsonToXMageCodes.put("pWCQ", "WMCQ");
|
||||
mtgJsonToXMageCodes.put("pSUS", "SUS");
|
||||
mtgJsonToXMageCodes.put("pPRE", "PTC");
|
||||
mtgJsonToXMageCodes.put("pMPR", "MPRP");
|
||||
mtgJsonToXMageCodes.put("pMEI", "MBP");
|
||||
mtgJsonToXMageCodes.put("pGTW", "GRC"); // pGTW - Gateway = GRC - WPN Gateway ???
|
||||
mtgJsonToXMageCodes.put("pGRU", "GUR");
|
||||
mtgJsonToXMageCodes.put("pGPX", "GPX");
|
||||
mtgJsonToXMageCodes.put("pFNM", "FNMP");
|
||||
mtgJsonToXMageCodes.put("pELP", "EURO");
|
||||
mtgJsonToXMageCodes.put("pARL", "ARENA");
|
||||
mtgJsonToXMageCodes.put("pALP", "APAC");
|
||||
mtgJsonToXMageCodes.put("PO2", "P02");
|
||||
mtgJsonToXMageCodes.put("DD3_JVC", "DD3JVC");
|
||||
mtgJsonToXMageCodes.put("DD3_GVL", "DDD");
|
||||
mtgJsonToXMageCodes.put("DD3_EVG", "DD3EVG");
|
||||
mtgJsonToXMageCodes.put("DD3_DVD", "DDC");
|
||||
mtgJsonToXMageCodes.put("NMS", "NEM");
|
||||
|
||||
// revert search
|
||||
for(Map.Entry<String, String> entry: mtgJsonToXMageCodes.entrySet()){
|
||||
xMageToMtgJsonCodes.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
private MtgJson() {}
|
||||
|
||||
private static final class CardHolder {
|
||||
|
|
|
@ -180,6 +180,42 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkMissingSets(){
|
||||
|
||||
Collection<String> errorsList = new ArrayList<>();
|
||||
|
||||
int totalMissingSets = 0;
|
||||
int totalMissingCards = 0;
|
||||
Collection<ExpansionSet> sets = Sets.getInstance().values();
|
||||
for(Map.Entry<String, JsonSet> refEntry: MtgJson.sets().entrySet()){
|
||||
JsonSet refSet = refEntry.getValue();
|
||||
|
||||
// replace codes for aliases
|
||||
String searchSet = MtgJson.mtgJsonToXMageCodes.getOrDefault(refSet.code, refSet.code);
|
||||
|
||||
ExpansionSet mageSet = Sets.findSet(searchSet);
|
||||
if(mageSet == null){
|
||||
totalMissingSets = totalMissingSets + 1;
|
||||
totalMissingCards = totalMissingCards + refSet.cards.size();
|
||||
errorsList.add("Warning: missing set " + refSet.code + " - " + refSet.name + " (cards: " + refSet.cards.size() + ")");
|
||||
}
|
||||
}
|
||||
if(errorsList.size() > 0){
|
||||
errorsList.add("Warning: total missing sets: " + totalMissingSets + ", with missing cards: " + totalMissingCards);
|
||||
}
|
||||
|
||||
|
||||
for (String error: errorsList) {
|
||||
System.out.println(error);
|
||||
}
|
||||
|
||||
if (errorsList.size() > 0){
|
||||
|
||||
//Assert.fail("DB have wrong card classes, founded errors: " + errorsList.size());
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern SHORT_JAVA_STRING = Pattern.compile("(?<=\")[A-Z][a-z]+(?=\")");
|
||||
|
||||
private Set<String> findSourceTokens(Class c) throws IOException {
|
||||
|
|
Loading…
Reference in a new issue