int main() {
    int numPlayers = 2;
    int kingdomCards[10] = {smithy, adventurer, gardens, embargo, great_hall, mine, ambassador, outpost, baron, tribute};
    int randomSeed = 15;
    struct gameState state;
    int result = 0;
    int oldHandCount, newHandCount;
    int oldActionCount, newActionCount;
    
    printf("CARDTEST3: GREAT HALL\n");
    
    initializeGame(numPlayers, kingdomCards, randomSeed, &state);
    oldHandCount = numHandCards(&state);
    oldActionCount = state.numActions;
    
    //int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus);
    
    //TEST GREAT HALL
    result = cardEffect(great_hall, 0, 0, 0, &state, 1, NULL);
    assertc(result, "Completely failed Great Hall");
    
    newHandCount = numHandCards(&state);
    assertSame(oldHandCount, newHandCount, "Hand sizes aren't the same");
    
    newActionCount = state.numActions;
    assertDiff(oldActionCount, newActionCount, "Actions didn't change");
    if (newActionCount == oldActionCount + 1) {
        result = 0;
    }
    assertc(result, "Actions didn't increment by 1");
    
    checkFail();
    
    return 0;
}
Beispiel #2
0
char Color::to_char () const { 
  switch (idx) {
  case black_idx:      return '#';
  case white_idx:      return 'O';
  case empty_idx:      return '.';
  case off_board_idx:  return ' ';
  default : assertc (color_ac, false);
  }
  return '?';                 // should not happen
}
int main() {
    int numPlayers = 2;
    int kingdomCards[10] = {smithy, adventurer, gardens, embargo, cutpurse, mine, ambassador, outpost, baron, tribute};
    int randomSeed = 15;
    struct gameState state;
    int result = 0;
    
    printf("UNITTEST2: WHOSE TURN\n");
    
    initializeGame(numPlayers, kingdomCards, randomSeed, &state);
    result = whoseTurn(&state);
    assertc(result == 1, "Should be Player 1's turn");
    
    checkFail();
    
    return 0;
}
Beispiel #4
0
void Player::check () const { 
  assertc (player_ac, (idx & (~1)) == 0);
}
Beispiel #5
0
void Color::check () const { 
  assertc (color_ac, (idx & (~3)) == 0); 
}