int main() { //define variables int i, n,p, handPos, c1, c2, c3; int result = 0; //define a gamestate struct gameState G; printf ("Testing playCard with Random Tests\n"); SelectStream(2); PutSeed(3); //Loop through players, decks and hands to fill the struct // and initiate game play. for (n = 0; n < 2000; n++) { for (i = 0; i < sizeof(struct gameState); i++) { ((char*)&G)[i] = floor(Random() * 256); } handPos = floor(Random() * 15);//number of cards in hand c1 = floor(Random() * 10);//kingdom card index c2 = floor(Random() * 10); c3 = floor(Random() * 10); p = floor(Random() * 2); G.deckCount[p] = floor(Random() * MAX_DECK); G.discardCount[p] = floor(Random() * MAX_DECK); G.handCount[p] = floor(Random() * MAX_HAND); G.phase = floor(Random() * 3); G.numActions = floor(Random() * 16); G.whoseTurn = floor(Random() * 2); //run unit test. result = checkPlayCard(handPos, c1, c2, c3, &G); } // print out results if (result == 1) { printf("playCard tests failed.\n"); } else { printf("playCard tests passed.\n"); } printf ("RANDOM TESTS COMPLETE.\n"); exit(0); }
int main() { int players = 4; int cards[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, sea_hag, tribute, smithy}; int seed = 187; int trash = 1; int targetPlayer = 0; int i; int iterations = 10; int FOUND_BUG = 0; struct gameState game; struct gameState *state = &game; initializeGame(players, cards, seed, &game); printf("TESTING great_hall card\n"); checkPlayCard(state, targetPlayer, CARD); return 0; }