Package randomevents

Source Code of randomevents.RandomGeneratorTest

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package randomevents;

import randomevents.generator.UniformRandomGenerator;
import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
*
* @author FormularHunter
*/
public class RandomGeneratorTest {
   
    public RandomGeneratorTest() {
    }
   
    @BeforeClass
    public static void setUpClass() {
    }
   
    @AfterClass
    public static void tearDownClass() {
    }
   
    @Before
    public void setUp() {
    }
   
    @After
    public void tearDown() {
    }

    /**
     * Test of rand method, of class UniformRandomGenerator.
     */
    @Test
    public void testRand() {
        System.out.println("rand");
        UniformRandomGenerator randomGenerator = new UniformRandomGenerator(0.11, 0.22, 0.15, 0.15, 0.27, 0.31);
        // Test 1
        double expectedResult = 0.21;
        double result = randomGenerator.rand();
        System.out.println(result);
        assertEquals(expectedResult, result, 0.0001);
        // Test 2
        expectedResult = 0.31;
        result = randomGenerator.rand();
        System.out.println(result);
        assertEquals(expectedResult, result, 0.001);
        // Test 3
        expectedResult = 0.4;
        result = randomGenerator.rand();
        System.out.println(result);
        assertEquals(expectedResult, result, 0.001);
        //fail("The test case is a prototype.");
    }
}
TOP

Related Classes of randomevents.RandomGeneratorTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.