Skip to content

Commit 40ba4a0

Browse files
committed
add test
1 parent 34e8aac commit 40ba4a0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/legacy_test/test_ldexp.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ def test_ldexp_dynamic(self):
130130
check_dtype(res, np.float32)
131131
np.testing.assert_allclose(res, np.ldexp(x, y))
132132

133+
# test 0-d
134+
dims = (np.random.randint(10),)
135+
x = (np.random.rand(*dims) * 10).astype(np.float64)
136+
y = (np.random.randint(-10, 10, dims)).astype(np.int32)
137+
res = _run_ldexp_dynamic(x, y, place)
138+
check_dtype(res, np.float64)
139+
np.testing.assert_allclose(res, np.ldexp(x, y))
140+
141+
dims = (np.random.randint(10),)
142+
x = (np.random.randint(-10, 10, dims)).astype(np.int32)
143+
y = (np.random.randint(-10, 10, dims)).astype(np.int32)
144+
res = _run_ldexp_dynamic(x, y, place)
145+
check_dtype(res, np.float32)
146+
np.testing.assert_allclose(res, np.ldexp(x, y))
147+
133148
# test broadcast
134149
dims = (
135150
np.random.randint(1, 10),

0 commit comments

Comments
 (0)