Skip to content

Commit

Permalink
Issue #2 五倍數列初始版本
Browse files Browse the repository at this point in the history
  • Loading branch information
mouson committed Mar 20, 2019
1 parent de98d8c commit e7d1dfc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Helpers/SequenceCalculator/QuintupleSequenceCalculator.php
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';
}
}
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);
}

}

0 comments on commit e7d1dfc

Please sign in to comment.