Skip to content

Commit

Permalink
[new] #5 - test for -- operator
Browse files Browse the repository at this point in the history
  • Loading branch information
dbojdo8x8 committed Feb 15, 2016
1 parent 4c81d9e commit 0e7c3a1
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/EvalMathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,46 @@ public function moduloOperatorData()
)
);
}

/**
* @test
* @dataProvider doubleMinusData
*/
public function shouldConsiderDoubleMinusAsPlus($formula, $values, $expectedResult)
{
foreach ($values as $k => $v) {
$this->evalMath->v[$k] = $v;
}

$this->assertEquals(
$expectedResult,
$this->evalMath->evaluate($formula)
);
}

public function doubleMinusData()
{
return array(
array(
'a+b*c--d', // 1+2*3--4 => 1+6+4 => 11
array(
'a' => 1,
'b' => 2,
'c' => 3,
'd' => 4
),
11
),
array(
'a+b*c--d', // 1+2*3---4 => 1+6-4 => 3
array(
'a' => 1,
'b' => 2,
'c' => 3,
'd' => -4
),
3
)
);
}
}

0 comments on commit 0e7c3a1

Please sign in to comment.