previous | index

Testing the StrategyInfo Class

Here is how the client code would look:

void testStrategy() {
  Strategy strategy = new StrategyInfo;  // Uses simple, mindless strategy
  GameState state = new GameStateInfo(0, 4, 5);
  Move move = strategy->getMove(state);  
  assert(move->getCoins() == 1 && move->getPile() == 2);

  cout << "testStrategy succeeded.\n";
}

Here is the extended main procedure:

int main(int argc, char** argv) {

  testMove();
  testGameState();
  testPlayer();
  testStrategy();
    
  cout << "All tests succeeded.\n";

  return (EXIT_SUCCESS);
}


previous | index