public function testCanCompareFunctionNodes() { $node = new FunctionNode('sin', new VariableNode('x')); $other = new NumberNode(1); $this->assertFalse($node->compareTo(null)); $this->assertFalse($node->compareTo($other)); $this->assertTrue($node->compareTo($node)); $this->assertFalse($node->compareTo(new FunctionNode('cos', new VariableNode('x')))); }
public function testCanCompareUnaryMinus() { $node = new FunctionNode('sin', new ExpressionNode(new VariableNode('x'), '-', null)); $other = new FunctionNode('sin', new ExpressionNode(new VariableNode('a'), '-', null)); $this->assertTrue($node->compareTo($node)); $this->assertTrue($other->compareTo($other)); $this->assertFalse($node->compareTo($other)); $this->assertFalse($other->compareTo($node)); }