Files
core/tests/DiceBagTest.php
T
Basilius Sauter 2bb9bca69e Fix for dicebag test
dicebag tests asserts now for >= and <= instead of > and < since the edge
cases can happen from time to time as well.

closes #14
2016-04-28 22:58:05 +02:00

36 lines
836 B
PHP

<?php
declare(strict_types=1);
namespace LotGD\Core\Tests;
use LotGD\Core\DiceBag;
/**
* @backupGlobals disabled
* @backupStaticAttributes disabled
*/
class DiceBagTests extends \PHPUnit_Framework_TestCase
{
public function testUniform()
{
$db = new DiceBag();
$value = $db->uniform(0., 1.);
$this->assertGreaterThanOrEqual(0, $value);
$this->assertLessThanOrEqual(1, $value);
}
public function testNormal()
{
$db = new DiceBag();
$value = $db->normal(0., 1.);
$this->assertGreaterThanOrEqual(0, $value);
$this->assertLessThanOrEqual(1, $value);
$value = $db->normal(1., 0.);
$this->assertGreaterThanOrEqual(0, $value);
$this->assertLessThanOrEqual(1, $value);
$this->assertEquals(0, $db->normal(0., 0.));
}
}