def checkEndTurn(game): d.buyCard(c.embargo,game) d.endTurn(game) assert (d.whoseTurn(game) == 1) assert(d.numHandCards(game) == 5) print "TEST CASE PASSED"
def test1(game): d.buyCard(c.silver, game) d.endTurn(game) assert (d.buyCard(c.copper, game) == 0) d.buyCard(c.silver, game) assert (d.whoseTurn(game) == 1) assert (d.buyCard(c.silver, game) == -1) d.endTurn(game) assert (d.buyCard(c.province,game) == -1) print "TEST CASE PASSED" return 0
def checkPlayCard(game): d.updateCoins(0,game,20) d.buyCard(c.baron,game) d.endTurn(game) d.endTurn(game) assert(d.playCard(-1,0,0,0,game) == -1) for i in range(d.numHandCards(game)): if (d.handCard(0,game) == c.baron): assert(d.playCard(i,1,0,0,game) == 0) else: assert(d.playCard(0,0,0,0,game) == -1) # Still need to refine this print "TEST CASE PASSED"
def test_endTurn(): kingdomCards = [d.Adventurer, d.Ambassador, d.Baron, d.Council_Room, d.Cutpurse, d.Embargo, d.Feast, d.Gardens, d.Great_Hall, d.Village] print("Testing endTurn") r= d.initializeGame(2, kingdomCards,111) assert(r != -1) print ("Whose Turn:") print r.whoseTurn s = d.endTurn(r) assert (s == 0) print ("After endTurn:") print ("Whose Turn:") print r.whoseTurn
def checkScore(game): score = d.scoreFor(0,game) assert(score == 3) d.updateCoins(0,game,20) d.buyCard(c.province,game) d.endTurn(game) d.updateCoins(0,game,20) d.buyCard(c.duchy,game) score = d.scoreFor(0,game) assert(score == 9) score = d.scoreFor(1,game) assert(score == 6) d.endTurn(game) d.updateCoins(0,game,20) d.buyCard(c.great_hall,game) d.endTurn(game) d.updateCoins(0,game,20) d.buyCard(c.gardens,game) score = d.scoreFor(0,game) assert(score == 10) for i in range(10): d.gainCard(c.silver,game,1,1) score = d.scoreFor(1,game) assert(score == 7) print "TEST CASE PASSED"
def act53(self): if self.__collectCov: self.__cov.start() try: __result = mydom.endTurn(self.p_GAME[0]) finally: if self.__collectCov: self.__cov.stop() self.__updateCov() __result_REF = otherdom.endTurn(self.p_GAME_REF[0]) assert __result == __result_REF, " (%s) == (%s) " % (__result, __result_REF)
def test_endTurn(): ##kingdomCards = [d.Adventurer, d.Ambassador, d.Baron, d.Council_Room, d.Cutpurse, d.Embargo, d.Feast, d.Gardens, d.Great_Hall, d.Village] print("Testing endTurn") r= d.initializeGame(numPlayers, kingdomCards,randomSeed) assert(r != -1) print ("Whose Turn:") print r.whoseTurn print "Discard" print r.discard print "Hand" print r.hand s = d.endTurn(r) assert (s == 0) print ("After endTurn:") print ("Whose Turn:") print r.whoseTurn print "Discard" print r.discard print "Hand" print r.hand
def checkOutpost(game): # Outpost case d.updateCoins(0,game,5) assert(d.buyCard(c.outpost,game) == 0) d.endTurn(game) d.endTurn(game) outpost = -1 for i in range(5): if handCard(i,game) == card.outpost: outpost = i if outpost == -1: d.playCard(outpost,0,0,0,game) d.endTurn(game) assert(d.whoseTurn(game) == 1) assert(d.numHandCards(game) == 3) print "TEST CASE PASSED"