diff --git a/tests/kernelcreation/test_reduction.py b/tests/kernelcreation/test_reduction.py index c41d250f4d75e236dad9a6d6bd476045c2847ad0..b97343e720ee2d30f142c7640103bcc646e5fa10 100644 --- a/tests/kernelcreation/test_reduction.py +++ b/tests/kernelcreation/test_reduction.py @@ -5,6 +5,15 @@ import sympy as sp import pystencils as ps from pystencils.sympyextensions import reduced_assign +INIT=2 +SIZE=15 +SOLUTION = { + "+": INIT * SIZE, + "-": INIT * -SIZE, + "*": INIT**SIZE, + "min": INIT, + "max": INIT +} @pytest.mark.parametrize('dtype', ["float64"]) @pytest.mark.parametrize("op", ["+", "-", "*", "min", "max"]) @@ -24,6 +33,7 @@ def test_reduction(dtype, op): ps.show_code(ast_reduction) - array = np.ones((10,), dtype=dtype) - kernel_reduction(x=array, w=0) - # TODO: check if "w = #points" \ No newline at end of file + array = np.full((SIZE,), INIT, dtype=dtype) + reduction_array = np.zeros(1, dtype=dtype) + kernel_reduction(x=array, w=reduction_array) + assert np.allclose(reduction_array, SOLUTION[op]) \ No newline at end of file