예제 #1
0
def test_discardCard(): 
    ##kingdomCards = [d.Adventurer, d.Ambassador, d.Baron, d.Council_Room, d.Cutpurse, d.Embargo, d.Feast, d.Gardens, d.Great_Hall, d.Village]
    card = random.choice([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]) ##random.randint(d.Curse,d.Village)
    print "TESTING discardCard()"
    a = d.initializeGame(numPlayers,kingdomCards, randomSeed)
    assert(a !=-1)
    print "Before discard"
    print "Card to discard:"
    print card
    print "hand before discarding"
    print a.hand
    print "Coins available:"
    print a.coins
    b = d.discardCard(card,a.whoseTurn,a,0)
    if (b == -1):
        print "Invalid Input:card not in hand OR SupplyEmpty"
        return -1
    assert(b ==0)
    print "TEST PASS"
    print "discardCard() is successfull for player : %d discarded %d" %(a.whoseTurn,card)
    print "After Discarding"
    print "Card Discarded:"
    print card
    print "Hand after Discarding"
    print a.hand
    print "Coins Available:"
    print a.coins
def test_discardCard():
    randSeed = 111
    numPlayers =random.randint(2,4) 
    kingdomCards = [d.Adventurer, d.Ambassador, d.Baron, d.Council_Room, d.Cutpurse, d.Embargo, d.Feast, d.Gardens, d.Great_Hall, d.Village]
    card = d.Copper ##random.randint(d.Curse,d.Village)
    print "TESTING UpdateCoins()"
    a = d.initializeGame(numPlayers,kingdomCards, randSeed)
    assert(a !=-1)
    print "Before discard"
    print "Card to discard:"
    print card
    print "hand before discarding"
    print a.hand
    print "Coins available:"
    print a.coins
    b = d.discardCard(card,a.whoseTurn,a,0)
    c = d.updateCoins(a.whoseTurn,a,0)
    if (b == -1):
        print "Invalid Input:card not in hand OR SupplyEmpty"
    assert(b ==0)
    print "TEST PASS"
    print "discardCard() is successfull for player : %d discarded %d" %(a.whoseTurn,card)
    print "After Discarding"
    print "Card Discarded:"
    print card
    print "Hand after Discarding"
    print a.hand
    print "Coins Available:"
    print a.coins
예제 #3
0
   def act51(self):
      if self.__collectCov:
         self.__cov.start()
      try:
         __result = mydom.discardCard(self.p_HPOS[0], self.p_PLAYER[0], self.p_GAME[0], 2)

      finally:
         if self.__collectCov:
            self.__cov.stop()
            self.__updateCov()
      __result_REF = otherdom.discardCard(self.p_HPOS[0], self.p_PLAYER[0], self.p_GAME_REF[0], 2)

      assert __result == __result_REF, " (%s) == (%s) " % (__result, __result_REF)