diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-05-20 02:57:59 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-05-20 04:07:17 +0530 |
commit | 1d7656184c6b8aa46b29149893894b3c24f1df00 (patch) | |
tree | b2cd5118498e24c9434e92658c8d44f3ac109679 /test | |
parent | f7f7a877bf8e87fd4eb0ad2494ad948ca7691114 (diff) | |
download | hypervideo-pre-1d7656184c6b8aa46b29149893894b3c24f1df00.tar.lz hypervideo-pre-1d7656184c6b8aa46b29149893894b3c24f1df00.tar.xz hypervideo-pre-1d7656184c6b8aa46b29149893894b3c24f1df00.zip |
[jsinterp] Handle `NaN` in bitwise operators
Closes #6131
Diffstat (limited to 'test')
-rw-r--r-- | test/test_jsinterp.py | 10 | ||||
-rw-r--r-- | test/test_youtube_signature.py | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 3283657d7..26711502a 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -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) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index e2b3f0870..13120d97f 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -146,6 +146,10 @@ _NSIG_TESTS = [ 'https://www.youtube.com/s/player/6f20102c/player_ias.vflset/en_US/base.js', 'lE8DhoDmKqnmJJ', 'pJTTX6XyJP2BYw', ), + ( + 'https://www.youtube.com/s/player/cfa9e7cb/player_ias.vflset/en_US/base.js', + 'aCi3iElgd2kq0bxVbQ', 'QX1y8jGb2IbZ0w', + ), ] |