aboutsummaryrefslogtreecommitdiff
path: root/test/ch/epfl/xblast/namecheck/NameCheck01.java
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-02-20 19:41:47 +0100
committerPacien TRAN-GIRARD2016-02-20 19:41:47 +0100
commitdf1880840db7bd8229d46118fb6d8508ecda61a1 (patch)
tree2dd2d307fde93c860d2645d62e42ecf90c94ceea /test/ch/epfl/xblast/namecheck/NameCheck01.java
parentb5644de85dda89829f20ca0106bf623f16c69090 (diff)
downloadxblast-df1880840db7bd8229d46118fb6d8508ecda61a1.tar.gz
Import first part unit tests
Diffstat (limited to 'test/ch/epfl/xblast/namecheck/NameCheck01.java')
-rw-r--r--test/ch/epfl/xblast/namecheck/NameCheck01.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/ch/epfl/xblast/namecheck/NameCheck01.java b/test/ch/epfl/xblast/namecheck/NameCheck01.java
new file mode 100644
index 0000000..278d85b
--- /dev/null
+++ b/test/ch/epfl/xblast/namecheck/NameCheck01.java
@@ -0,0 +1,49 @@
1package ch.epfl.xblast.namecheck;
2
3import java.util.List;
4
5import ch.epfl.xblast.Cell;
6import ch.epfl.xblast.Direction;
7import ch.epfl.xblast.SubCell;
8
9/**
10 * Classe abstraite utilisant tous les éléments de l'étape 1, pour essayer de
11 * garantir que ceux-ci ont le bon nom et les bons types. Attention, ceci n'est
12 * pas un test unitaire, et n'a pas pour but d'être exécuté!
13 */
14
15abstract class NameCheck01 {
16 void checkDirection() {
17 Direction d = Direction.N;
18 d = Direction.E;
19 d = Direction.S;
20 d = Direction.W;
21 if (d.isHorizontal() || d.isParallelTo(d))
22 d = d.opposite();
23 }
24
25 void checkCell() {
26 int c = Cell.COLUMNS;
27 int r = Cell.ROWS;
28 int t = Cell.COUNT;
29 List<Cell> l = Cell.ROW_MAJOR_ORDER;
30 l.get(c + r + t);
31 l = Cell.SPIRAL_ORDER;
32 l.get(c + r + t);
33 Cell d = new Cell(c, r);
34 c = d.x() + d.y() + d.rowMajorIndex();
35 d = d.neighbor(Direction.N);
36 }
37
38 void checkSubCell() {
39 SubCell c = SubCell.centralSubCellOf(new Cell(0,0));
40 c = new SubCell(0, 0);
41 int t = c.x() + c.y() + c.distanceToCentral();
42 if (t < 10 && c.isCentral())
43 c = c.neighbor(Direction.N);
44 else {
45 Cell cc = c.containingCell();
46 System.out.println(cc);
47 }
48 }
49}