int main(int argc, char **argv) { SelectStream(2); PutSeed(time(NULL)); if(argc < 2) { printf("Usage: unittest1 <number times to run>\n"); return 1; } int i, failures = 0; int tempHand[MAX_HAND]; struct gameState G; G.handCount[0] = 0; G.playedCardCount = 0; for(i = 0; i < MAX_HAND; i++) { G.hand[0][i] = -1; tempHand[i] = -1; } for(i = 0; i < atoi(argv[1]); i++) { failures += testDiscard(&G, tempHand, i); } printf("Tests Run: %d, Tests passed: %d, Tests failed: %d\n", atoi(argv[1]), atoi(argv[1]) - failures, failures); return 0; }
int main(int argc, char** argv) { printf("\nStarting Card Test 3 (baron)\n"); tempKC = kingdomCards(council_room, feast, mine, great_hall, cutpurse, treasure_map, outpost, smithy, gardens, embargo); G = newGame(); initializeGame(2, tempKC, 4, G); testNoDiscard(); free(G); G = newGame(); initializeGame(2, tempKC, 4, G); testDiscard(); free(G); G = newGame(); initializeGame(2, tempKC, 4, G); testDiscardFail(); printf("\n*********************************************************\n"); printf("*********Successfully finished Card Test 3***********\n"); printf("*********************************************************\n\n"); return 0; }
int main() { int i; int seed = 1000; int numPlayers = 2; int player = 0; int *deckZero,*deckOne; struct gameState preTest, postTest; int k[10] = {adventurer, council_room, feast, gardens, mine ,remodel, smithy, village, baron, great_hall}; /* Test Specification Variables */ int drawCountTestZero = 3; int drawCountTestOne = 0; initializeGame(numPlayers,k,seed,&postTest); printf("\n\nBeginning Test for Village...\n\n"); memcpy(&preTest,&postTest,sizeof(struct gameState)); insertCard(&postTest,player); playCard((postTest.handCount[player]-1),0,0,0,&postTest); testDraw(&preTest,&postTest,player); testHand(&preTest,&postTest,player); testDiscard(&preTest,&postTest,player); testSupply(&preTest,&postTest); testPlayed(&preTest,&postTest); testUtility(&preTest,&postTest); printf("\n\tTesting finished\n\n"); }
// Do the test int testAdventurerPass(struct gameState *p) { cardEffect(adventurer, 0, 0, 0, p, 0, 0); int gain = testGain2(p); int discard = testDiscard(p); return (gain + discard); }