diff options
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r-- | numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap | 1 | ||||
-rw-r--r-- | numpy/f2py/tests/src/assumed_shape/foo_use.f90 | 19 | ||||
-rw-r--r-- | numpy/f2py/tests/src/assumed_shape/precision.f90 | 4 | ||||
-rw-r--r-- | numpy/f2py/tests/test_assumed_shape.py | 10 | ||||
-rw-r--r-- | numpy/f2py/tests/util.py | 6 |
5 files changed, 38 insertions, 2 deletions
diff --git a/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap b/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap new file mode 100644 index 000000000..2665f89b5 --- /dev/null +++ b/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap @@ -0,0 +1 @@ +dict(real=dict(rk="double")) diff --git a/numpy/f2py/tests/src/assumed_shape/foo_use.f90 b/numpy/f2py/tests/src/assumed_shape/foo_use.f90 new file mode 100644 index 000000000..337465ac5 --- /dev/null +++ b/numpy/f2py/tests/src/assumed_shape/foo_use.f90 @@ -0,0 +1,19 @@ +subroutine sum_with_use(x, res) + use precision + + implicit none + + real(kind=rk), intent(in) :: x(:) + real(kind=rk), intent(out) :: res + + integer :: i + + !print *, "size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + + end subroutine diff --git a/numpy/f2py/tests/src/assumed_shape/precision.f90 b/numpy/f2py/tests/src/assumed_shape/precision.f90 new file mode 100644 index 000000000..ed6c70cbb --- /dev/null +++ b/numpy/f2py/tests/src/assumed_shape/precision.f90 @@ -0,0 +1,4 @@ +module precision + integer, parameter :: rk = selected_real_kind(8) + integer, parameter :: ik = selected_real_kind(4) +end module diff --git a/numpy/f2py/tests/test_assumed_shape.py b/numpy/f2py/tests/test_assumed_shape.py index 6a562ebdc..3e5502cb0 100644 --- a/numpy/f2py/tests/test_assumed_shape.py +++ b/numpy/f2py/tests/test_assumed_shape.py @@ -9,8 +9,11 @@ import util def _path(*a): return os.path.join(*((os.path.dirname(__file__),) + a)) -class TestMixed(util.F2PyTest): - sources = [_path('src', 'assumed_shape', 'foo_free.f90')] +class TestAssumedShapeSumExample(util.F2PyTest): + sources = [_path('src', 'assumed_shape', 'foo_free.f90'), + _path('src', 'assumed_shape', 'foo_use.f90'), + _path('src', 'assumed_shape', 'precision.f90'), + ] @dec.slow def test_all(self): @@ -20,6 +23,9 @@ class TestMixed(util.F2PyTest): r = self.module.sum([1,2]) assert r==3,`r` + r = self.module.sum_with_use([1,2]) + assert r==3,`r` + if __name__ == "__main__": import nose nose.runmodule() diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py index 422d5965e..a5816b96f 100644 --- a/numpy/f2py/tests/util.py +++ b/numpy/f2py/tests/util.py @@ -106,6 +106,12 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None): shutil.copyfile(fn, dst) dst_sources.append(dst) + fn = os.path.join(os.path.dirname(fn), '.f2py_f2cmap') + if os.path.isfile(fn): + dst = os.path.join(d, os.path.basename(fn)) + if not os.path.isfile(dst): + shutil.copyfile(fn, dst) + # Prepare options if module_name is None: module_name = get_temp_module_name() |