summaryrefslogtreecommitdiffstats
path: root/fortran/test/fortranlib_test.F90
blob: d7fca7dbb7cdc13879bea8599e6ef60b91dea010 (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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
!****h* root/fortran/test/fortranlib_test.f90
!
! NAME
!  fortranlib_test.f90
!
! FUNCTION
!  Basic testing of Fortran API's functionality.
!
! COPYRIGHT
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!   Copyright by The HDF Group.                                               *
!   All rights reserved.                                                      *
!                                                                             *
!   This file is part of HDF5.  The full HDF5 copyright notice, including     *
!   terms governing use, modification, and redistribution, is contained in    *
!   the COPYING file, which can be found at the root of the source code       *
!   distribution tree, or in https://www.hdfgroup.org/licenses.               *
!   If you do not have access to either file, you may request a copy from     *
!   help@hdfgroup.org.                                                        *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
!*****

!#include <H5config_f.inc>

PROGRAM fortranlibtest

  USE HDF5
  USE THDF5

  IMPLICIT NONE
  INTEGER :: total_error = 0
  INTEGER :: error
  INTEGER :: majnum, minnum, relnum
  LOGICAL :: szip_flag
  INTEGER :: ret_total_error
  LOGICAL :: cleanup, status

  WRITE(*,*) '                       ==========================                            '
  WRITE(*,*) '                              FORTRAN tests '
  WRITE(*,*) '                       ==========================                            '

  ret_total_error = 0
  CALL h5openclose(ret_total_error)
  CALL write_test_status(ret_total_error, ' h5open/h5close test', total_error)

  CALL h5open_f(error)
  CALL check("h5open_f",error,total_error)

  cleanup = .TRUE.
  CALL h5_env_nocleanup_f(status)
  IF(status) cleanup=.FALSE.


  ret_total_error = 0
  CALL h5get_libversion_f(majnum, minnum, relnum, ret_total_error)
  IF(ret_total_error .EQ. 0) THEN

     WRITE(*, '(/," FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO")
     WRITE(*, '(I0)', advance="NO") majnum
     WRITE(*, '(".")', advance="NO")
     WRITE(*, '(I0)', advance="NO") minnum
     WRITE(*, '(" release ")', advance="NO")
     WRITE(*, '(I0)') relnum
  ELSE
     total_error = total_error + 1
  ENDIF
  WRITE(*,*)

!      CALL h5check_version_f(1,4,4,total_error)
!      '========================================='
!      'Testing FILE Interface                   '
!      '========================================='

  ret_total_error = 0
  CALL mountingtest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Mounting test', total_error)

  ret_total_error = 0
  CALL reopentest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Reopen test', total_error)

  ret_total_error = 0
  CALL get_name_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Get name test', total_error)

  ret_total_error = 0
  CALL file_close(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' File open/close test', total_error)

  ret_total_error = 0
  CALL file_space("file_space",cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' File free space test', total_error)

!
!      '========================================='
!      'Testing DATASET Interface                '
!      '========================================='

  ret_total_error = 0
  CALL datasettest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Dataset test', total_error)

  ret_total_error = 0
  CALL extenddsettest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Extendible dataset test', total_error)

  ret_total_error = 0
  CALL test_userblock_offset(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Dataset offset with user block', total_error)

  ! Test filling dataspace elements
  ret_total_error = 0
  CALL test_dset_fill(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Filling dataspace elements', total_error)

!
!      '========================================='
!      'Testing DATASPACE Interface             '
!      '========================================='

  ret_total_error = 0
  CALL dataspace_basic_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Basic dataspace test', total_error)

!
!      '========================================='
!      'Testing REFERENCE Interface              '
!      '========================================='

  ret_total_error = 0
  CALL refobjtest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Reference to object test', total_error)

  ret_total_error = 0
  CALL refregtest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Reference to dataset region test', total_error)

!
!      '========================================='
!      'Testing selection functionalities        '
!      '========================================='

  ret_total_error = 0
  CALL test_basic_select(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Basic selection test', total_error)


  ret_total_error = 0
  CALL test_select_hyperslab( cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Hyperslab selection test', total_error)

  ret_total_error = 0
  CALL test_select_element(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Element selection test', total_error)

  ret_total_error = 0
  CALL test_select_point(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Element selection functions test ', total_error)

  ret_total_error = 0
  CALL test_select_combine(ret_total_error)
  CALL write_test_status(ret_total_error, ' Selection combinations test ', total_error)

  ret_total_error = 0
  CALL test_select_bounds(ret_total_error)
  CALL write_test_status(ret_total_error, ' Selection bounds test ', total_error)

!
!      '========================================='
!      'Testing DATATYPE interface               '
!      '========================================='
  ret_total_error = 0
  CALL basic_data_type_test(ret_total_error)
  CALL write_test_status(ret_total_error, ' Basic datatype test', total_error)

  ret_total_error = 0
  CALL compoundtest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Compound datatype test', total_error)

  ret_total_error = 0
  CALL enumtest(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Enum datatype test', total_error)

  ret_total_error = 0
  CALL test_derived_flt(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Derived float datatype test', total_error)

!
!      '========================================='
!      'Testing PROPERTY interface               '
!      '========================================='

  ret_total_error = 0
  CALL external_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' External dataset test', total_error)

  ret_total_error = 0
  CALL multi_file_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Multi file driver test', total_error)

  ret_total_error = 0
  CALL test_chunk_cache(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Dataset chunk cache configuration', total_error)

  ret_total_error = 0
  CALL test_misc_properties(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Miscellaneous properties', total_error)

!
!      '========================================='
!      'Testing ATTRIBUTE interface              '
!      '========================================='

  ret_total_error = 0
  CALL attribute_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Attribute test', total_error)

!
!      '========================================='
!      'Testing IDENTIFIER interface             '
!      '========================================='

  ret_total_error = 0
  CALL identifier_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Identifier test', total_error)

  ret_total_error = 0
  CALL filters_test(ret_total_error)
  CALL write_test_status(ret_total_error, ' Filters test', total_error)

  ret_total_error = 0
  CALL szip_test(szip_flag, cleanup, ret_total_error)

  IF (.NOT. szip_flag) THEN ! test not available
     CALL write_test_status(-1, ' SZIP filter test', total_error)
  ELSE
     CALL write_test_status(ret_total_error, ' SZIP filter test', total_error)
  ENDIF

!
!      '========================================='
!      'Testing GROUP interface                  '
!      '========================================='

  ret_total_error = 0
  CALL group_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Group test', total_error)

  ret_total_error = 0
  CALL error_report_test(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' Error test', total_error)

  ret_total_error = 0
  CALL vl_test_integer(cleanup, ret_total_error)
  CALL vl_test_real(cleanup, ret_total_error)
  CALL vl_test_string(cleanup, ret_total_error)
  CALL write_test_status(ret_total_error, ' VL test', 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)

  ! if errors detected, exit with non-zero code.
  IF (total_error .NE. 0) CALL h5_exit_f (1)

END PROGRAM fortranlibtest