1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

adapt tests to use TREXIO_DELIM as a delimeter

This commit is contained in:
q-posev 2021-06-03 13:42:56 +02:00
parent aa4251b943
commit 313ab12c61
2 changed files with 7 additions and 5 deletions

View File

@ -67,7 +67,7 @@ int test_h5write() {
char labelxxx[128] = "";
for (int i=0; i<num; i++){
strcat(labelxxx,label[i]);
strcat(labelxxx,"\n");
strcat(labelxxx,TREXIO_DELIM);
}
/*================= START OF TEST ==================*/
@ -180,8 +180,10 @@ int test_h5read() {
printf("%s\n", labelxxx);
//assert( strcmp(label[1], "Na") == 0 );
char * pch;
pch = strtok(labelxxx, "\n");
pch = strtok(labelxxx, TREXIO_DELIM);
assert( strcmp(pch, "C") == 0 );
pch = strtok(NULL, TREXIO_DELIM);
assert( strcmp(pch, "Na") == 0 );
// close current session
rc = trexio_close(file);

View File

@ -10,7 +10,7 @@ subroutine test_write()
! ============ Test write functionality =============== !
use trexio
use, intrinsic :: iso_c_binding, only: c_new_line
use, intrinsic :: iso_c_binding
implicit none
@ -47,7 +47,7 @@ subroutine test_write()
label_str=''
do i = 1,num
! label_str=label_str//trim(label(i))//' '
label_str=label_str//trim(label(i))//c_new_line
label_str=label_str//trim(label(i))//TREXIO_DELIM
enddo
@ -155,7 +155,7 @@ subroutine test_read()
tmp_str=''
do j=ind,128
if ( (label_str(j)==c_new_line) ) then
if ( (label_str(j)==TREXIO_DELIM) ) then
ind=j+1
exit
endif