def test_subtract_1_1(self): """Test subtract with 1 - 1""" MNE.run_interpreter_from_python("00100000010010000001017", True) self.assertAlmostEqual(MNE.stack[0], 0.0)
def test_read_float_failure(self): """Test read float "cheeseburger" """ MNE.run_interpreter_from_python("003", True, True, ["cheeseburger"]) self.assertAlmostEqual(MNE.stack, [0.0])
def test_read_string_hello_world(self): """Test read string "Hello, world!" """ MNE.run_interpreter_from_python("004", True, True, ["Hello, world!"]) self.assertAlmostEqual(MNE.stack, [33., 100., 108., 114., 111., 119., \ 32., 44., 111., 108., 108., 101., 72., 1.])
def test_pop_stack_underflow(self): """Test that stack underflow due to popping is handled safely""" MNE.run_interpreter_from_python("020", True)
def test_read_float_3_14159(self): """Test read float "3.14159" """ MNE.run_interpreter_from_python("003", True, True, ["3.14159"]) self.assertAlmostEqual(MNE.stack, [3.14159, 1.0])
def test_duplicate(self): """Test duplicate""" MNE.run_interpreter_from_python("00100000010210010000002021021", True) self.assertEqual(MNE.stack, [1.0, 1.0, 2.0, 2.0, 2.0])
def test_push_float_1e_minus_99(self): """Test push float 1e-99""" MNE.run_interpreter_from_python("0021990000001", True) self.assertAlmostEqual(MNE.stack[0] * 1e99, 1.0)
def test_multiply_1_1_1_1(self): """Test multiply with 1.1 * 1.1""" MNE.run_interpreter_from_python("00210100000110021010000011018", True) self.assertAlmostEqual(MNE.stack[0], 1.21)
def test_divide_16_2(self): """Test divide with 16 / 2""" MNE.run_interpreter_from_python("00100000020010000016019", True) self.assertAlmostEqual(MNE.stack[0], 8.0)
def test_multiply_1e99_1e_minus_99(self): """Test multiply with 1e99 * 1e-99""" MNE.run_interpreter_from_python("00219900000010020990000001018", True) self.assertAlmostEqual(MNE.stack[0], 1.0)
def test_push_float_minus_0_123456(self): """Test push float -0.123456""" MNE.run_interpreter_from_python("0021061123456", True) self.assertAlmostEqual(MNE.stack, [-.123456])
def test_multiply_minus_1_1(self): """Test multiply with -1 * 1""" MNE.run_interpreter_from_python("00100000010011000001018", True) self.assertAlmostEqual(MNE.stack[0], -1.0)
def test_subtract_3_14159_minus_0_14159(self): """Test subtract with 3.14159 - 0.14159""" MNE.run_interpreter_from_python("00210500141590021050314159017", True) self.assertAlmostEqual(MNE.stack[0], 3.0)
def test_subtract_1e99_1e_minus_99(self): """Test subtract with 1e99 - 1e-99""" MNE.run_interpreter_from_python("00219900000010020990000001017", True) self.assertAlmostEqual(MNE.stack[0], 1e99)
def test_remainder_13_3_2_99(self): """Test remainder with 13.3 % 2.99""" MNE.run_interpreter_from_python("00210200002990021010000133022", True) self.assertAlmostEqual(MNE.stack[0], 1.0)
def test_divide_3_14159_minus_3_14159(self): """Test divide with 3.14159 / -3.14159""" MNE.run_interpreter_from_python("00210513141590021050314159019", True) self.assertAlmostEqual(MNE.stack[0], -1.0)
def test_pop(self): """Test pop""" MNE.run_interpreter_from_python("00100000010010000002020020", True) self.assertEqual(MNE.stack, [])
def test_divide_1_1e_minus_99(self): """Test divide with 1 / 1e-99""" MNE.run_interpreter_from_python("00219900000010010000001019", True) self.assertAlmostEqual(MNE.stack[0], 1e99)
def test_push_float_100(self): """Test push float 10000e-2""" MNE.run_interpreter_from_python("0021020010000", True) self.assertAlmostEqual(MNE.stack, [100.0])
def test_divide_1_21_1_1(self): """Test divide with 1.21 / 1.1""" MNE.run_interpreter_from_python("00210100000110021020000121019", True) self.assertAlmostEqual(MNE.stack[0], 1.1)
def test_push_pop(self): """Test integer push followed by vanilla pop""" MNE.run_interpreter_from_python("0010000001020", True) self.assertEqual(MNE.stack, [])
def test_divide_indeterminate(self): """Test divide zero by zero""" MNE.run_interpreter_from_python("00100000000010000000019", True) self.assertEqual(MNE.stack, [])
def test_read_float_0(self): """Test read float "0" """ MNE.run_interpreter_from_python("003", True, True, ["0"]) self.assertAlmostEqual(MNE.stack, [0.0, 1.0])
def test_remainder_5_5(self): """Test remainder 5 % 5""" MNE.run_interpreter_from_python("00100000050010000005022", True) self.assertAlmostEqual(MNE.stack[0], 0.0)
def test_read_float_minus_1e99(self): """Test read float "-1e99" """ MNE.run_interpreter_from_python("003", True, True, ["-1e99"]) self.assertAlmostEqual(MNE.stack, [-1e99, 1.0])
def test_remainder_undefined(self): """Test remainder when undefined""" MNE.run_interpreter_from_python("00100000000010000005022", True) self.assertEqual(MNE.stack, [])
def test_read_string_empty(self): """Test reading an empty string""" MNE.run_interpreter_from_python("004", True, True, [""]) self.assertAlmostEqual(MNE.stack, [1.0])
def test_push_float_123456e99(self): """Test push float 123456e99""" MNE.run_interpreter_from_python("0020990123456", True) self.assertAlmostEqual(MNE.stack, [123456e99])
def test_read_string_unicode(self): """Test reading string with a unicode character""" MNE.run_interpreter_from_python("004", True, True, ["¯\_(ツ)_/¯"]) self.assertAlmostEqual(MNE.stack, [175., 47., 95., 41., 12484., 40., \ 95., 92., 175., 1.])
def test_add_3_14159_minus_0_14159(self): """Test add with 3.14159 + -0.14159""" MNE.run_interpreter_from_python("00210503141590021051014159016", True) self.assertAlmostEqual(MNE.stack[0], 3.0)