|
|
@ -445,6 +445,16 @@ class TestJSInterpreter(unittest.TestCase):
|
|
|
|
jsi = JSInterpreter('function x(){return 1236566549 << 5}')
|
|
|
|
jsi = JSInterpreter('function x(){return 1236566549 << 5}')
|
|
|
|
self.assertEqual(jsi.call_function('x'), 915423904)
|
|
|
|
self.assertEqual(jsi.call_function('x'), 915423904)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_bitwise_operators_typecast(self):
|
|
|
|
|
|
|
|
jsi = JSInterpreter('function x(){return null << 5}')
|
|
|
|
|
|
|
|
self.assertEqual(jsi.call_function('x'), 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsi = JSInterpreter('function x(){return undefined >> 5}')
|
|
|
|
|
|
|
|
self.assertEqual(jsi.call_function('x'), 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsi = JSInterpreter('function x(){return 42 << NaN}')
|
|
|
|
|
|
|
|
self.assertEqual(jsi.call_function('x'), 42)
|
|
|
|
|
|
|
|
|
|
|
|
def test_negative(self):
|
|
|
|
def test_negative(self):
|
|
|
|
jsi = JSInterpreter("function f(){return 2 * -2.0;}")
|
|
|
|
jsi = JSInterpreter("function f(){return 2 * -2.0;}")
|
|
|
|
self.assertEqual(jsi.call_function('f'), -4)
|
|
|
|
self.assertEqual(jsi.call_function('f'), -4)
|
|
|
|