From: widmogrod Date: Wed, 13 Dec 2017 00:21:32 +0000 (+0100) Subject: Update readme X-Git-Tag: 3.4.0~1^2 X-Git-Url: http://cameron1729.xyz/?a=commitdiff_plain;h=336c8425cfe59062ec43046a788263596b4d00ec;p=php-functional.git Update readme --- diff --git a/README.md b/README.md index 0682681..cf92a70 100644 --- a/README.md +++ b/README.md @@ -244,14 +244,13 @@ Free monad enables you to do exactly that, and more: #### Echo program Example Free Monad example of `echo program` can be found here: -- [FreeMonadTest.php](/example/FreeMonadTest.php) - example based on first implementation of Free -- [Free2MonadTest.php](/example/Free2MonadTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html) +- See source code [FreeMonadTest.php](/example/FreeMonadTest.php) - example based on first implementation of Free +- See source code [Free2MonadTest.php](/example/Free2MonadTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html) #### DSL for `BDD` tests Example that use `Free Monad` to creates simple DSL (Domain Specific Language) to define BDD type of framework: -- [Free2BddStyleDSLTest.php](/example/Free2BddStyleDSLTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html) - +- See source code [Free2BddStyleDSLTest.php](/example/Free2BddStyleDSLTest.php) ```php $state = [ 'productsCount' => 0, diff --git a/example/Free2BddStyleDSLTest.php b/example/Free2BddStyleDSLTest.php index c1507c2..b28bd15 100644 --- a/example/Free2BddStyleDSLTest.php +++ b/example/Free2BddStyleDSLTest.php @@ -232,6 +232,9 @@ function matchRegexp(array $patterns, $value = null) }), func_get_args()); } +/** + * Inspired by https://github.com/politrons/TestDSL + */ class Free2BddStyleDSLTest extends \PHPUnit_Framework_TestCase { public function test_it_should_interpret_bdd_scenario() diff --git a/test/Primitive/ListtTest.php b/test/Primitive/ListtTest.php index e428f40..7f5c7c6 100644 --- a/test/Primitive/ListtTest.php +++ b/test/Primitive/ListtTest.php @@ -136,7 +136,7 @@ class ListtTest extends \PHPUnit_Framework_TestCase private function randomize() { - return Listt::of(array_keys(array_fill(0, rand(20, 100), null))); + return Listt::of(array_keys(array_fill(0, random_int(20, 100), null))); } public function provideRandomizedData() diff --git a/test/Primitive/NumTest.php b/test/Primitive/NumTest.php index 9e1b948..010d3d8 100644 --- a/test/Primitive/NumTest.php +++ b/test/Primitive/NumTest.php @@ -26,7 +26,7 @@ class NumTest extends \PHPUnit_Framework_TestCase private function randomize() { - return Num::of(rand(-100000000, 100000000)); + return Num::of(random_int(-100000000, 100000000)); } public function provideSetoidLaws() diff --git a/test/Primitive/ProductTest.php b/test/Primitive/ProductTest.php index fa25eb6..d5310a5 100644 --- a/test/Primitive/ProductTest.php +++ b/test/Primitive/ProductTest.php @@ -43,7 +43,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase private function randomize() { - return Product::of(rand(-100000000, 100000000)); + return Product::of(random_int(-100000000, 100000000)); } public function provideSetoidLaws() diff --git a/test/Primitive/StringgTest.php b/test/Primitive/StringgTest.php index e6c65e7..f2d9e8e 100644 --- a/test/Primitive/StringgTest.php +++ b/test/Primitive/StringgTest.php @@ -24,7 +24,7 @@ class StringgTest extends \PHPUnit_Framework_TestCase private function randomize() { - return Stringg::of(md5(rand(0, 100))); + return Stringg::of(md5(random_int(0, 100))); } public function provideRandomizedData() diff --git a/test/Primitive/SumTest.php b/test/Primitive/SumTest.php index 3e2d41b..50a8893 100644 --- a/test/Primitive/SumTest.php +++ b/test/Primitive/SumTest.php @@ -43,7 +43,7 @@ class SumTest extends \PHPUnit_Framework_TestCase private function randomize() { - return Sum::of(rand(-100000000, 100000000)); + return Sum::of(random_int(-100000000, 100000000)); } public function provideSetoidLaws()