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)
def testSubInt(self): # Test the subtraction of integers # Benign test of two pushes # Apply the subtraction Method # Check just the resultant subtraction value on the stack s = RPNCaculator() s.push(2) s.push(5) s.sub() self.assertEqual(str(s), '[-3*]') a = s.pop() self.assertEqual(a, -3)
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)
def testSubInt(self): # Test the subtraction of integers # Benign test of two pushes # Apply the subtraction Method # Check just the resultant subtraction value on the stack s = RPNCaculator() s.push(2) s.push(5) s.sub() self.assertEqual(str(s),'[-3*]') a = s.pop() self.assertEqual(a,-3)
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)
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)