From d8a64f25b80b1a3de9d2c55ff7177dece271e8e3 Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Mon, 10 Jan 2022 09:50:49 +0100 Subject: [PATCH] chore: fix test for matmul correctness - bit-width could get too high, rename input_range to be clearer on bounds - fix bounds that seemed to want to use a set number of bits but being off by one (e.g. 4 -> 3 as 0-3 is the range for a 2 bits integer) closes #1352 --- tests/numpy/test_compile.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/numpy/test_compile.py b/tests/numpy/test_compile.py index 2016163be..420dc72c8 100644 --- a/tests/numpy/test_compile.py +++ b/tests/numpy/test_compile.py @@ -1329,42 +1329,42 @@ def test_compile_and_run_constant_dot_correctness( @pytest.mark.parametrize( - "lhs_shape,rhs_shape,input_range", + "lhs_shape,rhs_shape,input_range_inclusive_bound", [ pytest.param( (3, 2), (2, 3), - (0, 4), + (0, 3), ), pytest.param( (1, 2), (2, 1), - (0, 4), + (0, 3), ), pytest.param( (3, 3), (3, 3), - (0, 4), + (0, 3), ), pytest.param( (2, 1), (1, 2), - (0, 8), + (0, 7), ), pytest.param( (2,), (2,), - (0, 8), + (0, 7), ), pytest.param( (5, 5), (5,), - (0, 4), + (0, 3), ), pytest.param( (5,), (5, 5), - (0, 4), + (0, 3), ), pytest.param( (3, 2), @@ -1374,21 +1374,25 @@ def test_compile_and_run_constant_dot_correctness( pytest.param( (5,), (5, 3), - (0, 4), + (0, 3), ), pytest.param( (5, 3), (3,), - (0, 4), + (0, 3), ), ], ) def test_compile_and_run_matmul_correctness( - lhs_shape, rhs_shape, input_range, default_compilation_configuration, check_array_equality + lhs_shape, + rhs_shape, + input_range_inclusive_bound, + default_compilation_configuration, + check_array_equality, ): """Test correctness of results when running a compiled function""" - low, high = input_range + low, high = input_range_inclusive_bound check_mod = low < 0 or high < 0