From f8f75fde6d6392aee2504df5bde05459d0b0c36f Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 3 May 2011 19:06:12 +0200 Subject: Classification of runs and sets git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@83 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/model/StoneSetTest.java | 43 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'test') 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 stones) { + public void assertSet(StoneSet.Type expectedType, List 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))); } -- cgit v1.2.3