-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Helpers/SequenceCalculator/QuintupleSequenceCalculator.php
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,25 @@ | ||
<?php | ||
/** | ||
* 五倍回傳計算數列 | ||
*/ | ||
|
||
namespace Mouson\Helpers\SequenceCalculator; | ||
|
||
class QuintupleSequenceCalculator implements CalculatorInterface | ||
{ | ||
|
||
/** | ||
* @param $value | ||
* | ||
* @return int|mixed | ||
*/ | ||
public function calculate($value) | ||
{ | ||
return ($value * 5); | ||
} | ||
|
||
public function getSequenceName() | ||
{ | ||
return 'Quintuple'; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/Mouson/Helpers/SequenceCalculator/QuintupleSequenceCalculatorTest.php
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,22 @@ | ||
<?php | ||
namespace Mouson\Helpers\SequenceCalculator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class QuintupleSequenceCalculatorTest extends TestCase | ||
{ | ||
public function test_物件產生後應可以取得物件名稱() | ||
{ | ||
/** Arrange */ | ||
$target = new QuintupleSequenceCalculator(); | ||
|
||
/** Assume */ | ||
$expected = 'Quintuple'; | ||
|
||
/** Act */ | ||
$actual = $target->getSequenceName(); | ||
|
||
/** Assert */ | ||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
} |