WurfelSpielTester_Solutions - import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 import junit.framework.TestCase /** Contains methods to test methods of class WuerfelSpiel. */ public class WurfelSpielTester extends TestCase { /** * Test throwDie. Do this by calling it 200 times and making sure: (1) Each value returned is in the range 1. .6. (2) All values in 1. .6 are returned by at least one call. */ public void testThrowDie() { /** Boolean array c should be used as follows. For each of the 200 times that WurfelSpiel.throwDie() is called and produces a value i (say) in the range 1..6, set c[i] to true. After calling WurfelSpiel.throwDie() 200 times, check (using assertEquals calls) whether all the values in c are true. */ boolean[] c= {true, false, false, false, false, false, false} //boolean[] c= new boolean[200] // inv: k calls on throwDie have been made. All of them have been in // the range 1. .6 (unless the call on assertEquals failed). For // each i, c[i] is true if and nly if one of the calls produced the value i. for (int k= 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

WurfelSpielTester_Solutions - import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online