// test the worldEnd method void testWorldEnd(Tester t) { t.checkExpect(ctf.worldEnds().worldEnds, false); resetCTF(); ctf.player.score = 300000; t.checkExpect(ctf.worldEnds().worldEnds, true); resetCTF(); ctf.player.hunger = 0; t.checkExpect(ctf.worldEnds().worldEnds, true); resetCTF(); ctf.player.speed = 0; t.checkExpect(ctf.worldEnds().worldEnds, true); }
// test the onKeyEvent method void testOnKeyEvent(Tester t) { ctf.onKeyEvent(" "); t.checkExpect(ctf.isJumping, true); }
// test the removePowerups method void removePowerups(Tester t) { ctf.removePups(0); t.checkExpect(ctf.field.pUps, new ArrayList<Powerup>()); }
// test the onTick method void testOnTick(Tester t) { resetCTF(); ctf.onTick(); t.checkExpect(ctf.player.loc, new Posn(6, CollectTheFruit.height - 30)); }
// test the hitPowerup method void testHitPowerup(Tester t) { t.checkExpect(ctf.hitPowerup(), -1); ctf.field.addPowerup(0, CollectTheFruit.height - 30); t.checkExpect(ctf.hitPowerup(), 0); }