-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65f5e9e
commit c199d40
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* @package Functional-php | ||
* @author Hugo Sales <hugo@fc.up.pt> | ||
* @copyright 2020 Hugo Sales | ||
* @license https://opensource.org/licenses/MIT MIT | ||
* @link https://github.com/lstrojny/functional-php | ||
*/ | ||
|
||
namespace Functional\Tests; | ||
|
||
use function Functional\ary; | ||
|
||
class AryTest extends AbstractTestCase | ||
{ | ||
|
||
public function test() | ||
{ | ||
$this->assertSame(5, ary(function ($a = 0, $b = 0) { return $a + $b; }, 1)(5)); | ||
$this->assertSame(5, ary(function ($a = 0, $b = 0, $c = 0) { return $a + $b + $c; }, 1)(5)); | ||
$this->assertSame(6, ary(function ($a = 0, $b = 0, $c = 0) { return $a + $b + $c; }, -1)(6)); | ||
$this->assertSame(7, ary(function ($a = 0, $b = 0, $c = 0) { return $a + $b + $c; }, 2)(5, 2)); | ||
$this->assertNull(ary(function ($a = 0, $b = 0) { return $a + $b; }, 0)(5)); | ||
} | ||
} |