def testGivenTwoExpressionsWithDifferentConstantTermsThatSumTheSameValueWhenEqualThenReturnsFalse( self): constant = ConstantBuilder().build() double_constant = constant.clon() double_constant.multiply(2.0) self.assertFalse( ExpressionBuilder().term(double_constant).build().equal( ExpressionBuilder().term(constant).term(constant).build()))
def testGivenExpressionWithTwoConstantsWithInverseValuesWhenSimplifyThenExpressionWithConstantWithValue0IsObtained( self): constant1 = ConstantBuilder().build() constant2 = constant1.clon() constant2.multiply(-1.0) expression = ExpressionBuilder().term(constant1).term( constant2).build() expression.simplify_constant() self.assertEqual(expression.get_value_constant(), 0.0)
def testClon(self): variable1 = ConstantBuilder().build() variable2 = variable1.clon() self.assertFalse(variable1 is variable2) self.assertTrue(variable1.equal(variable2))