Files
school_archives/OSU Coursework/CS 362 - Software Engineering II/1 - Dominion Unit Testing/unittest3.c

48 lines
1.1 KiB
C

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: unittest1.c
* Author: corwinperren
*
* Created on February 1, 2017, 9:02 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
int testing_assert(int expression);
int main(int argc, char** argv) {
struct gameState G;
int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse,
sea_hag, tribute, smithy};
for(int i = 2 ; i <= MAX_PLAYERS ; i++){
initializeGame(i, k, 65432, &G);
for(int j = 0 ; j < i ; j++){
G.whoseTurn = j;
testing_assert(whoseTurn(&G) == j);
}
}
return (EXIT_SUCCESS);
}
int testing_assert(int expression) {
if (expression) {
printf("TEST SUCCEEDED!\n");
return 1;
} else {
printf("TEST FAILED!\n");
return 0;
}
}