forked from nbren12/call_py_fort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_call_py_fort.pfunit
159 lines (112 loc) · 2.52 KB
/
test_call_py_fort.pfunit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
module test_call_py_fort
use funit
use callpy_mod
contains
@test
subroutine test_bar()
@assertTrue(.true.)
end subroutine
@test
subroutine testHelloWorld()
use funit
implicit none
@assertEqual("Hello World!","Hello World!")
end subroutine testHelloWorld
@test
subroutine test1d()
use funit
use iso_c_binding
implicit none
integer i
real :: a(10)
real :: tmp(10)
call random_number(a)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test1d
@test
subroutine test1d_integer()
use funit
use iso_c_binding
implicit none
integer i
integer :: a(10)
integer :: tmp(10)
a = (/(i,i=1,10)/)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test1d_integer
@test
subroutine test2d()
use funit
use iso_c_binding
implicit none
integer i, j
real :: a(10, 5)
real :: tmp(10, 5)
call random_number(a)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test2d
@test
subroutine test3d_double()
use funit
use iso_c_binding
implicit none
integer i, j, k
real(8) :: a(10, 5, 3)
real(8) :: tmp(10, 5, 3)
call random_number(a)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test3d_double
@test
subroutine test2d_double()
use funit
use iso_c_binding
implicit none
integer i, j, k
real(8) :: a(10, 5)
real(8) :: tmp(10, 5)
call random_number(a)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test2d_double
@test
subroutine test3d()
use funit
use iso_c_binding
implicit none
integer i, j, k
real :: a(10, 5, 3)
real :: tmp(10, 5, 3)
call random_number(a)
call set_state("a", a)
call get_state("a", tmp)
@assertEqual(a, tmp)
end subroutine test3d
@test
subroutine test_set_state_char()
use funit
use iso_c_binding
implicit none
integer i, j, k
character(len=256) :: a, b
a = "hello"
call set_state("a", a)
call get_state("a", b)
@assertEqual(a, b)
end subroutine test_set_state_char
@test
subroutine test_call_fun
use funit
use iso_c_binding
implicit none
call call_function('test', 'test_function')
end subroutine test_call_fun
end module