2021-03-22 16:40:45 +01:00
|
|
|
program test_trexio
|
|
|
|
|
|
|
|
use trexio
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
type(c_ptr) :: file1
|
|
|
|
|
|
|
|
integer :: rc
|
2021-03-23 16:34:13 +01:00
|
|
|
integer (c_int64_t) :: num
|
|
|
|
|
|
|
|
type(c_ptr) :: num_test
|
|
|
|
integer, pointer :: num_read
|
|
|
|
integer, target :: num666
|
2021-03-22 16:40:45 +01:00
|
|
|
|
|
|
|
rc = 0
|
|
|
|
num = 10
|
|
|
|
|
2021-03-23 16:34:13 +01:00
|
|
|
num_test = c_loc(num666)
|
|
|
|
|
2021-03-23 14:57:11 +01:00
|
|
|
file1 = trexio_open('trexio_test' // c_null_char, 'w', 1)
|
2021-03-22 16:40:45 +01:00
|
|
|
! file1 = trexio_open('test_fort.h5' // c_null_char, 'w', 0)
|
|
|
|
|
|
|
|
rc = trexio_write_nucleus_num(file1, num)
|
2021-03-23 16:34:13 +01:00
|
|
|
if (rc == 0) write(*,*) 'SUCCESS WRITE'
|
|
|
|
|
|
|
|
rc = trexio_read_nucleus_num(file1, num_test)
|
|
|
|
|
|
|
|
call c_f_pointer(num_test, num_read)
|
|
|
|
|
|
|
|
if (rc == 0 .and. num_read == num) write(*,*) 'SUCCESS READ'
|
2021-03-22 16:40:45 +01:00
|
|
|
|
|
|
|
rc = trexio_close(file1)
|
2021-03-23 16:34:13 +01:00
|
|
|
if (rc == 0) write(*,*) 'SUCCESS CLOSE'
|
2021-03-22 16:40:45 +01:00
|
|
|
|
|
|
|
end program test_trexio
|