Skip to content

Commit

Permalink
Big renaming for style
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed Dec 27, 2014
1 parent 8e817fa commit f36f773
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 86 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class ReadmeTest extends \PHPUnit_Framework_TestCase

public function testNaturalNumbersMagnitude()
{
$this->forAll([
Generator\nat(1000),
])
$this->forAll(
Generator\nat(1000)
)
->then(function($number) {
$this->assertTrue(
$number < 42,
Expand Down
6 changes: 3 additions & 3 deletions examples/BooleanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class BooleanTest extends PHPUnit_Framework_TestCase

public function testBooleanValueIsTrueOrFalse()
{
$this->forAll([
Generator\bool(),
])
$this->forAll(
Generator\bool()
)
->then(function($boolValue) {
$this->assertTrue(
($boolValue === true || $boolValue === false),
Expand Down
8 changes: 4 additions & 4 deletions examples/ConstantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class ConstantTest extends \PHPUnit_Framework_TestCase
public function testUseConstantGeneratorExplicitly()
{
$this
->forAll([
->forAll(
Generator\nat(),
new Generator\Constant(2)
])
)
->then(function($number, $alwaysTwo) {
$this->assertTrue(($number * $alwaysTwo % 2) === 0);
});
Expand All @@ -21,10 +21,10 @@ public function testUseConstantGeneratorExplicitly()
public function testUseConstantGeneratorImplicitly()
{
$this
->forAll([
->forAll(
Generator\nat(),
2
])
)
->then(function($number, $alwaysTwo) {
$this->assertTrue(($number * $alwaysTwo % 2) === 0);
});
Expand Down
16 changes: 8 additions & 8 deletions examples/ElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class ElementsTest extends \PHPUnit_Framework_TestCase

public function testElementsOnlyProducesElementsFromTheGivenArguments()
{
$this->forAll([
Generator\elements(1, 2, 3),
])
$this->forAll(
Generator\elements(1, 2, 3)
)
->then(function($number) {
$this->assertContains(
$number,
Expand All @@ -25,9 +25,9 @@ public function testElementsOnlyProducesElementsFromTheGivenArguments()
*/
public function testElementsOnlyProducesElementsFromTheGivenArrayDomain()
{
$this->forAll([
Generator\elements([1, 2, 3]),
])
$this->forAll(
Generator\elements([1, 2, 3])
)
->then(function($number) {
$this->assertContains(
$number,
Expand All @@ -39,11 +39,11 @@ public function testElementsOnlyProducesElementsFromTheGivenArrayDomain()

public function testVectorOfElementsGenerators()
{
$this->forAll([
$this->forAll(
Generator\vector(4,
Generator\elements([2, 4, 6, 8, 10, 12])
)
])
)
->then(function($vector) {
$sum = array_sum($vector);
$isEven = function($number) { return $number % 2 == 0; };
Expand Down
12 changes: 6 additions & 6 deletions examples/FloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class FloatTest extends \PHPUnit_Framework_TestCase

public function testAPropertyHoldingForAllNumbers()
{
$this->forAll([
Generator\float(-100.0, 100.0),
])
$this->forAll(
Generator\float(-100.0, 100.0)
)
->then(function($number) {
$this->assertEquals(
0.0,
Expand All @@ -20,9 +20,9 @@ public function testAPropertyHoldingForAllNumbers()

public function testAPropertyHoldingOnlyForPositiveNumbers()
{
$this->forAll([
Generator\float(-10.0, 100.0),
])
$this->forAll(
Generator\float(-10.0, 100.0)
)
->then(function($number) {
$this->assertTrue(
$number >= 0,
Expand Down
12 changes: 6 additions & 6 deletions examples/IntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class IntegerTest extends PHPUnit_Framework_TestCase

public function testSumIsCommutative()
{
$this->forAll([
$this->forAll(
Generator\int(-1000, 1000),
Generator\int(-1000, 1000),
])
Generator\int(-1000, 1000)
)
->then(function($first, $second) {
$x = $first + $second;
$y = $second + $first;
Expand All @@ -25,11 +25,11 @@ public function testSumIsCommutative()

public function testSumIsAssociative()
{
$this->forAll([
$this->forAll(
Generator\int(-1000, 1000),
Generator\neg(),
Generator\pos(),
])
Generator\pos()
)
->then(function($first, $second, $third) {
$x = $first + ($second + $third);
$y = ($first + $second) + $third;
Expand Down
6 changes: 3 additions & 3 deletions examples/ReadmeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class ReadmeTest extends \PHPUnit_Framework_TestCase

public function testNaturalNumbersMagnitude()
{
$this->forAll([
Generator\nat(1000),
])
$this->forAll(
Generator\nat(1000)
)
->then(function($number) {
$this->assertTrue(
$number < 42,
Expand Down
12 changes: 6 additions & 6 deletions examples/SequenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class SequenceTest extends PHPUnit_Framework_TestCase
public function testArrayReversePreserveLength()
{
$this
->forAll([
Generator\seq(Generator\nat(), 100),
])
->forAll(
Generator\seq(Generator\nat(), 100)
)
->then(function($array) {
$this->assertEquals(count($array), count(array_reverse($array)));
});
Expand All @@ -19,12 +19,12 @@ public function testArrayReversePreserveLength()
public function testArrayReverse()
{
$this
->forAll([
->forAll(
Generator\seq(
Generator\nat(),
Generator\pos(100)
),
])
)
)
->then(function($array) {
$this->assertEquals($array, array_reverse(array_reverse($array)));
});
Expand Down
12 changes: 6 additions & 6 deletions examples/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class StringTest extends PHPUnit_Framework_TestCase

public function testRightIdentityElement()
{
$this->forAll([
Generator\string(1000),
])
$this->forAll(
Generator\string(1000)
)
->then(function($string) {
$this->assertEquals(
$string,
Expand All @@ -29,10 +29,10 @@ public function testRightIdentityElement()

public function testLengthPreservation()
{
$this->forAll([
Generator\string(1000),
$this->forAll(
Generator\string(1000),
])
Generator\string(1000)
)
->then(function($first, $second) {
$result = concatenation($first, $second);
$this->assertEquals(
Expand Down
18 changes: 9 additions & 9 deletions examples/SumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class SumTest extends PHPUnit_Framework_TestCase

public function testRightIdentityElement()
{
$this->forAll([
Generator\nat(1000),
])
$this->forAll(
Generator\nat(1000)
)
->then(function($number) {
$this->assertEquals(
$number,
Expand All @@ -29,9 +29,9 @@ public function testRightIdentityElement()

public function testLeftIdentityElement()
{
$this->forAll([
Generator\nat(1000),
])
$this->forAll(
Generator\nat(1000)
)
->then(function($number) {
$this->assertEquals(
$number,
Expand All @@ -58,10 +58,10 @@ public function testEqualToReferencePhpImplementation()

public function testPropertyNeverSatisfied()
{
$this->forAll([
Generator\nat(1000),
$this->forAll(
Generator\nat(1000),
])
Generator\nat(1000)
)
->then(function($first, $second) {
$this->assertEquals(
-1,
Expand Down
4 changes: 2 additions & 2 deletions examples/TupleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class TupleTest extends PHPUnit_Framework_TestCase

public function testConcatenationMaintainsLength()
{
$this->forAll([
$this->forAll(
Generator\tuple([
Generator\elements("A", "B", "C"),
Generator\nat(9),
])
])
)
->then(function($tuple) {
$letter = $tuple[0];
$cipher = $tuple[1];
Expand Down
6 changes: 3 additions & 3 deletions examples/VectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class VectorTest extends PHPUnit_Framework_TestCase

public function testConcatenationMaintainsLength()
{
$this->forAll([
$this->forAll(
Generator\vector(10, Generator\nat(1000)),
Generator\vector(10, Generator\nat(1000)),
])
Generator\vector(10, Generator\nat(1000))
)
->then(function($first, $second) {
$concatenated = array_merge($first, $second);
$this->assertEquals(
Expand Down
Loading

0 comments on commit f36f773

Please sign in to comment.