aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-06-21 08:51:14 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-06-21 09:21:23 +0530
commit42f2d40b475db66486a4b4fe5b56751a640db5db (patch)
treee24059c11d6aedb0a048c2d76c3bc43044b5fa5b /test
parent1619ab3e67d8dc4f86fc7ed292c79345bc0d91a0 (diff)
downloadhypervideo-pre-42f2d40b475db66486a4b4fe5b56751a640db5db.tar.lz
hypervideo-pre-42f2d40b475db66486a4b4fe5b56751a640db5db.tar.xz
hypervideo-pre-42f2d40b475db66486a4b4fe5b56751a640db5db.zip
Update to ytdl-commit-07af47
[YouTube] Improve fix for ae8ba2c https://github.com/ytdl-org/youtube-dl/commit/07af47960f3bb262ead02490ce65c8c45c01741e
Diffstat (limited to 'test')
-rw-r--r--test/test_jsinterp.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index e9682ddab..86928a6a0 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -35,6 +35,21 @@ class TestJSInterpreter(unittest.TestCase):
self._test('function f(){42}', None)
self._test('var f = function(){return 42;}', 42)
+ def test_add(self):
+ self._test('function f(){return 42 + 7;}', 49)
+ self._test('function f(){return 42 + undefined;}', NaN)
+ self._test('function f(){return 42 + null;}', 42)
+
+ def test_sub(self):
+ self._test('function f(){return 42 - 7;}', 35)
+ self._test('function f(){return 42 - undefined;}', NaN)
+ self._test('function f(){return 42 - null;}', 42)
+
+ def test_mul(self):
+ self._test('function f(){return 42 * 7;}', 294)
+ self._test('function f(){return 42 * undefined;}', NaN)
+ self._test('function f(){return 42 * null;}', 0)
+
def test_div(self):
jsi = JSInterpreter('function f(a, b){return a / b;}')
self._test(jsi, NaN, args=(0, 0))
@@ -42,6 +57,17 @@ class TestJSInterpreter(unittest.TestCase):
self._test(jsi, float('inf'), args=(2, 0))
self._test(jsi, 0, args=(0, 3))
+ def test_mod(self):
+ self._test('function f(){return 42 % 7;}', 0)
+ self._test('function f(){return 42 % 0;}', NaN)
+ self._test('function f(){return 42 % undefined;}', NaN)
+
+ def test_exp(self):
+ self._test('function f(){return 42 ** 2;}', 1764)
+ self._test('function f(){return 42 ** undefined;}', NaN)
+ self._test('function f(){return 42 ** null;}', 1)
+ self._test('function f(){return undefined ** 42;}', NaN)
+
def test_calc(self):
self._test('function f(a){return 2*a+1;}', 7, args=[3])