Exemple #1
0
int main () {

  int i, n, r, p, deckCount, discardCount, handCount, toFlag, supplyPos, handPos, trash;

  int k[10] = {adventurer, council_room, feast, gardens, mine,
	       remodel, smithy, village, baron, great_hall};

  struct gameState G;

  printf ("Testing DISCARDCARD.\n");

  SelectStream(2);
  PutSeed(3);

  for (i = 0; i < sizeof(struct gameState); i++) {
    ((char*)&G)[i] = floor(Random() * 256);
  }
  int handCountConst = floor(Random() * MAX_HAND);
  p = 0;
  handPos = 5;

  G.deckCount[p] = 40;
  G.discardCount[p] = 10;
  G.handCount[p] = 8;
  G.discard[p][G.discardCount[p]] = 100;
  G.playedCardCount = 3;
  G.playedCards[ G.playedCardCount ] = G.hand[p][handPos-1];

  trash = 0;

  //discardCard(int handPos, int currentPlayer, struct gameState *state, int trashFlag)
  checkDiscardCard(handPos, p , &G, trash);    // checking trash = 0
  trash = 1;
  handPos = 6;
  checkDiscardCard(handPos, p , &G, trash);    // checking trash = 1
  G.handCount[p] = 1;
  checkDiscardCard(handPos, p , &G, trash);    // checking trash = 1

  // checkDiscardCard(supplyPos, &G, 1, p); // checking toFlag = 1
  // checkDiscardCard(supplyPos, &G, 2, p); // checking toFlag = 2
  // checkDiscardCard(-1, &G, -1, p); ////check if supply pile is empty (0) or card is not used in game (-1)

  printf ("ALL TESTS OK FOR DISCARDCARD\n\n");
  exit(0);
  return 0;
}
Exemple #2
0
 int main() {
    checkDiscardCard();
    return 0;
}