From 2bb9bca69ea17e91cdd1f25f48553c63faa7e7e5 Mon Sep 17 00:00:00 2001 From: Basilius Sauter Date: Thu, 28 Apr 2016 18:43:15 +0200 Subject: [PATCH] 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 --- tests/DiceBagTest.php | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/tests/DiceBagTest.php b/tests/DiceBagTest.php index 3616738..d99bca1 100644 --- a/tests/DiceBagTest.php +++ b/tests/DiceBagTest.php @@ -9,24 +9,27 @@ 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->assertGreaterThan(0, $value); - $this->assertLessThan(1, $value); - } +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->assertGreaterThan(0, $value); - $this->assertLessThan(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->assertGreaterThan(0, $value); - $this->assertLessThan(1, $value); + $value = $db->normal(1., 0.); + $this->assertGreaterThanOrEqual(0, $value); + $this->assertLessThanOrEqual(1, $value); - $this->assertEquals(0, $db->normal(0., 0.)); - } + $this->assertEquals(0, $db->normal(0., 0.)); + } }