public function testParserWithStringConstants()
 {
     $context = new Context();
     $const = 'string constant';
     $context->def('const', $const, 'string');
     $actual = Parser::parse('const', $context);
     $this->assertEquals($const, $actual);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \Shunt\Exception\RuntimeError
  */
 public function testModulusFromZero()
 {
     $equation = '100%0';
     Parser::parse($equation);
 }
 /**
  * @expectedException \Shunt\Exception\ParseError
  */
 public function testParserExceptionSurplusClosingBracket()
 {
     $context = new Context();
     $context->defFunction('pi');
     $equation = 'pi())';
     $actual = Parser::parse($equation, $context);
 }
 public function testParenthesisThrowsError()
 {
     $this->expectOutputString(null);
     $equation = '()';
     return Parser::parse($equation);
 }