Download presentation
Presentation is loading. Please wait.
Published byDavid Marshall Modified over 9 years ago
1
Unit Testing LEVEL GAME
2
A student has pointed out that there’s a slight chance for our random tests to fail. RANDOMNESS probability our test will fail Where: i is the number of successes required to pass n is the total number of trials and p is the probability of occurrence For the example test, i=10 n=100 p=1/3 will fail with a probability of 5.28*10^-8 changing i to 1 probability is 1.25*10^-16
3
Solution has public variables – why? What are some pros/cons of approach? SOLUTION
4
Yes, clicked is the location of the player making the suggestion. (it can't be the card the player clicks on... BoardCell is not a card). This will be needed to move the accused player to that location. It is not really needed for the main logic of handleSuggestion. My calls to handleSuggestion look like: suggestion = new Solution("Miss Scarlet", "Dining Room", "Lead Pipe"); Assert.assertEquals(pipeCard, board.handleSuggestion(suggestion, mrsWhite, dummyCell)); OR assertNull(board.handleSuggestion(suggestion, mrGreen, dummyCell)); I create pipeCard in the @BeforeClass: pipeCard = new Card("Lead Pipe", Card.CardType.WEAPON); My card class includes an equals method, so we don't have to worry about the card returned being the exact card in the player's hand... we just care that the name & type match. I "deal" cards by just assigning cards that I created in @BeforeClass to specific players, e.g.: mrsWhite.addCard(libraryCard); VALUE OF PIAZZA
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.