summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjutke <jutke@allstate.com>2017-01-20 15:20:38 -0600
committerCharles Harris <charlesr.harris@gmail.com>2017-01-28 18:44:41 -0700
commitbb05f40302ba418b28e71b6538a649d27d937a3f (patch)
treed770d4a92e524c5bc9ff9fea81f546b3f44be6cc
parent70c82bf8fa5acd56022ff9c20ac19873ead9f80c (diff)
downloadnumpy-bb05f40302ba418b28e71b6538a649d27d937a3f.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
-rw-r--r--numpy/f2py/tests/src/parameter/constant_non_compound.f9023
-rw-r--r--numpy/f2py/tests/test_parameter.py8
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]