Skip to content

Commit 44e95c7

Browse files
committed
test:cast: check other arrays, print class
1 parent eb08ec9 commit 44e95c7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/test_cast.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ program test_cast
44
use h5fortran, only : hdf5_file, &
55
H5T_INTEGER_F, H5T_FLOAT_F, H5T_STRING_F, &
66
H5T_NATIVE_REAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_INTEGER, H5T_NATIVE_CHARACTER, H5T_STD_I64LE
7-
use, intrinsic :: iso_fortran_env, only : real32, real64, int32, int64
7+
use, intrinsic :: iso_fortran_env, only : real32, real64, int32, int64, stderr=>error_unit
88

99
implicit none
1010

@@ -61,10 +61,15 @@ subroutine test_cast_read(fn)
6161
!> %class method
6262
if (h%class("/scalar_int32") /= H5T_INTEGER_F) error stop "int32 not integer"
6363
if (h%class("/scalar_int64") /= H5T_INTEGER_F) error stop "int64 not integer"
64+
if (h%class("/1d_real32") /= H5T_FLOAT_F) error stop "1d_real32 not float"
6465
if (h%class("/scalar_real32") /= H5T_FLOAT_F) error stop "real32 not float"
6566
if (h%class("/scalar_real64") /= H5T_FLOAT_F) error stop "real64 not float"
6667
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"
68+
if (h%class('/cast/r64tor32') /= H5T_FLOAT_F) then
69+
write(stderr,*) "expected cast r64tor32 ", H5T_FLOAT_F, " but got ", h%class('/cast/r64tor32')
70+
error stop "cast not float"
71+
endif
72+
6873
print *, "OK: class method"
6974

7075
!> %dtype method

0 commit comments

Comments
 (0)