@@ -8,27 +8,27 @@ |
||
| 8 | 8 | class InsertTest extends TestCase |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public function testInsertFirst() |
|
| 12 | - { |
|
| 11 | + public function testInsertFirst() |
|
| 12 | + { |
|
| 13 | 13 | $array = [1, 2, 3, 4, 5]; |
| 14 | 14 | $expected = ['newItem', 1, 2, 3, 4, 5]; |
| 15 | 15 | $actual = insert(0)('newItem')($array); |
| 16 | 16 | $this->assertEquals($expected, $actual); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function testInsertLast() |
|
| 20 | - { |
|
| 19 | + public function testInsertLast() |
|
| 20 | + { |
|
| 21 | 21 | $array = [1, 2, 3, 4, 5]; |
| 22 | 22 | $expected = [1, 2, 3, 4, 5, 'newItem']; |
| 23 | 23 | $actual = insert(5)('newItem')($array); |
| 24 | 24 | $this->assertEquals($expected, $actual); |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function testInsertNth() |
|
| 28 | - { |
|
| 27 | + public function testInsertNth() |
|
| 28 | + { |
|
| 29 | 29 | $array = [1, 2, 3, 4, 5]; |
| 30 | 30 | $expected = [1, 2, 'newItem', 3, 4, 5]; |
| 31 | 31 | $actual = insert(2)('newItem')($array); |
| 32 | 32 | $this->assertEquals($expected, $actual); |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function testInsertNth() |
| 28 | 28 | { |
| 29 | 29 | $array = [1, 2, 3, 4, 5]; |
| 30 | - $expected = [1, 2, 'newItem', 3, 4, 5]; |
|
| 30 | + $expected = [1, 2, 'newItem', 3, 4, 5]; |
|
| 31 | 31 | $actual = insert(2)('newItem')($array); |
| 32 | 32 | $this->assertEquals($expected, $actual); |
| 33 | 33 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | function isNil() |
| 8 | 8 | { |
| 9 | - $arguments = func_get_args(); |
|
| 10 | - $curried = curryN('is_null', 1); |
|
| 11 | - return call_user_func_array($curried, $arguments); |
|
| 9 | + $arguments = func_get_args(); |
|
| 10 | + $curried = curryN('is_null', 1); |
|
| 11 | + return call_user_func_array($curried, $arguments); |
|
| 12 | 12 | } |
@@ -7,21 +7,21 @@ |
||
| 7 | 7 | |
| 8 | 8 | class MatchTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testMatch() |
|
| 11 | - { |
|
| 10 | + public function testMatch() |
|
| 11 | + { |
|
| 12 | 12 | $pattern = '/^([a-z]+)-([0-9]+)$/'; |
| 13 | 13 | $testString = 'cat-009'; |
| 14 | 14 | $expect = ['cat-009', 'cat', '009']; |
| 15 | 15 | $actual = match($pattern, $testString); |
| 16 | 16 | $this->assertEquals($expect, $actual); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function testUnmatch() |
|
| 20 | - { |
|
| 19 | + public function testUnmatch() |
|
| 20 | + { |
|
| 21 | 21 | $pattern = '/^([a-z]+)-([0-9]+)$/'; |
| 22 | 22 | $testString = 'cat009'; |
| 23 | 23 | $expect = []; |
| 24 | 24 | $actual = match($pattern, $testString); |
| 25 | 25 | $this->assertEquals($expect, $actual); |
| 26 | - } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | |
| 8 | 8 | class JoinTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testJoinWithComma() |
|
| 11 | - { |
|
| 10 | + public function testJoinWithComma() |
|
| 11 | + { |
|
| 12 | 12 | $array = [1, 2, 3]; |
| 13 | 13 | $expect = '1,2,3'; |
| 14 | 14 | $actual = join(',')($array); |
| 15 | 15 | $this->assertEquals($expect, $actual); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | |
| 8 | 8 | class LengthTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testLength() |
|
| 11 | - { |
|
| 10 | + public function testLength() |
|
| 11 | + { |
|
| 12 | 12 | $array = [1, 2, 3, 4, 5]; |
| 13 | 13 | $expect = 5; |
| 14 | 14 | $actual = length()($array); |
| 15 | 15 | $this->assertEquals($expect, $actual); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | |
| 8 | 8 | class MedianTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testMedianWithOddNumberOfArguments() |
|
| 11 | - { |
|
| 10 | + public function testMedianWithOddNumberOfArguments() |
|
| 11 | + { |
|
| 12 | 12 | $numbers = [2, 9, 7]; |
| 13 | 13 | $expect = 7; |
| 14 | 14 | $actual = median()($numbers); |
| 15 | 15 | $this->assertEquals($expect, $actual); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testMedianWithEvenNumberOfArguments() |
|
| 19 | - { |
|
| 18 | + public function testMedianWithEvenNumberOfArguments() |
|
| 19 | + { |
|
| 20 | 20 | $numbers = [7, 2, 10, 9]; |
| 21 | 21 | $expect = 8; |
| 22 | 22 | $actual = median()($numbers); |
| 23 | 23 | $this->assertEquals($expect, $actual); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -7,18 +7,18 @@ |
||
| 7 | 7 | |
| 8 | 8 | class MeanTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testMean() |
|
| 11 | - { |
|
| 10 | + public function testMean() |
|
| 11 | + { |
|
| 12 | 12 | $numbers = [2, 7, 9]; |
| 13 | 13 | $expect = 6; |
| 14 | 14 | $actual = mean()($numbers); |
| 15 | 15 | $this->assertEquals($expect, $actual); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testMeanWithEmptyArray() |
|
| 19 | - { |
|
| 18 | + public function testMeanWithEmptyArray() |
|
| 19 | + { |
|
| 20 | 20 | $this->expectException(\InvalidArgumentException::class); |
| 21 | 21 | $numbers = []; |
| 22 | 22 | mean()($numbers); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -7,27 +7,27 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ModuloTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testModuloEvenNumber() |
|
| 11 | - { |
|
| 10 | + public function testModuloEvenNumber() |
|
| 11 | + { |
|
| 12 | 12 | $number = 20; |
| 13 | 13 | $expect = 0; |
| 14 | 14 | $actual = modulo($number)(2); |
| 15 | 15 | $this->assertEquals($expect, $actual); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testModuloOddNumber() |
|
| 19 | - { |
|
| 18 | + public function testModuloOddNumber() |
|
| 19 | + { |
|
| 20 | 20 | $number = 17; |
| 21 | 21 | $expect = 1; |
| 22 | 22 | $actual = modulo($number)(2); |
| 23 | 23 | $this->assertEquals($expect, $actual); |
| 24 | - } |
|
| 25 | - public function testCustomModulo() |
|
| 26 | - { |
|
| 24 | + } |
|
| 25 | + public function testCustomModulo() |
|
| 26 | + { |
|
| 27 | 27 | $number = 17; |
| 28 | 28 | $expect = 2; |
| 29 | 29 | $modBy = 5; |
| 30 | 30 | $actual = modulo($number)($modBy); |
| 31 | 31 | $this->assertEquals($expect, $actual); |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | |
| 8 | 8 | class MaxTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testMax() |
|
| 11 | - { |
|
| 10 | + public function testMax() |
|
| 11 | + { |
|
| 12 | 12 | $firstValue = 100; |
| 13 | 13 | $secondValue = 200; |
| 14 | 14 | $expect = 200; |
| 15 | 15 | $actual = max($firstValue)($secondValue); |
| 16 | 16 | $this->assertEquals($expect, $actual); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } |