@@ -26,6 +26,8 @@ subroutine test_cast_write(fn)
26
26
27
27
type (hdf5_file) :: h
28
28
29
+ real (real64) :: darr(2 ) = 12._real64
30
+
29
31
call h% open (fn, action= ' w' )
30
32
31
33
! > test values
@@ -36,6 +38,7 @@ subroutine test_cast_write(fn)
36
38
call h% write (' /1d_real32' , [1._real32 , 32._real32 ])
37
39
call h% write (' /1d_int32' , [2_int32 , 4_int32 ])
38
40
call h% write (' /char' , " hello" )
41
+ call h% write (' /cast/r64tor32' , real (darr))
39
42
40
43
call h% close ()
41
44
@@ -61,6 +64,7 @@ subroutine test_cast_read(fn)
61
64
if (h% class(" /scalar_real32" ) /= H5T_FLOAT_F) error stop " real32 not float"
62
65
if (h% class(" /scalar_real64" ) /= H5T_FLOAT_F) error stop " real64 not float"
63
66
if (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"
64
68
print * , " OK: class method"
65
69
66
70
! > %dtype method
@@ -69,6 +73,7 @@ subroutine test_cast_read(fn)
69
73
if (h% dtype(" /scalar_real32" ) /= H5T_NATIVE_REAL) error stop " real32 type"
70
74
if (h% dtype(" /scalar_real64" ) /= H5T_NATIVE_DOUBLE) error stop " real64 type"
71
75
if (h% dtype(" /char" ) /= H5T_NATIVE_CHARACTER) error stop " char type"
76
+ if (h% dtype(' /cast/r64tor32' ) /= H5T_NATIVE_REAL) error stop " cast type"
72
77
print * , " OK: dtype method"
73
78
74
79
! > read casting -- real32 to real64 and int32 to int64
0 commit comments