@Chrono79: Yes that now fixes it, strange. Thank you so much!
Click reset (before backup your code if you have it), the test should be like this:
$this->revTest(sumOfDivided([12, 15]), [ [2, 12], [3, 27], [5, 15] ]);
The example I see:
class SumOfDividedTestCases extends TestCase { private function revTest($actual, $expected) { $this->assertEquals($expected, $actual); } public function testBasics() { $this->revTest(sumOfDivided([12, 15, 18]), [ [2, 12], [3, 27], [5, 15] ]); *** // REFERRING TO THIS LINE *** $this->revTest(sumOfDivided([15,21,24,30,45]), [ [2, 54], [3, 135], [5, 90], [7, 21] ]); $this->revTest(sumOfDivided([15,21,24,30,-45]), [ [2, 54], [3, 45], [5, 0], [7, 21] ]); } }
Are you sure you did not mix up some examples? The example you refer to I see as [12, 15] and indeed valid answer for it is [ [2, 12], [3, 27], [5, 15] ]. I do not see any example of [12, 15, 18].
[12, 15]
[ [2, 12], [3, 27], [5, 15] ]
[12, 15, 18]
EDIT: Damn, I was late to the party ;]
Yes, but the input in the example is [12, 15].
The input is [12, 15].
How is the first example [ [2, 12], [3, 27], [5, 15] ] ?
For input [12, 15, 18] shouldn't it be [ [2, 30], [3, 45], [5, 15] ]? Since 2 is prime and a factor of both 12 and 18 etc?
Loading collection data...
@Chrono79: Yes that now fixes it, strange. Thank you so much!
Click reset (before backup your code if you have it), the test should be like this:
The example I see:
class SumOfDividedTestCases extends TestCase
{
private function revTest($actual, $expected) {
$this->assertEquals($expected, $actual);
}
public function testBasics() {
$this->revTest(sumOfDivided([12, 15, 18]), [ [2, 12], [3, 27], [5, 15] ]); *** // REFERRING TO THIS LINE ***
$this->revTest(sumOfDivided([15,21,24,30,45]), [ [2, 54], [3, 135], [5, 90], [7, 21] ]);
$this->revTest(sumOfDivided([15,21,24,30,-45]), [ [2, 54], [3, 45], [5, 0], [7, 21] ]);
}
}
Are you sure you did not mix up some examples? The example you refer to I see as
[12, 15]
and indeed valid answer for it is[ [2, 12], [3, 27], [5, 15] ]
. I do not see any example of[12, 15, 18]
.EDIT: Damn, I was late to the party ;]
Yes, but the input in the example is
[12, 15]
.The input is
[12, 15]
.How is the first example [ [2, 12], [3, 27], [5, 15] ] ?
For input [12, 15, 18] shouldn't it be [ [2, 30], [3, 45], [5, 15] ]? Since 2 is prime and a factor of both 12 and 18 etc?