diff options
author | jutke <jutke@allstate.com> | 2017-01-20 15:20:38 -0600 |
---|---|---|
committer | jutke <jutke@allstate.com> | 2017-01-20 15:20:38 -0600 |
commit | 8610e48687e7a05e7e0e0735629e5cace69cb04f (patch) | |
tree | ec0d274aa7277d7f3b0a99ba7c790b998149c805 /numpy | |
parent | 1e873ead0c0857f0bbdaab36764afa67cc39479e (diff) | |
download | numpy-8610e48687e7a05e7e0e0735629e5cace69cb04f.tar.gz |
TST: adding test for constants without compound kind spec
This augments the test in constant_compound.f90 by
using constants without a compound kind spec to
illustrate the case that led to the
reporting of issue #8493
Diffstat (limited to 'numpy')
-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] |