Skip to content

Commit ed8e0fd

Browse files
committed
add test function to check empty list for boundaries
1 parent e3c37a3 commit ed8e0fd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_sdp.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,25 @@ def test_pyfftw_sdp_update_arrays():
265265
# Check that the same FFTW objects are reused
266266
assert sliding_dot_product.rfft_objects[key1] is rfft_obj_before
267267
assert sliding_dot_product.irfft_objects[key1] is irfft_obj_before
268+
269+
return
270+
271+
272+
def test_sdp_empty_boundaries():
273+
# This is to test sdp._sliding_dot_product
274+
# when the `boundaries` parameter is set to
275+
# an empty list
276+
pmin = 3
277+
pmax = 13
278+
for q in range(pmin, pmax + 1):
279+
n_Q = 2**q
280+
for p in range(q, pmax + 1):
281+
n_T = 2**p
282+
Q = np.random.rand(n_Q)
283+
T = np.random.rand(n_T)
284+
285+
ref = naive_sliding_dot_product(Q, T)
286+
comp = sdp._sliding_dot_product(Q, T, boundaries=[])
287+
npt.assert_allclose(comp, ref)
288+
289+
return

0 commit comments

Comments
 (0)