Created
July 26, 2012 19:29
-
-
Save johncalvinyoung/3184022 to your computer and use it in GitHub Desktop.
Testing End Conditions for a game of Go Fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)testEndConditionsDeck { | |
RMSGoFishGame *game = [RMSGoFishGame new]; | |
[game deal]; | |
RMSGoFishPlayer *player1 = [game.players objectAtIndex:(NSUInteger)0]; | |
RMSGoFishPlayer *player2 = [game.players objectAtIndex:(NSUInteger)1]; | |
RMSGoFishPlayer *player3 = [game.players objectAtIndex:(NSUInteger)2]; | |
RMSGoFishPlayer *player4 = [game.players objectAtIndex:(NSUInteger)3]; | |
game.deck.cards = [NSMutableArray new]; | |
[game gameLoop]; | |
STAssertEquals(player1.hand.count, (NSUInteger)5,@"Player 1 played after the game was over!"); | |
STAssertEquals(player2.hand.count, (NSUInteger)5,@"Player 2 played after the game was over!"); | |
STAssertEquals(player3.hand.count, (NSUInteger)5,@"Player 3 played after the game was over!"); | |
STAssertEquals(player4.hand.count, (NSUInteger)5,@"Player 4 played after the game was over!"); | |
} | |
- (void)testEndConditionsPlayer { | |
RMSGoFishGame *game = [RMSGoFishGame new]; | |
[game deal]; | |
RMSGoFishPlayer *player1 = [game.players objectAtIndex:(NSUInteger)0]; | |
RMSGoFishPlayer *player2 = [game.players objectAtIndex:(NSUInteger)1]; | |
RMSGoFishPlayer *player3 = [game.players objectAtIndex:(NSUInteger)2]; | |
RMSGoFishPlayer *player4 = [game.players objectAtIndex:(NSUInteger)3]; | |
[player4 emptyHand]; | |
game.deck.cards = [NSMutableArray new]; | |
[game gameLoop]; | |
STAssertEquals(player1.hand.count, (NSUInteger)5,@"Player 1 played after the game was over!"); | |
STAssertEquals(player2.hand.count, (NSUInteger)5,@"Player 2 played after the game was over!"); | |
STAssertEquals(player3.hand.count, (NSUInteger)5,@"Player 3 played after the game was over!"); | |
STAssertEquals(player4.hand.count, (NSUInteger)0,@"Player 4 played after the game was over!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment