mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-07-17 02:57:38 -05:00
@ -445,6 +445,16 @@ class TestJSInterpreter(unittest.TestCase):
|
||||
jsi = JSInterpreter('function x(){return 1236566549 << 5}')
|
||||
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):
|
||||
jsi = JSInterpreter("function f(){return 2 * -2.0;}")
|
||||
self.assertEqual(jsi.call_function('f'), -4)
|
||||
|
Reference in New Issue
Block a user