public function testGenerators()
 {
     $generators = ["Gen\\neg" => Generator\neg(), "Gen\\pos" => Generator\pos()];
     foreach ($generators as $description => $generator) {
         $this->generateSample($description, $generator);
     }
 }
Exemple #2
0
 public function testSumIsAssociative()
 {
     $this->forAll(Generator\int(), Generator\neg(), Generator\pos())->then(function ($first, $second, $third) {
         $x = $first + ($second + $third);
         $y = $first + $second + $third;
         $this->assertEquals($x, $y, "Sum between {$first} and {$second} should be associative");
     });
 }
Exemple #3
0
 public function testGeneratedDataCollectionOnScalars()
 {
     $this->forAll(Generator\neg())->hook(Listener\collectFrequencies())->then(function ($x) {
         $this->assertTrue($x < $x + 1);
     });
 }
Exemple #4
0
 public function testPositiveOrNegativeNumberButNotZero()
 {
     $this->forAll(Generator\oneOf(Generator\pos(), Generator\neg()))->then(function ($number) {
         $this->assertNotEquals(0, $number);
     });
 }