aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ch/epfl/xblast/namecheck/NameCheck03.java89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/ch/epfl/xblast/namecheck/NameCheck03.java b/test/ch/epfl/xblast/namecheck/NameCheck03.java
new file mode 100644
index 0000000..fc2a4b5
--- /dev/null
+++ b/test/ch/epfl/xblast/namecheck/NameCheck03.java
@@ -0,0 +1,89 @@
1package ch.epfl.xblast.namecheck;
2
3import ch.epfl.cs108.Sq;
4import ch.epfl.xblast.*;
5import ch.epfl.xblast.server.Bomb;
6import ch.epfl.xblast.server.Player;
7
8import java.util.List;
9
10/**
11 * Classe abstraite utilisant tous les éléments de l'étape 3, pour essayer de
12 * garantir que ceux-ci ont le bon nom et les bons types. Attention, ceci n'est
13 * pas un test unitaire, et n'a pas pour but d'être exécuté!
14 *
15 * @author EPFL
16 */
17abstract class NameCheck03 {
18
19 void checkArgumentChecker() {
20 ArgumentChecker.requireNonNegative(10);
21 }
22
23 void checkPlayerID() {
24 ArgumentChecker.requireNonNegative(PlayerID.PLAYER_1.ordinal());
25 ArgumentChecker.requireNonNegative(PlayerID.PLAYER_2.ordinal());
26 ArgumentChecker.requireNonNegative(PlayerID.PLAYER_3.ordinal());
27 ArgumentChecker.requireNonNegative(PlayerID.PLAYER_4.ordinal());
28 }
29
30 void checkPlayerState() {
31 ArgumentChecker.requireNonNegative(Player.LifeState.State.INVULNERABLE.ordinal());
32 ArgumentChecker.requireNonNegative(Player.LifeState.State.VULNERABLE.ordinal());
33 ArgumentChecker.requireNonNegative(Player.LifeState.State.DYING.ordinal());
34 ArgumentChecker.requireNonNegative(Player.LifeState.State.DEAD.ordinal());
35 Player.LifeState.State k = null;
36 Player.LifeState t = new Player.LifeState(-1, k);
37 k = t.state();
38 int l = t.lives();
39 System.out.println(t.canMove() ? l : "");
40 }
41
42 void checkPlayerDirectedPosition() {
43 Player.DirectedPosition p = null;
44 Sq<Player.DirectedPosition> s = Player.DirectedPosition.stopped(p);
45 Sq<Player.DirectedPosition> m = Player.DirectedPosition.moving(p);
46 SubCell c = m.head().position();
47 Direction d = s.head().direction();
48 p = new Player.DirectedPosition(c, d);
49 p = s.head().withDirection(d);
50 p = m.head().withPosition(c);
51 }
52
53 void checkPlayer() {
54 PlayerID pid = null;
55 Sq<Player.LifeState> s = null;
56 Sq<Player.DirectedPosition> d = null;
57 Player p = new Player(pid, s, d, -1, -1);
58 Cell c = null;
59 p = new Player(pid, -1, c, -1, -1);
60 pid = p.id();
61 s = p.lifeStates();
62 Player.LifeState s1 = p.lifeState();
63 s = p.statesForNextLife();
64 int l = p.lives() + p.maxBombs() + p.bombRange();
65 if (p.isAlive() || l > 2 || s1 != null)
66 ++l;
67 p = p.withBombRange(-1).withMaxBombs(-1);
68 Bomb b = p.newBomb();
69 d = p.directedPositions();
70 Direction d2 = p.direction();
71 SubCell pos = p.position();
72 System.out.println(b.toString() + d2 + pos);
73 }
74
75 void checkBomb() {
76 PlayerID pid = null;
77 Cell c = null;
78 Sq<Integer> s = null;
79 Bomb b = new Bomb(pid, c, s, -1);
80 b = new Bomb(pid, c, -1, -1);
81 pid = b.ownerId();
82 c = b.position();
83 int t = b.fuseLength() + b.range();
84 s = b.fuseLengths();
85 List<Sq<Sq<Cell>>> x = b.explosion();
86 System.out.println(String.valueOf(t) + x);
87 }
88
89}