예제 #1
0
 def test_will_return_correct_constants_from_equation_2(self):
     equation_parser = EquationParser(
         string_equation=self.equation_with_two_proper_operands())
     value = equation_parser.evaluate()
     self.assertEqual(
         value, "3.25 / 1.5",
         "Should convert sudo mixed numbers to decimal values in string equation"
     )
예제 #2
0
 def test_will_return_correct_constants_from_equation(self):
     equation_parser = EquationParser(
         string_equation=self.equation_with_singular_sudo_mixed_fraction())
     value = equation_parser.evaluate()
     self.assertEqual(
         value, "3.25",
         "Should convert sudo mixed numbers to decimal values in string equation"
     )
예제 #3
0
 def test_will_return_correct_constants_from_equation_7(self):
     equation_parser = EquationParser(
         string_equation=self.equation_with_improper_fraction_as_operand())
     value = equation_parser.evaluate()
     self.assertEqual(
         value, "2.75 + 7",
         "Should convert sudo mixed numbers to decimal values in string equation"
     )
예제 #4
0
 def test_will_return_correct_constants_from_equation_with_decimal_mixed_numbers(
         self):
     equation_parser = EquationParser(
         string_equation=self.equation_with_decimal_mixed_numbers())
     value = equation_parser.evaluate()
     self.assertEqual(
         value, "5.5 + 4.1",
         "Should convert sudo mixed numbers to decimal values in string equation"
     )
예제 #5
0
 def test_will_return_correct_constants_from_equation_with_more_than_two_operands_with_negative_values(
         self):
     equation_parser = EquationParser(
         string_equation=self.
         equation_with_more_than_two_operands_with_negative_values())
     value = equation_parser.evaluate()
     self.assertEqual(
         value, "-3.25 / -1.5 * -5.5",
         "Should convert sudo mixed numbers to decimal values in string equation"
     )
예제 #6
0
    def test_will_properly_evaluate_simple_equation(self):
        equation_parser = EquationParser(
            string_equation=self.equation_with_two_proper_positive_operands())
        string_equation = equation_parser.evaluate()

        evaluate = EvaluateEquation(equation=string_equation)
        mixed_number = evaluate.to_mixed_number()
        decimal_number = evaluate.to_decimal()

        self.assertEqual(decimal_number, 5.25)
        self.assertEqual(mixed_number, "5_1/4")
예제 #7
0
    def test_will_properly_evaluate_simple_operand(self):
        equation_parser = EquationParser(
            string_equation=self.equation_with_singular_sudo_mixed_fraction())
        string_equation = equation_parser.evaluate()

        evaluate = EvaluateEquation(equation=string_equation)
        mixed_number = evaluate.to_mixed_number()
        decimal_number = evaluate.to_decimal()

        self.assertEqual(decimal_number, 3.25)
        self.assertEqual(mixed_number, "3_1/4")
예제 #8
0
    def test_will_properly_evaluate_a_positive_mixed_number(self):
        equation_parser = EquationParser(
            string_equation=self.
            equation_with_singular_sudo_positive_improper_fraction())
        string_equation = equation_parser.evaluate()

        evaluate = EvaluateEquation(equation=string_equation)
        mixed_number = evaluate.to_mixed_number()
        decimal_number = evaluate.to_decimal()

        self.assertEqual(decimal_number, 2.75)
        self.assertEqual(mixed_number, "2_3/4")