test 2D arrays and read-only file opening
This commit is contained in:
parent
d1432e5bd8
commit
3c62af3fe5
|
@ -20,17 +20,37 @@ end subroutine test_HDF5_utilities_run
|
||||||
subroutine read_write()
|
subroutine read_write()
|
||||||
|
|
||||||
integer(HID_T) :: f
|
integer(HID_T) :: f
|
||||||
real(pREAL), dimension(3) :: d_in,d_out
|
real(pREAL), dimension(3) :: d1_in,d1_out
|
||||||
|
real(pREAL), dimension(3,3) :: d2_in,d2_out
|
||||||
|
|
||||||
|
|
||||||
call random_number(d_in)
|
call random_number(d1_in)
|
||||||
|
call random_number(d2_in)
|
||||||
|
|
||||||
f = HDF5_openFile('test.hdf5','w')
|
f = HDF5_openFile('test.hdf5','w')
|
||||||
|
|
||||||
call HDF5_write(d_in,f,'test')
|
call HDF5_write(d1_in,f,'d1')
|
||||||
call HDF5_read(d_out,f,'test')
|
call HDF5_write(d2_in,f,'d2')
|
||||||
|
|
||||||
|
call HDF5_read(d1_out,f,'d1')
|
||||||
|
call HDF5_read(d2_out,f,'d2')
|
||||||
|
|
||||||
|
if (any(d1_in /= d1_out)) error stop 'test_read_write(w)/d1'
|
||||||
|
if (any(d2_in /= d2_out)) error stop 'test_read_write(w)/d2'
|
||||||
|
|
||||||
|
call HDF5_closeFile(f)
|
||||||
|
|
||||||
|
|
||||||
|
f = HDF5_openFile('test.hdf5','r')
|
||||||
|
|
||||||
|
call HDF5_read(d1_out,f,'d1')
|
||||||
|
call HDF5_read(d2_out,f,'d2')
|
||||||
|
|
||||||
|
if (any(d1_in /= d1_out)) error stop 'test_read_write(r)/d1'
|
||||||
|
if (any(d2_in /= d2_out)) error stop 'test_read_write(r)/d2'
|
||||||
|
|
||||||
|
call HDF5_closeFile(f)
|
||||||
|
|
||||||
if (any(d_in /= d_out)) error stop 'test_read_write'
|
|
||||||
|
|
||||||
end subroutine read_write
|
end subroutine read_write
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue