diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-03 19:06:12 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-03 19:06:12 +0200 |
commit | f8f75fde6d6392aee2504df5bde05459d0b0c36f (patch) | |
tree | 09019063beba8047a6bfb3570365427b871a2ae1 /test | |
parent | 2eaf873ec6dc8b7362896cdfe7fe1dc78230b18e (diff) | |
download | JRummikub-f8f75fde6d6392aee2504df5bde05459d0b0c36f.tar JRummikub-f8f75fde6d6392aee2504df5bde05459d0b0c36f.zip |
Classification of runs and sets
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@83 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r-- | test/jrummikub/model/StoneSetTest.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/test/jrummikub/model/StoneSetTest.java b/test/jrummikub/model/StoneSetTest.java index 196090e..b3d77bd 100644 --- a/test/jrummikub/model/StoneSetTest.java +++ b/test/jrummikub/model/StoneSetTest.java @@ -6,6 +6,7 @@ import java.util.List; import jrummikub.util.Pair; import static jrummikub.model.StoneColor.*; +import static jrummikub.model.StoneSet.Type.*; import org.junit.*; import static org.junit.Assert.*; @@ -14,38 +15,38 @@ public class StoneSetTest { // Is Valid-Test // valid - public void assertSet(boolean valid, List<Stone> stones) { + public void assertSet(StoneSet.Type expectedType, List<Stone> stones) { StoneSet set = new StoneSet(stones); - assertTrue(valid == set.isValid()); + assertSame(expectedType, set.classify()); } @Test public void doubleJoker() { - assertSet(true, Arrays.asList(new Stone(RED), new Stone(BLACK), + assertSet(GROUP, Arrays.asList(new Stone(RED), new Stone(BLACK), new Stone(1, BLACK))); } @Test public void groups() { - assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), + assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), new Stone(1, BLUE))); - assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), + assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), new Stone(1, BLUE), new Stone(1, ORANGE))); } @Test public void runs() { - assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(2, RED), + assertSet(RUN, Arrays.asList(new Stone(1, RED), new Stone(2, RED), new Stone(3, RED))); - assertSet(true, Arrays.asList(new Stone(4, BLUE), new Stone(5, BLUE), + assertSet(RUN, Arrays.asList(new Stone(4, BLUE), new Stone(5, BLUE), new Stone(6, BLUE))); } @Test public void singleJoker() { - assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), + assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), new Stone(RED))); - assertSet(true, Arrays.asList(new Stone(2, RED), new Stone(3, RED), + assertSet(RUN, Arrays.asList(new Stone(2, RED), new Stone(3, RED), new Stone(BLACK))); } @@ -53,41 +54,41 @@ public class StoneSetTest { @Test public void outOfBounds() { - assertSet(false, Arrays.asList(new Stone(RED), new Stone(1, RED), + assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(1, RED), new Stone(2, RED))); - assertSet(false, Arrays.asList(new Stone(12, RED), new Stone(13, RED), + assertSet(INVALID, Arrays.asList(new Stone(12, RED), new Stone(13, RED), new Stone(RED))); - assertSet(false, Arrays.asList(new Stone(RED), new Stone(BLACK), + assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(BLACK), new Stone(1, RED), new Stone(2, RED))); } @Test public void sameColor() { - assertSet(false, Arrays.asList(new Stone(1, RED), new Stone(1, RED), + assertSet(INVALID, Arrays.asList(new Stone(1, RED), new Stone(1, RED), new Stone(1, BLUE))); - assertSet(false, Arrays.asList(new Stone(1, RED), new Stone(1, BLUE), + assertSet(INVALID, Arrays.asList(new Stone(1, RED), new Stone(1, BLUE), new Stone(1, BLACK), new Stone(1, ORANGE), new Stone(RED))); } @Test public void incorrectOrder() { - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(6, RED), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED), new Stone(5, RED))); - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(6, RED), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED), new Stone(RED))); - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(RED), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(RED), new Stone(5, RED))); } @Test public void otherInvalid() { - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, RED), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, RED), new Stone(7, RED))); - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, BLUE), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, BLUE), new Stone(6, RED))); - assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, RED))); - assertSet(false, Arrays.asList(new Stone(4, BLUE), new Stone(5, RED), + assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, RED))); + assertSet(INVALID, Arrays.asList(new Stone(4, BLUE), new Stone(5, RED), new Stone(6, RED))); } |