Skip to content

Commit

Permalink
test:attributes: improve verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 21, 2024
1 parent c7b6d51 commit c2f51ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/test_attributes.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
program test_attributes

!! GCC 7 segfaults if -O3 is on. Fine with -O0

use, intrinsic:: iso_fortran_env, only: int32, real32, real64, stderr=>error_unit
use, intrinsic:: iso_c_binding, only: C_NULL_CHAR

Expand Down Expand Up @@ -77,6 +79,8 @@ subroutine test_write_attributes(path)
call h%delete_attr('/x', 'hello')
call h%close()

print '(a)', 'PASSED: HDF5 write attributes: file handle'

end subroutine test_write_attributes


Expand Down Expand Up @@ -106,8 +110,8 @@ subroutine test_read_attributes(path)
if (attr_str /= 'overwrite attrs') error stop 'overwrite attrs failed: ' // attr_str

call h%readattr("/x", "empty_char", attr_str)
print *, trim(attr_str) == c_null_char
if (len_trim(attr_str) /= 0) then
write(stderr, '(a,L1)') 'hanging null char: ', trim(attr_str) == c_null_char
write(stderr, '(a,i0)') "empty char attribute: expected 0 length, got length: ", len_trim(attr_str)
error stop "empty char attribute failed"
endif
Expand Down Expand Up @@ -152,6 +156,8 @@ subroutine test_read_attributes(path)

call h%close()

print '(a)', 'PASSED: HDF5 read attributes: file handle'

end subroutine test_read_attributes

end program

0 comments on commit c2f51ac

Please sign in to comment.