int main() { int i, n, r, player, j, handPos, deckCount, discardCount, handCount, numActions; int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall}; struct gameState G; printf ("Testing village card.\n"); printf ("RANDOM TESTS.\n"); SelectStream(2); PutSeed(3); for (n = 0; n < 2000; n++) { for (i = 0; i < sizeof(struct gameState); i++) { ((char*)&G)[i] = floor(Random() * 256); } player = floor(Random() * 2); G.deckCount[player] = floor(Random() * MAX_DECK); G.discardCount[player] = floor(Random() * MAX_DECK); G.handCount[player] = floor(Random() * MAX_HAND); G.numActions = floor(Random() *MAX_HAND); handPos = floor(Random() * G.handCount[player]); G.playedCardCount = floor(Random() * MAX_DECK); for (i = 0; i < MAX_PLAYERS; i++){ for (j = 0 ; j< MAX_HAND; j++){ G.hand[i][j] = floor(Random() *27); } } for (i = 0; i < MAX_PLAYERS; i++){ for (j = 0 ; j< MAX_HAND; j++){ G.deck[i][j] = floor(Random() *27); } } for (i = 0; i < MAX_PLAYERS; i++){ for (j = 0 ; j< MAX_HAND; j++){ G.discard[i][j] = floor(Random() *27); } } checkVillageCard(player, handPos, &G); } printf ("ALL TESTS OK\n"); exit(0); return 0; }
int main () { printf ("Testing checkVillageCard.\n"); struct gameState G; int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, sea_hag, tribute, smithy }; int rdmSeed = 3; initializeGame(4, k, rdmSeed, &G); int player = G.whoseTurn; int handPos = 0; int result = checkVillageCard(handPos,player, &G); if(result==0) { printf ("All tests passed\n"); } exit(0); }