systematic testing of read/write
This commit is contained in:
parent
8bc5b30e54
commit
246e708e5b
|
@ -20,55 +20,105 @@ end subroutine test_HDF5_utilities_run
|
||||||
subroutine read_write()
|
subroutine read_write()
|
||||||
|
|
||||||
integer(HID_T) :: f
|
integer(HID_T) :: f
|
||||||
real(pREAL), dimension(3) :: d1_in,d1_out
|
|
||||||
real(pREAL), dimension(3,3) :: d2_in,d2_out
|
real(pREAL), dimension(3) :: real_d1_in,real_d1_out
|
||||||
real(pREAL), dimension(3,3,3) :: d3_in,d3_out
|
real(pREAL), dimension(3,3) :: real_d2_in,real_d2_out
|
||||||
real(pREAL), dimension(3,3,3,3) :: d4_in,d4_out
|
real(pREAL), dimension(3,3,3) :: real_d3_in,real_d3_out
|
||||||
real(pREAL), dimension(3,3,3,3,3) :: d5_in,d5_out
|
real(pREAL), dimension(3,3,3,3) :: real_d4_in,real_d4_out
|
||||||
|
real(pREAL), dimension(3,3,3,3,3) :: real_d5_in,real_d5_out
|
||||||
|
|
||||||
|
integer, dimension(3) :: int_d1_in,int_d1_out
|
||||||
|
integer, dimension(3,3) :: int_d2_in,int_d2_out
|
||||||
|
integer, dimension(3,3,3) :: int_d3_in,int_d3_out
|
||||||
|
integer, dimension(3,3,3,3) :: int_d4_in,int_d4_out
|
||||||
|
integer, dimension(3,3,3,3,3) :: int_d5_in,int_d5_out
|
||||||
|
|
||||||
|
|
||||||
call random_number(d1_in)
|
call random_number(real_d1_in)
|
||||||
call random_number(d2_in)
|
call random_number(real_d2_in)
|
||||||
call random_number(d3_in)
|
call random_number(real_d3_in)
|
||||||
call random_number(d4_in)
|
call random_number(real_d4_in)
|
||||||
call random_number(d5_in)
|
call random_number(real_d5_in)
|
||||||
|
|
||||||
|
int_d1_in = int(real_d1_in*2048._pREAL)
|
||||||
|
int_d2_in = int(real_d2_in*2048._pREAL)
|
||||||
|
int_d3_in = int(real_d3_in*2048._pREAL)
|
||||||
|
int_d4_in = int(real_d4_in*2048._pREAL)
|
||||||
|
int_d5_in = int(real_d5_in*2048._pREAL)
|
||||||
|
|
||||||
|
|
||||||
f = HDF5_openFile('test.hdf5','w')
|
f = HDF5_openFile('test.hdf5','w')
|
||||||
|
|
||||||
call HDF5_write(d1_in,f,'d1')
|
|
||||||
call HDF5_write(d2_in,f,'d2')
|
|
||||||
call HDF5_write(d3_in,f,'d3')
|
|
||||||
call HDF5_write(d4_in,f,'d4')
|
|
||||||
call HDF5_write(d5_in,f,'d5')
|
|
||||||
|
|
||||||
call HDF5_read(d1_out,f,'d1')
|
call HDF5_write(real_d1_in,f,'real_d1')
|
||||||
call HDF5_read(d2_out,f,'d2')
|
call HDF5_write(real_d2_in,f,'real_d2')
|
||||||
call HDF5_read(d3_out,f,'d3')
|
call HDF5_write(real_d3_in,f,'real_d3')
|
||||||
call HDF5_read(d4_out,f,'d4')
|
call HDF5_write(real_d4_in,f,'real_d4')
|
||||||
call HDF5_read(d5_out,f,'d5')
|
call HDF5_write(real_d5_in,f,'real_d5')
|
||||||
|
|
||||||
|
call HDF5_write(int_d1_in,f,'int_d1')
|
||||||
|
call HDF5_write(int_d2_in,f,'int_d2')
|
||||||
|
call HDF5_write(int_d3_in,f,'int_d3')
|
||||||
|
call HDF5_write(int_d4_in,f,'int_d4')
|
||||||
|
call HDF5_write(int_d5_in,f,'int_d5')
|
||||||
|
|
||||||
|
|
||||||
|
call HDF5_read(real_d1_out,f,'real_d1')
|
||||||
|
call HDF5_read(real_d2_out,f,'real_d2')
|
||||||
|
call HDF5_read(real_d3_out,f,'real_d3')
|
||||||
|
call HDF5_read(real_d4_out,f,'real_d4')
|
||||||
|
call HDF5_read(real_d5_out,f,'real_d5')
|
||||||
|
|
||||||
|
call HDF5_read(int_d1_out,f,'int_d1')
|
||||||
|
call HDF5_read(int_d2_out,f,'int_d2')
|
||||||
|
call HDF5_read(int_d3_out,f,'int_d3')
|
||||||
|
call HDF5_read(int_d4_out,f,'int_d4')
|
||||||
|
call HDF5_read(int_d5_out,f,'int_d5')
|
||||||
|
|
||||||
|
|
||||||
|
if (any(real_d1_in /= real_d1_out)) error stop 'test_read_write(w)/real_d1'
|
||||||
|
if (any(real_d2_in /= real_d2_out)) error stop 'test_read_write(w)/real_d2'
|
||||||
|
if (any(real_d3_in /= real_d3_out)) error stop 'test_read_write(w)/real_d3'
|
||||||
|
if (any(real_d4_in /= real_d4_out)) error stop 'test_read_write(w)/real_d4'
|
||||||
|
if (any(real_d5_in /= real_d5_out)) error stop 'test_read_write(w)/real_d5'
|
||||||
|
|
||||||
|
if (any(int_d1_in /= int_d1_out)) error stop 'test_read_write(w)/int_d1'
|
||||||
|
if (any(int_d2_in /= int_d2_out)) error stop 'test_read_write(w)/int_d2'
|
||||||
|
if (any(int_d3_in /= int_d3_out)) error stop 'test_read_write(w)/int_d3'
|
||||||
|
if (any(int_d4_in /= int_d4_out)) error stop 'test_read_write(w)/int_d4'
|
||||||
|
if (any(int_d5_in /= int_d5_out)) error stop 'test_read_write(w)/int_d5'
|
||||||
|
|
||||||
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'
|
|
||||||
if (any(d3_in /= d3_out)) error stop 'test_read_write(w)/d3'
|
|
||||||
if (any(d4_in /= d4_out)) error stop 'test_read_write(w)/d4'
|
|
||||||
if (any(d5_in /= d5_out)) error stop 'test_read_write(w)/d5'
|
|
||||||
|
|
||||||
call HDF5_closeFile(f)
|
call HDF5_closeFile(f)
|
||||||
|
|
||||||
|
|
||||||
f = HDF5_openFile('test.hdf5','r')
|
f = HDF5_openFile('test.hdf5','r')
|
||||||
|
|
||||||
call HDF5_read(d1_out,f,'d1')
|
|
||||||
call HDF5_read(d2_out,f,'d2')
|
|
||||||
call HDF5_read(d3_out,f,'d3')
|
|
||||||
call HDF5_read(d4_out,f,'d4')
|
|
||||||
call HDF5_read(d5_out,f,'d5')
|
|
||||||
|
|
||||||
if (any(d1_in /= d1_out)) error stop 'test_read_write(r)/d1'
|
call HDF5_read(real_d1_out,f,'real_d1')
|
||||||
if (any(d2_in /= d2_out)) error stop 'test_read_write(r)/d2'
|
call HDF5_read(real_d2_out,f,'real_d2')
|
||||||
if (any(d3_in /= d3_out)) error stop 'test_read_write(r)/d3'
|
call HDF5_read(real_d3_out,f,'real_d3')
|
||||||
if (any(d4_in /= d4_out)) error stop 'test_read_write(r)/d4'
|
call HDF5_read(real_d4_out,f,'real_d4')
|
||||||
if (any(d5_in /= d5_out)) error stop 'test_read_write(r)/d5'
|
call HDF5_read(real_d5_out,f,'real_d5')
|
||||||
|
|
||||||
|
call HDF5_read(int_d1_out,f,'int_d1')
|
||||||
|
call HDF5_read(int_d2_out,f,'int_d2')
|
||||||
|
call HDF5_read(int_d3_out,f,'int_d3')
|
||||||
|
call HDF5_read(int_d4_out,f,'int_d4')
|
||||||
|
call HDF5_read(int_d5_out,f,'int_d5')
|
||||||
|
|
||||||
|
|
||||||
|
if (any(real_d1_in /= real_d1_out)) error stop 'test_read_write(r)/real_d1'
|
||||||
|
if (any(real_d2_in /= real_d2_out)) error stop 'test_read_write(r)/real_d2'
|
||||||
|
if (any(real_d3_in /= real_d3_out)) error stop 'test_read_write(r)/real_d3'
|
||||||
|
if (any(real_d4_in /= real_d4_out)) error stop 'test_read_write(r)/real_d4'
|
||||||
|
if (any(real_d5_in /= real_d5_out)) error stop 'test_read_write(r)/real_d5'
|
||||||
|
|
||||||
|
if (any(int_d1_in /= int_d1_out)) error stop 'test_read_write(r)/int_d1'
|
||||||
|
if (any(int_d2_in /= int_d2_out)) error stop 'test_read_write(r)/int_d2'
|
||||||
|
if (any(int_d3_in /= int_d3_out)) error stop 'test_read_write(r)/int_d3'
|
||||||
|
if (any(int_d4_in /= int_d4_out)) error stop 'test_read_write(r)/int_d4'
|
||||||
|
if (any(int_d5_in /= int_d5_out)) error stop 'test_read_write(r)/int_d5'
|
||||||
|
|
||||||
|
|
||||||
call HDF5_closeFile(f)
|
call HDF5_closeFile(f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue