ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -3,14 +3,15 @@ namespace Faker\Test\Provider;
use Faker\Provider\Biased;
use Faker\Generator;
use PHPUnit\Framework\TestCase;
class BiasedTest extends \PHPUnit_Framework_TestCase
class BiasedTest extends TestCase
{
const MAX = 10;
const NUMBERS = 25000;
protected $generator;
protected $results = array();
protected function setUp()
{
$this->generator = new Generator();
@@ -18,14 +19,14 @@ class BiasedTest extends \PHPUnit_Framework_TestCase
$this->results = array_fill(1, self::MAX, 0);
}
public function performFake($function)
{
for($i = 0; $i < self::NUMBERS; $i++) {
$this->results[$this->generator->biasedNumberBetween(1, self::MAX, $function)]++;
}
}
public function testUnbiased()
{
$this->performFake(array('\Faker\Provider\Biased', 'unbiased'));
@@ -40,7 +41,7 @@ class BiasedTest extends \PHPUnit_Framework_TestCase
$this->assertLessThan(self::NUMBERS * $assumed * 1.05, $amount, "Value was more than 5 percent over the expected value");
}
}
public function testLinearHigh()
{
$this->performFake(array('\Faker\Provider\Biased', 'linearHigh'));
@@ -54,7 +55,7 @@ class BiasedTest extends \PHPUnit_Framework_TestCase
$this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value");
}
}
public function testLinearLow()
{
$this->performFake(array('\Faker\Provider\Biased', 'linearLow'));