|
|
|
@ -93,6 +93,16 @@ class TestJSInterpreter(unittest.TestCase):
|
|
|
|
|
self._test('function f(){return 0 ?? 42;}', 0)
|
|
|
|
|
self._test('function f(){return "life, the universe and everything" < 42;}', False)
|
|
|
|
|
self._test('function f(){return 0 - 7 * - 6;}', 42)
|
|
|
|
|
self._test('function f(){return true << "5";}', 32)
|
|
|
|
|
self._test('function f(){return true << true;}', 2)
|
|
|
|
|
self._test('function f(){return "19" & "21.9";}', 17)
|
|
|
|
|
self._test('function f(){return "19" & false;}', 0)
|
|
|
|
|
self._test('function f(){return "11.0" >> "2.1";}', 2)
|
|
|
|
|
self._test('function f(){return 5 ^ 9;}', 12)
|
|
|
|
|
self._test('function f(){return 0.0 << NaN}', 0)
|
|
|
|
|
self._test('function f(){return null << undefined}', 0)
|
|
|
|
|
# TODO: Does not work due to number too large
|
|
|
|
|
# self._test('function f(){return 21 << 4294967297}', 42)
|
|
|
|
|
|
|
|
|
|
def test_array_access(self):
|
|
|
|
|
self._test('function f(){var x = [1,2,3]; x[0] = 4; x[0] = 5; x[2.0] = 7; return x;}', [5, 2, 7])
|
|
|
|
|