Beispiel #1
0
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"  
Beispiel #2
0
def checkGameOver(game):
  for i in range(8):
    assert(d.isGameOver(game) == 0)
    d.gainCard(c.province,game,0,0)
  assert(d.isGameOver(game) == 1)

  print "TEST CASE PASSED"
def test_gainCard():
    randSeed = 111
    card = random.randint(0,26)
    numPlayers = 4
    turn = random.randint(0,3)
    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 gainCard()"
    a = d.initializeGame(numPlayers,kingdomCards, randSeed)
    assert(a !=-1)
    print "Before gaining"
    print "Deck"
    print a.deck
    print "Card Gaining by Player : %d is " %turn
    print card
    print "Supply Count of Card:"
    print a.supplyCount[card]
    b = d.gainCard(card,a,1,turn)
    if (b == -1):
        print "Invalid Input:Supply Empty"
    assert(b ==0)
    print "TEST PASS"
    print "After gaining"
    print "Deck"
    print a.deck
    print "Card gained by Player %d is "%turn
    print card
    print "Supply Count of Card:"
    print a.supplyCount[card]
Beispiel #4
0
def checkGainCard(game):
  assert(d.gainCard(-1,game,0,0) == -1)
  d.gainCard(c.province,game,0,0)
  assert(c.province in game.discards[0])
  d.gainCard(c.province,game,1,0) 
  assert(c.province in game.decks[0])
  d.gainCard(c.province,game,2,0)
  assert(c.province in game.hands[0])

  print "TEST CASE PASSED"
Beispiel #5
0
def checkGameOver2(game):
  for i in range(10):
    assert(d.isGameOver(game) == 0)
    d.gainCard(c.ambassador,game,0,0)
  for i in range(10):
    assert(d.isGameOver(game) == 0)
    d.gainCard(c.adventurer,game,0,0)
  for i in range(10):
    assert(d.isGameOver(game) == 0)
    d.gainCard(c.baron,game,0,0)
  assert(d.isGameOver(game) == 1)
  
  print "TEST CASE PASSED"