previous | index | next

Testing the PlayerInfo Class

Here is how the client code would look:

void testPlayer() {
  Player player = new PlayerInfo("Fred");
  assert(player->getName() == "Fred");
  GameState state = new GameStateInfo(3, 4, 5);
  cout << "*** Please remove 4 coins from pile 3 ***\n";
  Move move = player->getMove(state);
  assert(move->getCoins() == 4 && move->getPile() == 3);

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


previous | index | next