diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java | 35 | ||||
-rw-r--r-- | src/test/resources/maps/bigInvalid.txt | 10 | ||||
-rw-r--r-- | src/test/resources/maps/bigValid.txt | 10 |
3 files changed, 55 insertions, 0 deletions
diff --git a/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java b/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java new file mode 100644 index 0000000..7be657d --- /dev/null +++ b/src/test/java/fr/umlv/java/wallj/board/BoardValidatorTest.java | |||
@@ -0,0 +1,35 @@ | |||
1 | package fr.umlv.java.wallj.board; | ||
2 | |||
3 | import org.junit.jupiter.api.Assertions; | ||
4 | import org.junit.jupiter.api.Test; | ||
5 | |||
6 | import java.io.IOException; | ||
7 | import java.net.URISyntaxException; | ||
8 | import java.nio.file.Path; | ||
9 | import java.nio.file.Paths; | ||
10 | |||
11 | /** | ||
12 | * @author Pacien TRAN-GIRARD | ||
13 | */ | ||
14 | final class BoardValidatorTest { | ||
15 | |||
16 | private Path getResourcePath(String str) throws URISyntaxException { | ||
17 | return Paths.get(getClass().getResource(str).toURI()); | ||
18 | } | ||
19 | |||
20 | @Test | ||
21 | void testConstraints() throws URISyntaxException, IOException { | ||
22 | Board validBoard = BoardParser.parse(getResourcePath("/maps/bigValid.txt")); | ||
23 | Assertions.assertTrue(BoardValidator.Constraint.isBounded(validBoard)); | ||
24 | Assertions.assertTrue(BoardValidator.Constraint.isHollow(validBoard)); | ||
25 | Assertions.assertTrue(BoardValidator.Constraint.hasActualReachableBlocks(validBoard)); | ||
26 | Assertions.assertTrue(BoardValidator.Constraint.hasMandatoryBlocks(validBoard)); | ||
27 | |||
28 | Board invalidBoard = BoardParser.parse(getResourcePath("/maps/bigInvalid.txt")); | ||
29 | Assertions.assertFalse(BoardValidator.Constraint.isBounded(invalidBoard)); | ||
30 | Assertions.assertFalse(BoardValidator.Constraint.isHollow(invalidBoard)); | ||
31 | Assertions.assertFalse(BoardValidator.Constraint.hasActualReachableBlocks(invalidBoard)); | ||
32 | Assertions.assertFalse(BoardValidator.Constraint.hasMandatoryBlocks(invalidBoard)); | ||
33 | } | ||
34 | |||
35 | } | ||
diff --git a/src/test/resources/maps/bigInvalid.txt b/src/test/resources/maps/bigInvalid.txt new file mode 100644 index 0000000..780af53 --- /dev/null +++ b/src/test/resources/maps/bigInvalid.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW W | ||
2 | W W W WWW W | ||
3 | W W W WTW W | ||
4 | WWWWWWWWWW W WWW W | ||
5 | W W W W | ||
6 | W W WWWWWWWWWWW | ||
7 | WWWWWWWWWW W | ||
8 | W W W | ||
9 | W W W | ||
10 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||
diff --git a/src/test/resources/maps/bigValid.txt b/src/test/resources/maps/bigValid.txt new file mode 100644 index 0000000..45bcacf --- /dev/null +++ b/src/test/resources/maps/bigValid.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | ||
2 | W WWWWWWWWWWW | ||
3 | W WWWWWWWWWWW | ||
4 | T WWWWWWWWWW WWWWWWWWWWW | ||
5 | T WWWWWWWWWW GGGGGGGGGGGGG WWWWWWWWWWW | ||
6 | T WWWWWWWWWW GGGGGGGG G WWWWWWWWWWW | ||
7 | T WWWWWWWWWW GGGGGGGGGGGGG W | ||
8 | W W W | ||
9 | W W W | ||
10 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||