Skip to content

Commit

Permalink
Minion factory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrb10014 committed May 1, 2015
1 parent be175f0 commit c64d9dd
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/MinionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ public int getNum() {
return id;
}

public int getX() {
return X;
}

public int getY() {
return Y;
}
public int getMax() {
return Max;
}

public void assignAllDamage() {
int i = 0;
while (i < id) {
Expand Down
59 changes: 59 additions & 0 deletions src/MinionFactoryTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Test;


public class MinionFactoryTests extends TestCase {
MapTowerDefense map;
MinionFactory MF;
int[][] nodes;
int NUM;


public void setUp() {
NUM = 6;
nodes = new int[NUM][2];
nodes[0][0] = 1;
nodes[0][1] = 3;
nodes[1][0] = 16;
nodes[1][1] = 3;
nodes[2][0] = 16;
nodes[2][1] = 9;
nodes[3][0] = 4;
nodes[3][1] = 9;
nodes[4][0] = 4;
nodes[4][1] = 15;
nodes[5][0] = 18;
nodes[5][1] = 15;
MockGui mg = new MockGui(640,640,32, NUM, nodes);
StatGui sg= new StatGui(0,0);
map = new MapTowerDefense(100, NUM, nodes, mg, sg);
MF = map.getMF();
mg.setMap(map);
sg.setMap(map);
sg.setup();
}
public void testX() {
assertEquals(1, MF.getX());
}
public void testY() {
assertEquals(3, MF.getY());
}
public void testMax() {
assertEquals(100, MF.getMax());
}
public void testID() {
assertEquals(0, MF.getNum());
}
public void testCreateMinion() {
MF.createRandominion();
assertEquals(1,MF.getNum());
}
public void testCreate2Minions() {
MF.createRandominion();
MF.createRandominion();
assertEquals(2,MF.getNum());
}

}

0 comments on commit c64d9dd

Please sign in to comment.