aboutsummaryrefslogtreecommitdiffstats
path: root/test/eu/equalparts/cardbase/decks/StatisticsTest.java
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2016-03-26 14:16:42 +0100
committerEduardo Pedroni <e.pedroni91@gmail.com>2016-03-26 14:16:42 +0100
commit19800a0886d51220f28f85f3845c74e7f46500e3 (patch)
tree73ec9bc1dee88e0fac83c99c3bd98b07a9904379 /test/eu/equalparts/cardbase/decks/StatisticsTest.java
parent5a9327b4721d50cee954369eaf25d096ac8b9c52 (diff)
Refactored storage hierarchy, now need to look into decks again
Diffstat (limited to 'test/eu/equalparts/cardbase/decks/StatisticsTest.java')
-rw-r--r--test/eu/equalparts/cardbase/decks/StatisticsTest.java148
1 files changed, 0 insertions, 148 deletions
diff --git a/test/eu/equalparts/cardbase/decks/StatisticsTest.java b/test/eu/equalparts/cardbase/decks/StatisticsTest.java
deleted file mode 100644
index 6210f89..0000000
--- a/test/eu/equalparts/cardbase/decks/StatisticsTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package eu.equalparts.cardbase.decks;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import eu.equalparts.cardbase.decks.StandaloneDeck;
-import eu.equalparts.cardbase.decks.Statistics;
-
-public class StatisticsTest {
-
- private static StandaloneDeck uut;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- ObjectMapper mapper = new ObjectMapper();
- uut = mapper.readValue(StatisticsTest.class.getResourceAsStream("deck.cbd"), StandaloneDeck.class);
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void test_totalLandCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Land");
-
- assertEquals(23, count);
- }
-
- @Test
- public void test_basicLandCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Basic Land");
-
- assertEquals(20, count);
- }
-
- @Test
- public void test_cardCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut);
-
- assertEquals(60, count);
- }
-
- @Test
- public void test_landPercentageIsComputedCorrectly() throws Exception {
- double percentage = Statistics.calculatePercentage(uut, "Land");
-
- assertTrue("Land percentage should be " + (23.0 / 60.0) + ", is " + percentage, percentage == (23.0 / 60.0));
- }
-
- @Test
- public void test_creaturePercentageIsComputedCorrectly() throws Exception {
- double percentage = Statistics.calculatePercentage(uut, "Creature");
-
- assertTrue("Creature percentage should be " + (24.0 / 60.0) + ", is " + percentage, percentage == (24.0 / 60.0));
- }
-
- @Test
- public void test_creatureCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Creature");
-
- assertEquals(24, count);
- }
-
- @Test
- public void test_sorceryCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Sorcery");
-
- assertEquals(1, count);
- }
-
- @Test
- public void test_instantCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Instant");
-
- assertEquals(6, count);
- }
-
- @Test
- public void test_planeswalkerCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Planeswalker");
-
- assertEquals(0, count);
- }
-
- @Test
- public void test_elfCountIsComputedCorrectly() throws Exception {
- int count = Statistics.count(uut, "Elf");
-
- assertEquals(2, count);
- }
-
- @Test
- public void test_overallCostDistributionIsComputedCorrectly() throws Exception {
- int[] actualCosts = Statistics.computeDistribution(uut);
- int[] expectedCosts = {0, 8, 11, 3, 4, 7, 4};
-
- assertEquals("Array lengths do not match.", expectedCosts.length, actualCosts.length);
- for (int i = 0; i < expectedCosts.length; i++) {
- assertEquals("CMC: " + i, expectedCosts[i], actualCosts[i]);
- }
- }
-
- @Test
- public void test_creatureCostDistributionIsComputedCorrectly() throws Exception {
- int[] actualCosts = Statistics.computeDistribution(uut, "Creature");
- int[] expectedCosts = {0, 3, 6, 2, 2, 7, 4};
-
- assertEquals("Array lengths do not match.", expectedCosts.length, actualCosts.length);
- for (int i = 0; i < expectedCosts.length; i++) {
- assertEquals("CMC: " + i, expectedCosts[i], actualCosts[i]);
- }
- }
-
- @Test
- public void test_instantCostDistributionIsComputedCorrectly() throws Exception {
- int[] actualCosts = Statistics.computeDistribution(uut, "Instant");
- int[] expectedCosts = {0, 2, 4};
-
- assertEquals("Array lengths do not match.", expectedCosts.length, actualCosts.length);
- for (int i = 0; i < expectedCosts.length; i++) {
- assertEquals("CMC: " + i, expectedCosts[i], actualCosts[i]);
- }
- }
-
- @Test
- public void test_planeswalkerCostDistributionIsComputedCorrectly() throws Exception {
- int[] actualCosts = Statistics.computeDistribution(uut, "Planeswalker");
- int[] expectedCosts = {};
-
- assertEquals("Array lengths do not match.", expectedCosts.length, actualCosts.length);
- for (int i = 0; i < expectedCosts.length; i++) {
- assertEquals("CMC: " + i, expectedCosts[i], actualCosts[i]);
- }
- }
-
-} \ No newline at end of file