From ceb1ac5ca1e08095150c1dbb971540149a455673 Mon Sep 17 00:00:00 2001 From: Timothée Floure Date: Thu, 28 Apr 2016 14:16:41 +0200 Subject: Broken part 7 --- test/ch/epfl/xblast/GameStateSerializerTest.java | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/ch/epfl/xblast/GameStateSerializerTest.java (limited to 'test') 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 @@ +package ch.epfl.xblast; + +import ch.epfl.xblast.server.*; +import ch.epfl.xblast.server.Level; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author Timothée FLOURE (257420) + */ +public class GameStateSerializerTest { + + @Test + public void GameStateSerializerTest() { + List integerExpectedValues = Arrays.asList(121, -50, 2, 1, -2, 0, 3, 1, 3, 1, -2, 0, 1, 1, 3, 1, 3, + 1, 3, 1, 1, -2, 0, 1, 3, 1, 3, -2, 0, -1, 1, 3, 1, 3, 1, + 3, 1, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, + 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 1, 0, 0, 1, 3, + 1, 3, 0, 0, -1, 1, 3, 1, 1, -5, 2, 3, 2, 3, -5, 2, 3, 2, + 3, 1, -2, 0, 3, -2, 0, 1, 3, 2, 1, 2, 4, -128, 16, -63, + 16, 3, 24, 24, 6, 3, -40, 24, 26, 3, -40, -72, 46, 3, 24, + -72, 66, 60); + List expectedValues = new ArrayList<>(); + + for (Integer i : integerExpectedValues) { + expectedValues.add((byte) i.intValue()); + } + + Assert.assertEquals( + expectedValues, + GameStateSerializer.serialize(Level.DEFAULT_LEVEL.painter(), Level.DEFAULT_LEVEL.initialState()) + ); + } +} -- cgit v1.2.3