def test_getCost(): print("Testing getCost()") card = "Smithy" print("Getting cost of card: %s" %card) r=d.getCost(card) assert(r==4) print ("Cost of card : %s is %d" %(card,r))
def test_buyCard_gainCard(): ##kingdomCards = [d.Adventurer, d.Ambassador, d.Baron, d.Council_Room, d.Cut purse, d.Embargo, d.Feast, d.Gardens, d.Great_Hall, d.Village] tempcard = random.choice(kingdomCards) ## why only kingdom Cards because if i choose any other card which is not choosen in kingdormcards. It is throwing an error.Mentioned in Testreport. card = d.cardlist.index(tempcard) print "TESTING buyCard_gainCard()" a = d.initializeGame(numPlayers,kingdomCards, randomSeed) assert(a !=-1) a.whoseTurn = random.randint(0,numPlayers-1) print "Before Buying" print "Card want to Buy:" print d.cardlist[card] print "Cost of Card" x = d.getCost(d.cardlist[card]) print x print "Coins Available:" print a.coins print "numBuys available" print a.numBuys print "Whose Turn:" print a.whoseTurn print "Discard" print a.discard print "Supply of Card" print a.supplyCount[d.cardlist[card]] b = d.buyCard(card,a) if (b == -1): print "Invalid Input:No numBuys OR No enough Coins OR SupplyEmpty" if(b ==0): print "BuyCard() is successfull for player : %d brought: %s" %(a.whoseTurn,card) print "After Buying" print "Card Bought:" print card print "Coins Available:" print a.coins print "numBuys available" print a.numBuys print "Whose Turn:" print a.whoseTurn print "Discard" print a.discard print "Supply of Card" print a.supplyCount[d.cardlist[card]]