summaryrefslogtreecommitdiffstats
path: root/fortran/test/fortranlib_test.f90
blob: 07a17b00ba555dccd2f0f66e9c0ba09b48689085 (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
!
! 
!    Testing Fortran functionality.
!
     PROGRAM fortranlibtest

       USE HDF5

     IMPLICIT NONE
     INTEGER :: total_error = 0
     INTEGER :: error 
     INTEGER :: mounting_total_error = 0
     INTEGER :: reopen_total_error = 0
     INTEGER :: dataset_total_error = 0
     INTEGER :: extend_dataset_total_error = 0
     INTEGER :: refobj_total_error = 0
     INTEGER :: refreg_total_error = 0
     INTEGER :: dataspace_total_error = 0
     INTEGER :: hyperslab_total_error = 0
     INTEGER :: element_total_error = 0
     INTEGER :: basic_select_total_error = 0
     INTEGER :: total_error_compoundtest = 0
     INTEGER :: basic_datatype_total_error = 0
     INTEGER :: external_total_error = 0
     INTEGER :: attribute_total_error = 0
     INTEGER :: identifier_total_error = 0
     INTEGER :: group_total_error = 0
     CHARACTER*8 error_string
     CHARACTER*8 :: success = ' PASSED '
     CHARACTER*8 :: failure = '*FAILED*'
     CHARACTER*4 :: e_format ='(8a)'

     CALL h5open_f(error) 
     write(*,*) '                       ==========================                            '
     write(*,*) '                              FORTRAN tests '
     write(*,*) '                       ==========================                            '
!     write(*,*) '========================================='
!     write(*,*) 'Testing FILE Interface                   '
!     write(*,*) '========================================='

     error_string = failure
     CALL mountingtest(mounting_total_error)
     IF (mounting_total_error == 0) error_string = success
     write(*, fmt = '(14a)', advance = 'no') ' Mounting test'     
     write(*, fmt = '(56x,a)', advance = 'no') ' ' 

     write(*, fmt = e_format) error_string 
     total_error = total_error + mounting_total_error 

     error_string = failure
     CALL reopentest(reopen_total_error)
     IF (reopen_total_error == 0) error_string = success
     write(*, fmt = '(12a)', advance = 'no') ' Reopen test'     
     write(*, fmt = '(58x,a)', advance = 'no') ' ' 
     write(*, fmt = e_format) error_string
     total_error = total_error + reopen_total_error 


!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing DATASET Interface                '
!     write(*,*) '========================================='

     error_string = failure
     CALL datasettest(dataset_total_error)
     IF (dataset_total_error == 0) error_string = success
     write(*, fmt = '(13a)', advance = 'no') ' Dataset test'     
     write(*, fmt = '(57x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + dataset_total_error 

     error_string = failure
     CALL extenddsettest(extend_dataset_total_error)
     IF (extend_dataset_total_error == 0)  error_string = success
     write(*, fmt = '(24a)', advance = 'no') ' Extendible dataset test'     
     write(*, fmt = '(46x,a)', advance = 'no') ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + extend_dataset_total_error 

!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing DATASPACE Interface             '
!     write(*,*) '========================================='

     error_string = failure
     CALL dataspace_basic_test(dataspace_total_error)
     IF (dataspace_total_error == 0) error_string = success
     write(*, fmt = '(21a)', advance = 'no') ' Basic dataspace test'     
     write(*, fmt = '(49x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + dataspace_total_error 


!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing REFERENCE Interface              '
!     write(*,*) '========================================='

     error_string = failure
     CALL refobjtest(refobj_total_error)
     IF (refobj_total_error == 0) error_string = success
     write(*, fmt = '(25a)', advance = 'no') ' Reference to object test'     
     write(*, fmt = '(45x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + refobj_total_error 

     error_string = failure
     CALL refregtest(refreg_total_error)
     IF (refreg_total_error == 0) error_string = success
     write(*, fmt = '(33a)', advance = 'no') ' Reference to dataset region test'     
     write(*, fmt = '(37x,a)', advance = 'no')  ' ' 
     write(*, fmt = e_format) error_string
     total_error = total_error + refreg_total_error 

!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing selection functionalities        '
!     write(*,*) '========================================='

     error_string = failure
     CALL test_basic_select(basic_select_total_error)
     IF (basic_select_total_error == 0) error_string = success
     write(*, fmt = '(21a)', advance = 'no') ' Basic selection test'     
     write(*, fmt = '(49x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + basic_select_total_error 

     error_string = failure
     CALL  test_select_hyperslab( hyperslab_total_error)
     IF ( hyperslab_total_error == 0) error_string = success
     write(*, fmt = '(25a)', advance = 'no') ' Hyperslab selection test'     
     write(*, fmt = '(45x,a)', advance = 'no')  ' ' 
     write(*, fmt = e_format) error_string
     total_error = total_error + hyperslab_total_error 

     error_string = failure
     CALL test_select_element(element_total_error)
     IF (element_total_error == 0) error_string = success
     write(*, fmt = '(23a)', advance = 'no') ' Element selection test'     
     write(*, fmt = '(47x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + element_total_error 


!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing DATATYPE interface               '
!     write(*,*) '========================================='

     error_string = failure
     CALL basic_data_type_test(basic_datatype_total_error)
     IF (basic_datatype_total_error == 0) error_string = success
     write(*, fmt = '(20a)', advance = 'no') ' Basic datatype test'     
     write(*, fmt = '(50x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + basic_datatype_total_error 

     error_string = failure
     CALL compoundtest(total_error_compoundtest)
     IF (total_error_compoundtest == 0) error_string = success
     write(*, fmt = '(23a)', advance = 'no') ' Compound datatype test'     
     write(*, fmt = '(47x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + total_error_compoundtest

!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing PROPERTY interface               ' 
!     write(*,*) '========================================='

     error_string = failure
     CALL external_test(external_total_error)
     IF (external_total_error == 0) error_string = success
     write(*, fmt = '(22a)', advance = 'no') ' External dataset test'     
     write(*, fmt = '(48x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + external_total_error 
    
!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing ATTRIBUTE interface              ' 
!     write(*,*) '========================================='

     error_string = failure
     CALL attribute_test(attribute_total_error)
     write(*, fmt = '(15a)', advance = 'no') ' Attribute test'     
     write(*, fmt = '(55x,a)', advance = 'no')  ' '
     IF (attribute_total_error == 0) error_string = success
     write(*, fmt = e_format) error_string
     total_error = total_error + attribute_total_error 

!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing IDENTIFIER interface             '
!     write(*,*) '========================================='

     error_string = failure
     CALL identifier_test(identifier_total_error)
     IF (identifier_total_error == 0) error_string = success
     write(*, fmt = '(16a)', advance = 'no') ' Identifier test'     
     write(*, fmt = '(54x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + identifier_total_error 

!     write(*,*)
!     write(*,*) '========================================='
!     write(*,*) 'Testing GROUP interface             '
!     write(*,*) '========================================='

     error_string = failure
     CALL group_test(group_total_error)
     IF (group_total_error == 0) error_string = success
     write(*, fmt = '(11a)', advance = 'no') ' Group test'     
     write(*, fmt = '(59x,a)', advance = 'no')  ' '
     write(*, fmt = e_format) error_string
     total_error = total_error + identifier_total_error 

     write(*,*)

     write(*,*) '                  ============================================  '
     write(*, fmt = '(19x, 27a)', advance='NO') ' FORTRAN tests completed with '
     write(*, fmt = '(i4)', advance='NO') total_error
     write(*, fmt = '(12a)' ) ' error(s) ! '
     write(*,*) '                  ============================================  '

     CALL h5close_f(error)

    END PROGRAM fortranlibtest