def test_factorial(self): result = rpn.calculate("4 !") self.assertEqual(24, result)
def test_add(self): result = rpn.calculate("1 1 +") self.assertEqual(2, result)
def test_modulus(self): result = rpn.calculate("7 2 %") self.assertEqual(1, result)
def test_summation(self): result = rpn.calculate('1 2 3 4 5 6 7 8 9 10 s') self.assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55], result)
def test_adds(self): result = rpn.calculate('1 1 + 2 +') self.assertEqual(4, result)
def test_exponentiation(self): result = rpn.calculate('2 3 ^') self.assertEqual(8, result)
def test_bitwiseand(self): result = rpn.calculate('10 3 &') self.assertEqual(2 ,result)
def test_mul(self): result = rpn.calculate('2 3 *') self.assertEqual(6, result)
def test_div(self): result = rpn.calculate('4 2 /') self.assertEqual(2, result)
def test_sub(self): result = rpn.calculate('5 3 -') self.assertEqual(2, result)
def test_carat(self): result = rpn.calculate('3 2 ^') self.assertEqual(9, result)
def test_div2(self): result = rpn.calculate('24 3 /') self.assertEqual(8, result)
def test_toomany(self): with self.assertRaises(TypeError): result = rpn.calculate('1 2 3 +')
def test_integerdiv(self): result = rpn.calculate('5 2 //') self.assertEqual(2, result)
def test_multiplies(self): result = rpn.calculate('2 3 * 4 *') self.assertEqual(24, result)
def test_percent(self): result = rpn.calculate('10 50 %') self.assertEqual(5, result)
def test_bitwisenot(self): result = rpn.calculate('10 ~') self.assertEqual(-11, result)
def test_div_by_0(self): result = rpn.calculate('4 3 - 0 /') self.assertEqual(1, result)
def test_exponentiationZ(self): result = rpn.calculate('2 0 ^') self.assertEqual(1, result)
def test_summation(self): result = rpn.calculate('2 3 4 5 s') self.assertEqual(14, result)
def test_divide(self): result = rpn.calculate("6 3 /") self.assertEqual(2, result)
def test_exponents(self): result = rpn.calculate("3 2 ^") self.assertEqual(9, result)
def test_div(self): result = rpn.calculate('12 8 /') self.assertEqual(1, result)
def test_exponent(self): result = rpn.calculate('2 2 ^') self.assertEqual(4, result)
def test_intDivision(self): result = rpn.calculate("7 2 //") self.assertEqual(3, result)
def test_carat(self): result = rpn.calculate("2 4 ^") self.assertEqual(16, result)
def test_repeat(self): result = rpn.calculate("4 2 6 * &") self.assertEqual(48, result)
def test_multiply(self): result = rpn.calculate('4 3 *') self.assertEqual(12, result)
def test_substract(self): result = rpn.calculate('5 2 -') self.assertEqual(3, result)
def test_chain(seld): result = rpn.calculate('1 1 + 2 *') self.assertEqual(4, result)
def test_multiply(self): result = rpn.calculate('2 3 *') self.assertEqual(6, result)
def test_subtract(self): result = rpn.calculate('4 3 -') self.assertEqual(1, result)
def test_divides(self): result = rpn.calculate('6 2 / 3 /') self.assertEqual(1, result)
def test_exponentiate(self): result = rpn.calculate("3 3 ^") self.assertEqual(27, result)
def test_bitwiseor(self): result = rpn.calculate('10 3 |') self.assertEqual(11, result)
def test_badstring(self): with self.assertRaises(TypeError): rpn.calculate("1 2 3 +")
def test_rotate(self): result = rpn.calculate('1 2 3 r') self.assertEqual([3, 2, 1], result)
def test_exponent(self): result = rpn.calculate("5 2 ^") self.assertEqual(25, result)
def test_exponentiationPos(self): result = rpn.calculate('2 3 ^') self.assertEqual(8, result)
def test_subtract(self): result = rpn.calculate("5 3 -") self.assertEqual(2, result)
def test_exponentiationNeg(self): result = rpn.calculate('2 -1 ^') self.assertEqual(0.5, result)
def test_multiply(self): result = rpn.calculate("5 3 *") self.assertEqual(15, result)
def test_exp(self): result = rpn.calculate("3 2 ^") self.assertEqual(9, result)
def test_power(self): result = rpn.calculate("2 3 ^") self.assertEqual(8, result)
def test_subtract(self): result = rpn.calculate('5 3 -') print(result) self.assertEqual(2, result)