Beispiel #1
0
    def test_singleNumberPrint(self):

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

        c.string.set("0")
        c.getResult()
        self.assertEqual(c.string.get(), "0.0")
Beispiel #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")
Beispiel #12
0
    def test_tan(self):

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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

        c.stack.clear()

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