@@ -26,6 +26,8 @@ subroutine test_cast_write(fn)
2626
2727type (hdf5_file) :: h
2828
29+ real (real64) :: darr(2 ) = 12._real64
30+
2931call h% open (fn, action= ' w' )
3032
3133! > test values
@@ -36,6 +38,7 @@ subroutine test_cast_write(fn)
3638call h% write (' /1d_real32' , [1._real32 , 32._real32 ])
3739call h% write (' /1d_int32' , [2_int32 , 4_int32 ])
3840call h% write (' /char' , " hello" )
41+ call h% write (' /cast/r64tor32' , real (darr))
3942
4043call h% close ()
4144
@@ -61,6 +64,7 @@ subroutine test_cast_read(fn)
6164if (h% class(" /scalar_real32" ) /= H5T_FLOAT_F) error stop " real32 not float"
6265if (h% class(" /scalar_real64" ) /= H5T_FLOAT_F) error stop " real64 not float"
6366if (h% class(" /char" ) /= H5T_STRING_F) error stop " char not string"
67+ if (h% class(' /cast/r64tor32' ) /= H5T_FLOAT_F) error stop " cast not float"
6468print * , " OK: class method"
6569
6670! > %dtype method
@@ -69,6 +73,7 @@ subroutine test_cast_read(fn)
6973if (h% dtype(" /scalar_real32" ) /= H5T_NATIVE_REAL) error stop " real32 type"
7074if (h% dtype(" /scalar_real64" ) /= H5T_NATIVE_DOUBLE) error stop " real64 type"
7175if (h% dtype(" /char" ) /= H5T_NATIVE_CHARACTER) error stop " char type"
76+ if (h% dtype(' /cast/r64tor32' ) /= H5T_NATIVE_REAL) error stop " cast type"
7277print * , " OK: dtype method"
7378
7479! > read casting -- real32 to real64 and int32 to int64
0 commit comments