-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
|
||
} |