Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6208252

Browse files
zoghbi-acharris
authored andcommitted
TST: tests for modules with derived types
1 parentf75f717 commit6208252

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module mtypes
2+
implicit none
3+
integer,parameter:: value1=100
4+
type:: master_data
5+
integer:: idat=200
6+
end type master_data
7+
type(master_data):: masterdata
8+
end module mtypes
9+
10+
11+
subroutineno_type_subroutine(ain,aout)
12+
use mtypes, only: value1
13+
integer,intent(in):: ain
14+
integer,intent(out):: aout
15+
aout= ain+ value1
16+
endsubroutine no_type_subroutine
17+
18+
subroutinetype_subroutine(ain,aout)
19+
use mtypes, only: masterdata
20+
integer,intent(in):: ain
21+
integer,intent(out):: aout
22+
aout= ain+ masterdata%idat
23+
endsubroutine type_subroutine

‎numpy/f2py/tests/test_regression.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ def test_mdat(self):
3737
assertself.module.simple_subroutine(5)==1014
3838

3939

40+
classTestModuleWithDerivedType(util.F2PyTest):
41+
# Check that modules with derived types work
42+
sources= [util.getpath("tests","src","regression","mod_derived_types.f90")]
43+
44+
@pytest.mark.slow
45+
deftest_mtypes(self):
46+
assertself.module.no_type_subroutine(10)==110
47+
assertself.module.type_subroutine(10)==210
48+
49+
4050
classTestNegativeBounds(util.F2PyTest):
4151
# Check that negative bounds work correctly
4252
sources= [util.getpath("tests","src","negative_bounds","issue_20853.f90")]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp