aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimothée Floure2016-04-28 14:16:41 +0200
committerTimothée Floure2016-04-28 14:16:41 +0200
commitceb1ac5ca1e08095150c1dbb971540149a455673 (patch)
treea0f80b08a78a13a90e31788b2d06f34ac04a23f9 /test
parentbd7c60725cdd0ad94f4854b67adf89dda5e4af57 (diff)
downloadxblast-ceb1ac5ca1e08095150c1dbb971540149a455673.tar.gz
Broken part 7
Diffstat (limited to 'test')
-rw-r--r--test/ch/epfl/xblast/GameStateSerializerTest.java39
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 @@
1package ch.epfl.xblast;
2
3import ch.epfl.xblast.server.*;
4import ch.epfl.xblast.server.Level;
5import org.junit.Assert;
6import org.junit.Test;
7
8import java.util.ArrayList;
9import java.util.Arrays;
10import java.util.List;
11
12/**
13 * @author Timothée FLOURE (257420)
14 */
15public 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}