def testGivenExpressionWithOneVariableWhenSimplifyNameThenSameExpressionIsObtained( self): variable = VariableBuilder().build() expression = ExpressionBuilder().term(variable).build() expression2 = expression.clon() expression.simplify_variable(variable.name) self.assertTrue(expression.equal(expression2))
def testGivenNotEmptyExpressionWhenClonThenExpressionEqualsReturnsTrue( self): expression = ExpressionBuilder().default_constant().default_variable( ).default_variable().build() expression_clon = expression.clon() self.assertFalse(expression is expression_clon) self.assertTrue(expression.equal(expression_clon))
def testGivenExpressionWithOneConstantWhenSimplifyThenSameExpressionIsObtained( self): expression = ExpressionBuilder().default_constant().build() expression2 = expression.clon() expression.simplify_constant() self.assertTrue(expression.equal(expression2))
def testGivenEmptyExpressionWhenAddExpressionThenEqualsReturnsTrue(self): expression1 = ExpressionBuilder().build() expression2 = ExpressionBuilder().default_constant().default_variable( ).build() expression1.add_expression(expression2) self.assertTrue(expression1.equal(expression2))