New file based cache for creature types and card names. +Test for cache consistency.

This commit is contained in:
magenoxx 2012-06-25 15:01:31 +04:00
parent 7d4aaec015
commit b6bb69f8b8
4 changed files with 173 additions and 0 deletions

35
Mage.Sets/src/mage/cache/CacheTest.java vendored Normal file
View file

@ -0,0 +1,35 @@
package mage.cache;
import mage.Constants;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.sets.Sets;
import org.junit.Assert;
import org.junit.Test;
import java.util.Set;
/**
* @author noxx
*/
public class CacheTest {
@Test
public void testCacheConsistency() {
//Set<String> names = Sets.getCardNames();
//Set<String> nonLandNames = Sets.getNonLandCardNames();
Set<String> creatureTypes = Sets.getCreatureTypes();
for (ExpansionSet set : Sets.getInstance().values()) {
for (Card card : set.getCards()) {
if (card.getCardType().contains(Constants.CardType.CREATURE)) {
for (String type : card.getSubtype()) {
if (!creatureTypes.contains(type)) {
Assert.assertTrue("Couldn't find a creature type in the cache: " + type, false);
}
}
}
}
}
}
}