Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge austintests again
  • Loading branch information
dwm10005 committed May 1, 2015
1 parent 036ba3a commit be175f0
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/MinonTests.java
@@ -0,0 +1,63 @@

import junit.framework.TestCase;

public class MinonTests extends TestCase{

private static int[][] nodes;
private static final int NUM = 6;
private MinionMock testMinion;

protected void setUp()throws Exception{
nodes = new int[NUM][2];//setting up nodes for the map
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);
MapTowerDefense map = new MapTowerDefense(100, NUM, nodes, mg, sg);

testMinion= new MinionMock(MinionTypes.BASIC, map);
}

public void testInitialLocation() throws Exception{
System.out.println("X= "+testMinion.getX() + " Y= "+testMinion.getY());

assertEquals(testMinion.getX(),32);
assertEquals(testMinion.getY(),96);
}

public void testHealth() throws Exception{
assertEquals(testMinion.getHealth(),255);
}

public void testDamage() throws Exception{
testMinion.minionTakeHit(20);
assertEquals(testMinion.getHealth(),235);
}

public void testMinionType() throws Exception{
System.out.println(testMinion.getName());
assertEquals(testMinion.getName(), "BASIC");
}

public void testAlive() throws Exception{
assertTrue(testMinion.isAlive());
}

public void testNotAlive() throws Exception{
testMinion.minionTakeHit(testMinion.getHealth());
assertFalse(testMinion.isAlive());
}


}
37 changes: 37 additions & 0 deletions src/StatGuiTests.java
@@ -0,0 +1,37 @@


import junit.framework.TestCase;


public class StatGuiTests extends TestCase {

private StatGui sg;

protected void setUp() throws Exception{
sg= new StatGui(0,0);
}

public void testMoney() throws Exception{
assertEquals(sg.getMoney(), 1000);
}

public void testCanAfford() throws Exception{
assertTrue(sg.canAfford(sg.getMoney()));
assertFalse(sg.canAfford(sg.getMoney()+10));
}

public void testSpendMoney() throws Exception{
assertTrue(sg.spendMoney(sg.getMoney()));
}

public void testPayDay() throws Exception{
sg.spendMoney(sg.getMoney());
sg.payDay(100);

assertEquals(sg.getMoney(), 100);
}




}

0 comments on commit be175f0

Please sign in to comment.