Exemple #1
0
    def test_singleNumberPrint(self):

        c.stack.clear()

        c.string.set("6")
        c.getResult()
        self.assertEqual(c.string.get(), "6.0")
Exemple #2
0
    def test_minus(self):

        c.stack.clear()

        c.string.set("6 - 4")
        c.getResult()
        self.assertEqual(c.string.get(), "2.0")
Exemple #3
0
    def test_minus_negative(self):

        c.stack.clear()

        c.string.set("6 - 74")
        c.getResult()
        self.assertEqual(c.string.get(), "-68.0")
Exemple #4
0
    def test_power(self):

        c.stack.clear()

        c.string.set("6 ^ 2")
        c.getResult()
        self.assertEqual(c.string.get(), "36.0")
Exemple #5
0
    def test_brackets(self):

        c.stack.clear()

        c.string.set("( 4 +  4 ) * 2")
        c.getResult()
        self.assertEqual(c.string.get(), "16.0")
Exemple #6
0
    def test_divide_zero(self):

        c.stack.clear()

        c.string.set("6 / 0")
        c.getResult()
        self.assertEqual(c.string.get(), "6 / 0")
Exemple #7
0
    def test_divide(self):

        c.stack.clear()

        c.string.set("6 / 2.5")
        c.getResult()
        self.assertEqual(c.string.get(), "2.4")
Exemple #8
0
    def test_multiply_zero(self):

        c.stack.clear()

        c.string.set("4 * 0")
        c.getResult()
        self.assertEqual(c.string.get(), "0.0")
Exemple #9
0
    def test_multiply(self):

        c.stack.clear()

        c.string.set("4 * 6")
        c.getResult()
        self.assertEqual(c.string.get(), "24.0")
Exemple #10
0
    def test_cotan(self):

        c.stack.clear()

        c.string.set("0")
        c.getResult()
        self.assertEqual(c.string.get(), "0.0")
Exemple #11
0
    def test_expression(self):

        c.stack.clear()

        c.string.set("( 2 * 4 - ( 7 / 7 ) + 2 ) * 3 + 4")
        c.getResult()
        self.assertEqual(c.string.get(), "31.0")
Exemple #12
0
    def test_tan(self):

        c.stack.clear()

        c.string.set("tan 1")
        c.getResult()
        self.assertEqual(c.string.get(), "1.55740772465")
Exemple #13
0
    def test_log(self):

        c.stack.clear()

        c.string.set("log 10")
        c.getResult()
        self.assertEqual(c.string.get(), "1.0")
Exemple #14
0
    def test_cos(self):

        c.stack.clear()

        c.string.set("cos 0")
        c.getResult()
        self.assertEqual(c.string.get(), "1.0")
Exemple #15
0
    def test_addition_neg(self):

        c.stack.clear()

        c.string.set("-2 + 6")
        c.getResult()
        self.assertEqual(c.string.get(), "4.0")
Exemple #16
0
    def test_addition(self):

        c.stack.clear()

        c.string.set("4 + 8")
        c.getResult()
        self.assertEqual(c.string.get(), "12.0")