예제 #1
0
 def testGivenExpressionWithOneVariableWhenSimplifyNameThenSameExpressionIsObtained(
         self):
     variable = VariableBuilder().build()
     expression = ExpressionBuilder().term(variable).build()
     expression2 = expression.clon()
     expression.simplify_variable(variable.name)
     self.assertTrue(expression.equal(expression2))
예제 #2
0
 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))
예제 #3
0
 def testGivenExpressionWithOneConstantWhenSimplifyThenSameExpressionIsObtained(
         self):
     expression = ExpressionBuilder().default_constant().build()
     expression2 = expression.clon()
     expression.simplify_constant()
     self.assertTrue(expression.equal(expression2))
예제 #4
0
 def testGivenEmptyExpressionWhenAddExpressionThenEqualsReturnsTrue(self):
     expression1 = ExpressionBuilder().build()
     expression2 = ExpressionBuilder().default_constant().default_variable(
     ).build()
     expression1.add_expression(expression2)
     self.assertTrue(expression1.equal(expression2))