diff options
Diffstat (limited to 'test/ch/epfl')
-rw-r--r-- | test/ch/epfl/xblast/GameStateSerializerTest.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/ch/epfl/xblast/GameStateSerializerTest.java b/test/ch/epfl/xblast/GameStateSerializerTest.java new file mode 100644 index 0000000..a701d2b --- /dev/null +++ b/test/ch/epfl/xblast/GameStateSerializerTest.java | |||
@@ -0,0 +1,39 @@ | |||
1 | package ch.epfl.xblast; | ||
2 | |||
3 | import ch.epfl.xblast.server.*; | ||
4 | import ch.epfl.xblast.server.Level; | ||
5 | import org.junit.Assert; | ||
6 | import org.junit.Test; | ||
7 | |||
8 | import java.util.ArrayList; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.List; | ||
11 | |||
12 | /** | ||
13 | * @author Timothée FLOURE (257420) | ||
14 | */ | ||
15 | public class GameStateSerializerTest { | ||
16 | |||
17 | @Test | ||
18 | public void GameStateSerializerTest() { | ||
19 | List<Integer> integerExpectedValues = Arrays.asList(121, -50, 2, 1, -2, 0, 3, 1, 3, 1, -2, 0, 1, 1, 3, 1, 3, | ||
20 | 1, 3, 1, 1, -2, 0, 1, 3, 1, 3, -2, 0, -1, 1, 3, 1, 3, 1, | ||
21 | 3, 1, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, | ||
22 | 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, | ||
23 | 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 1, 0, 0, 1, 3, | ||
24 | 1, 3, 0, 0, -1, 1, 3, 1, 1, -5, 2, 3, 2, 3, -5, 2, 3, 2, | ||
25 | 3, 1, -2, 0, 3, -2, 0, 1, 3, 2, 1, 2, 4, -128, 16, -63, | ||
26 | 16, 3, 24, 24, 6, 3, -40, 24, 26, 3, -40, -72, 46, 3, 24, | ||
27 | -72, 66, 60); | ||
28 | List<Byte> expectedValues = new ArrayList<>(); | ||
29 | |||
30 | for (Integer i : integerExpectedValues) { | ||
31 | expectedValues.add((byte) i.intValue()); | ||
32 | } | ||
33 | |||
34 | Assert.assertEquals( | ||
35 | expectedValues, | ||
36 | GameStateSerializer.serialize(Level.DEFAULT_LEVEL.painter(), Level.DEFAULT_LEVEL.initialState()) | ||
37 | ); | ||
38 | } | ||
39 | } | ||