1   /*
2    * @(#) StreamTest.java Sep 1, 2003
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.jstats.streams;
11  
12  import junit.framework.Assert;
13  import junit.framework.TestCase;
14  
15  /***
16   * The test script for the Stream class.
17   * <p>
18   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
19   * University of Technology </a>, the Netherlands. <br>
20   * See for project information <a
21   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
22   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
23   * License (GPL) </a>, no warranty <br>
24   * 
25   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
26   *         Jacobs </a>
27   * @version 1.0, 2004-03-18
28   * @since 1.2
29   */
30  public class StreamTest extends TestCase
31  {
32  	/*** TEST_METHOD is the name of the test method */
33  	public static final String TEST_METHOD = "test";
34  
35  	/***
36  	 * constructs a new EventIteratorTest.
37  	 */
38  	public StreamTest()
39  	{
40  		this(TEST_METHOD);
41  	}
42  
43  	/***
44  	 * constructs a new EventIteratorTest
45  	 * 
46  	 * @param method the name of the test method
47  	 */
48  	public StreamTest(final String method)
49  	{
50  		super(method);
51  	}
52  
53  	/***
54  	 * tests the classes in the reference class.
55  	 */
56  	public void test()
57  	{
58  		StreamInterface[] streams = {new Java2Random(), new MersenneTwister(),
59  				new DX120Generator()};
60  		for (int i = 0; i < 1000000; i++)
61  		{
62  			for (int j = 0; j < streams.length; j++)
63  			{
64  				double value = streams[j].nextDouble();
65  				Assert.assertTrue(value > 0.0);
66  				Assert.assertTrue(value < 1.0);
67  			}
68  		}
69  	}
70  }