Example #1
0
    public function testReduceOnCalc()
    {
        $param = new Calc('1d6');

        $actual = CalcOperation::reduce($param);

        $this->assertTrue(($actual >= 1));
        $this->assertTrue(($actual <= 6));
    }
Example #2
0
    /**
     * @dataProvider dataForAdd
     *
     * @param $num1
     * @param $num2
     * @param $expected
     */
    public function testAdd($num1, $num2, $expected)
    {
        $actual = CalcOperation::calc('+', $num1, $num2);

        $this->assertSame($expected, $actual);
    }
Example #3
0
    /**
     * @dataProvider dataForGreaterThan
     *
     * @param $num1
     * @param $num2
     * @param $expected
     */
    public function testGreaterThan($num1, $num2, $expected)
    {
        $actual = CalcOperation::calc('>', $num1, $num2);

        $this->assertSame($expected, $actual);
    }
Example #4
0
 /**
  * @expectedException \Exception
  */
 public function testCalcUnknownOperator() {
     CalcOperation::calc('?', 1, 2);
 }
Example #5
0
 /**
  * @dataProvider dataForAddNaN
  * @param $num1
  * @param $num2
  * @expectedException \Exception
  * @expectedExceptionMessage This is not a number
  */
 public function testAddNaN($num1, $num2)
 {
     CalcOperation::calc('+', $num1, $num2);
 }