diff options
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r-- | numpy/f2py/tests/src/parameter/constant_non_compound.f90 | 23 | ||||
-rw-r--r-- | numpy/f2py/tests/test_parameter.py | 8 |
2 files changed, 31 insertions, 0 deletions
diff --git a/numpy/f2py/tests/src/parameter/constant_non_compound.f90 b/numpy/f2py/tests/src/parameter/constant_non_compound.f90 new file mode 100644 index 000000000..62c9a5b94 --- /dev/null +++ b/numpy/f2py/tests/src/parameter/constant_non_compound.f90 @@ -0,0 +1,23 @@ +! Check that parameters are correct intercepted. +! Specifically that types of constants without +! compound kind specs are correctly inferred +! adapted Gibbs iteration code from pymc +! for this test case +subroutine foo_non_compound_int(x) + implicit none + integer, parameter :: ii = selected_int_kind(9) + + integer(ii) maxiterates + parameter (maxiterates=2) + + integer(ii) maxseries + parameter (maxseries=2) + + integer(ii) wasize + parameter (wasize=maxiterates*maxseries) + integer(ii), intent(inout) :: x + dimension x(wasize) + + x(1) = x(1) + x(2) + x(3) + x(4) * wasize + return +end subroutine diff --git a/numpy/f2py/tests/test_parameter.py b/numpy/f2py/tests/test_parameter.py index e7c6add51..b6891756d 100644 --- a/numpy/f2py/tests/test_parameter.py +++ b/numpy/f2py/tests/test_parameter.py @@ -19,6 +19,7 @@ class TestParameters(util.F2PyTest): _path('src', 'parameter', 'constant_integer.f90'), _path('src', 'parameter', 'constant_both.f90'), _path('src', 'parameter', 'constant_compound.f90'), + _path('src', 'parameter', 'constant_non_compound.f90'), ] @dec.slow @@ -55,6 +56,13 @@ class TestParameters(util.F2PyTest): assert_equal(x, [0 + 1 + 2*6, 1, 2]) @dec.slow + def test_constant_non_compound_int(self): + # check values + x = np.arange(4, dtype=np.int32) + self.module.foo_non_compound_int(x) + assert_equal(x, [0 + 1 + 2 + 3*4, 1, 2, 3]) + + @dec.slow def test_constant_integer_int(self): # non-contiguous should raise error x = np.arange(6, dtype=np.int32)[::2] |