def check_expr(self, expr, variables_and_values): """Check that ShortExpressionFinder returns an expression that's logically equivalent to |expr| and equally simple, when given the matching configs. """ configs = matching_configs(expr, variables_and_values) output_expr = ShortExpressionFinder(variables_and_values).get_expr(configs) output_configs = matching_configs(output_expr, variables_and_values) self.assertEqual(configs, output_configs) self.assertEqual(expr.count('=='), output_expr.count('==')) self.assertEqual(expr.count('('), output_expr.count('('))
def check_expr(self, expr, variables_and_values): """Check that ShortExpressionFinder returns an expression that's logically equivalent to |expr| and equally simple, when given the matching configs. """ configs = matching_configs(expr, variables_and_values) output_expr = ShortExpressionFinder(variables_and_values).get_expr( configs) output_configs = matching_configs(output_expr, variables_and_values) self.assertEqual(configs, output_configs) self.assertEqual(expr.count('=='), output_expr.count('==')) self.assertEqual(expr.count('('), output_expr.count('('))