int main(){ printf("\n\n"); testCardSmithy(); printf("\n\n"); printf("===========================finish=========================\n"); return 0; }
int main() { int i; int n; int j; int outCome; int numTests = 2; int gameIterations = 1; //change for the number of test games struct gameState testGame; //display testing message for cardTest2 printf ("----------------------------------------\n"); printf ("FUNCTION cardSmithy() BEING TESTED...\n"); printf ("RANDOM TESTS...cardtest2.c\n\n"); //this is initializing stream for random number generation SelectStream(3); PutSeed(3); for (n = 0; n < gameIterations; n++) { SelectStream(3); for (i = 0; i < sizeof(struct gameState); i++) { ((char*)&testGame)[i] = floor(Random() * 256); } j = floor(Random() * MAX_PLAYERS); testGame.whoseTurn = j; testGame.deckCount[j] = floor(Random() * MAX_DECK); testGame.discardCount[j] = floor(Random() * MAX_DECK); testGame.handCount[j] = floor(Random() * MAX_HAND); testGame.playedCardCount = floor(Random() * MAX_DECK); //function call to test cardSmithy() function outCome = testCardSmithy(j, &testGame); } if (outCome == 0) { printf("ALL TESTS PASSED\n"); } else { printf("cardSmithy() FAILED %d out of %d TESTS\n\n", outCome, numTests); } return 0; }