namespace test\Primitive;
+use Eris\TestTrait;
+use Eris\Generator;
use Widmogrod\Helpful\SetoidLaws;
use Widmogrod\Primitive\Num;
class NumTest extends \PHPUnit\Framework\TestCase
{
- /**
- * @dataProvider provideSetoidLaws
- */
- public function test_it_should_obay_setoid_laws(
- $a,
- $b,
- $c
- ) {
- SetoidLaws::test(
- [$this, 'assertEquals'],
- $a,
- $b,
- $c
- );
- }
-
- private function randomize()
- {
- return Num::of(random_int(-100000000, 100000000));
- }
+ use TestTrait;
- public function provideSetoidLaws()
+ public function test_it_should_obay_setoid_laws()
{
- return array_map(function () {
- return [
- $this->randomize(),
- $this->randomize(),
- $this->randomize(),
- ];
- }, array_fill(0, 50, null));
+ $this->forAll(
+ Generator\choose(0, 1000),
+ Generator\choose(1000, 4000),
+ Generator\choose(4000, 100000)
+ )->then(function (int $x, int $y, int $z) {
+ SetoidLaws::test(
+ [$this, 'assertEquals'],
+ Num::of($x),
+ Num::of($y),
+ Num::of($z)
+ );
+ });
}
}