mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-23 04:43:57 +01:00
add test, works for h5 but failt for txt
This commit is contained in:
parent
baa50bdbe2
commit
ac44fc29a6
@ -12,7 +12,6 @@
|
||||
#+end_src
|
||||
|
||||
#+begin_src fortran :tangle prefix_fortran.f90 :noweb yes
|
||||
<<header>>
|
||||
|
||||
module trexio
|
||||
|
||||
@ -292,9 +291,9 @@ trexio_t* trexio_open(const char* file_name, const char mode, const back_end_t b
|
||||
interface
|
||||
type (c_ptr) function trexio_open (filename, mode, backend) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
character(kind=c_char), dimension(*) :: filename
|
||||
character(kind=c_char), intent(in) :: mode
|
||||
integer (c_int32_t), intent(in), value :: backend
|
||||
character(kind=c_char), dimension(*) :: filename
|
||||
character(kind=c_char), intent(in), value :: mode
|
||||
integer (c_int32_t), intent(in), value :: backend
|
||||
end function trexio_open
|
||||
end interface
|
||||
#+end_src
|
||||
@ -375,7 +374,7 @@ trexio_exit_code trexio_close(trexio_t* file) {
|
||||
|
||||
#+begin_src fortran :tangle prefix_fortran.f90
|
||||
interface
|
||||
type (c_int32_t) function trexio_close (trex_file) bind(C)
|
||||
integer (c_int32_t) function trexio_close (trex_file) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
type (c_ptr), intent(in), value :: trex_file
|
||||
end function trexio_close
|
||||
@ -469,7 +468,7 @@ interface
|
||||
integer (c_int32_t) function trexio_read_$group_num$ (trex_file, num) bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
type (c_ptr), intent(in), value :: trex_file
|
||||
integer (c_int64_t), intent(inout), value :: num
|
||||
integer (c_int64_t), value :: num
|
||||
end function trexio_read_$group_num$
|
||||
end interface
|
||||
|
||||
|
24
src/test.f90
Normal file
24
src/test.f90
Normal file
@ -0,0 +1,24 @@
|
||||
program test_trexio
|
||||
|
||||
use trexio
|
||||
|
||||
implicit none
|
||||
|
||||
type(c_ptr) :: file1
|
||||
|
||||
integer :: rc
|
||||
integer (c_int64_t) :: num
|
||||
|
||||
rc = 0
|
||||
num = 10
|
||||
|
||||
file1 = trexio_open('test_fort' // c_null_char, 'w', 1)
|
||||
! file1 = trexio_open('test_fort.h5' // c_null_char, 'w', 0)
|
||||
|
||||
rc = trexio_write_nucleus_num(file1, num)
|
||||
if (rc == 0) write(*,*) 'SUCCESS 1'
|
||||
|
||||
rc = trexio_close(file1)
|
||||
if (rc == 0) write(*,*) 'SUCCESS 2'
|
||||
|
||||
end program test_trexio
|
Loading…
Reference in New Issue
Block a user