mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-11-03 20:54:07 +01:00
adapt tests to use max_str_len for a single string
This commit is contained in:
parent
f2c5a3a51b
commit
3331cc0591
11
tests/test.c
11
tests/test.c
@ -75,7 +75,7 @@ int test_write(const char* file_name, const back_end_t backend) {
|
||||
strcat(labelxxx,TREXIO_DELIM);
|
||||
}
|
||||
|
||||
const char* sym = "B3U";
|
||||
const char* sym = "B3U and some stuff";
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
// open file in 'write' mode
|
||||
@ -96,7 +96,7 @@ int test_write(const char* file_name, const back_end_t backend) {
|
||||
if (backend == TREXIO_HDF5) rc = trexio_write_nucleus_label(file,labelxxx, 4);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
if (backend == TREXIO_HDF5) rc = trexio_write_nucleus_point_group(file, sym);
|
||||
if (backend == TREXIO_HDF5) rc = trexio_write_nucleus_point_group(file, sym, 32);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
// check if the written data exists in the file
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
@ -195,10 +195,15 @@ int test_read(const char* file_name, const back_end_t backend) {
|
||||
|
||||
point_group = (char*) malloc(32*sizeof(char));
|
||||
|
||||
rc = trexio_read_nucleus_point_group(file, point_group);
|
||||
rc = trexio_read_nucleus_point_group(file, point_group, 6);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
pch = strtok(point_group, " ");
|
||||
assert( strcmp(pch, "B3U") == 0 );
|
||||
|
||||
rc = trexio_read_nucleus_point_group(file, point_group, 3);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert( strcmp(point_group, "B3U") == 0 );
|
||||
|
||||
free(point_group);
|
||||
|
||||
for (int i=0; i<num; i++){
|
||||
|
@ -130,7 +130,7 @@ subroutine test_write(file_name, back_end)
|
||||
call exit(1)
|
||||
endif
|
||||
|
||||
if (back_end == TREXIO_HDF5) rc = trexio_write_nucleus_point_group(trex_file, sym_str)
|
||||
if (back_end == TREXIO_HDF5) rc = trexio_write_nucleus_point_group(trex_file, sym_str, 32)
|
||||
deallocate(sym_str)
|
||||
if (rc == TREXIO_SUCCESS) then
|
||||
write(*,*) 'SUCCESS WRITE POINT GROUP'
|
||||
@ -273,7 +273,7 @@ subroutine test_read(file_name, back_end)
|
||||
call exit(-1)
|
||||
endif
|
||||
|
||||
rc = trexio_read_nucleus_point_group(trex_file, sym_str)
|
||||
rc = trexio_read_nucleus_point_group(trex_file, sym_str, 32)
|
||||
write(*,*) sym_str(1:3)
|
||||
if (rc == TREXIO_SUCCESS .and. (sym_str(1:3) == 'B3U') ) then
|
||||
write(*,*) 'SUCCESS READ POINT GROUP'
|
||||
|
Loading…
Reference in New Issue
Block a user