def testAddFloat(self):
        # Test the addition of the floats

        # Push two floats 
        # apply addition method
        # CHeck just the  resultant sum value on the stack
        s = RPNCaculator()
        s.push(2.3)
        s.push(5.7)
        s.add()
        self.assertEqual(str(s),'[8.0*]')
        a = s.pop()
        self.assertEqual(a,8)
Beispiel #2
0
    def testAddFloat(self):
        # Test the addition of the floats

        # Push two floats
        # apply addition method
        # CHeck just the  resultant sum value on the stack
        s = RPNCaculator()
        s.push(2.3)
        s.push(5.7)
        s.add()
        self.assertEqual(str(s), '[8.0*]')
        a = s.pop()
        self.assertEqual(a, 8)
Beispiel #3
0
    def testAddInt(self):
        #Test the addition of two integers

        # Benign test of two pushes
        # apply the add Method
        # Check just the resultant sum value on the stack
        s = RPNCaculator()
        s.push(2)
        s.push(5)
        s.add()
        #check just the result on the stack

        self.assertEqual(str(s), '[7*]')
        a = s.pop()
        self.assertEqual(a, 7)
    def testAddInt(self):
        #Test the addition of two integers


        # Benign test of two pushes
        # apply the add Method
        # Check just the resultant sum value on the stack
        s = RPNCaculator()
        s.push(2)
        s.push(5)
        s.add()
        #check just the result on the stack

        self.assertEqual(str(s),'[7*]')
        a = s.pop()
        self.assertEqual(a,7)
    def testAddThree(self):
        #Test adding of three numbers (Mixture of the floats and integers)

        #Push first two values onto the stack
        #Apply the addition (the sum back to the stack)
        #push the third to the stack
        #apply the addition
        #Check just the final resultant sum value on the stack
        s = RPNCaculator()
        s.push(3)
        s.push(5.7)
        s.add()
        s.push(2.3)
        s.add()
        self.assertEqual(str(s),'[11.0*]')
        a = s.pop()
        self.assertEqual(a,11.0)        
Beispiel #6
0
    def testAddThree(self):
        #Test adding of three numbers (Mixture of the floats and integers)

        #Push first two values onto the stack
        #Apply the addition (the sum back to the stack)
        #push the third to the stack
        #apply the addition
        #Check just the final resultant sum value on the stack
        s = RPNCaculator()
        s.push(3)
        s.push(5.7)
        s.add()
        s.push(2.3)
        s.add()
        self.assertEqual(str(s), '[11.0*]')
        a = s.pop()
        self.assertEqual(a, 11.0)