diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2011-02-27 17:06:26 +0200 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2011-02-27 17:06:26 +0200 |
commit | aea92de6e7322d5cc1674bf13e74498f310733e9 (patch) | |
tree | 85ccb021c32142a48bde75c5cc8e3a1e1f4dc83f /numpy/f2py/tests | |
parent | 715b9c74f86cfeceb94cdd77b3080afa88e10688 (diff) | |
download | numpy-aea92de6e7322d5cc1674bf13e74498f310733e9.tar.gz |
Implemented selected_real_kind evaluation, added tests to catch processor dependencies..
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r-- | numpy/f2py/tests/src/kind/foo.f90 | 20 | ||||
-rw-r--r-- | numpy/f2py/tests/test_kind.py | 34 |
2 files changed, 54 insertions, 0 deletions
diff --git a/numpy/f2py/tests/src/kind/foo.f90 b/numpy/f2py/tests/src/kind/foo.f90 new file mode 100644 index 000000000..d3d15cfb2 --- /dev/null +++ b/numpy/f2py/tests/src/kind/foo.f90 @@ -0,0 +1,20 @@ + + +subroutine selectedrealkind(p, r, res) + implicit none + + integer, intent(in) :: p, r + !f2py integer :: r=0 + integer, intent(out) :: res + res = selected_real_kind(p, r) + +end subroutine + +subroutine selectedintkind(p, res) + implicit none + + integer, intent(in) :: p + integer, intent(out) :: res + res = selected_int_kind(p) + +end subroutine diff --git a/numpy/f2py/tests/test_kind.py b/numpy/f2py/tests/test_kind.py new file mode 100644 index 000000000..1396ac3a1 --- /dev/null +++ b/numpy/f2py/tests/test_kind.py @@ -0,0 +1,34 @@ +import os +import math + +from numpy.testing import * +from numpy import array + +import util + +def _path(*a): + return os.path.join(*((os.path.dirname(__file__),) + a)) + +from numpy.f2py.crackfortran import _selected_int_kind_func as selected_int_kind +from numpy.f2py.crackfortran import _selected_real_kind_func as selected_real_kind + +class TestKind(util.F2PyTest): + sources = [_path('src', 'kind', 'foo.f90'), + ] + + @dec.slow + def test_all(self): + print self.module.__doc__ + + selectedrealkind = self.module.selectedrealkind + selectedintkind = self.module.selectedintkind + + for i in range(40): + assert selected_int_kind(i)==selectedintkind(i),`i, selected_int_kind(i), selectedintkind(i)` + + for i in range(20): + assert selected_real_kind(i)==selectedrealkind(i),`i, selected_real_kind(i), selectedrealkind(i)` + +if __name__ == "__main__": + import nose + nose.runmodule() |