1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-22 20:35:44 +01:00

add tests for trexio_info

This commit is contained in:
q-posev 2022-01-20 14:22:32 +01:00
parent 23c1601442
commit 5e82e0fc57
3 changed files with 12 additions and 7 deletions

View File

@ -38,6 +38,8 @@ except:
#============ WRITE THE DATA IN THE TEST FILE ============#
#=========================================================#
trexio.info()
# create TREXIO file and open it for writing
test_file = trexio.File(output_filename, mode='w', back_end=TEST_TREXIO_BACKEND)
assert test_file.exists

View File

@ -14,6 +14,8 @@ int main() {
int rc;
trexio_info();
bool have_hdf5 = trexio_has_backend(TREXIO_HDF5);
if(have_hdf5) {
rc = system("rm -f -- test_all.h5");
@ -72,7 +74,7 @@ int test_write(const char* file_name, const back_end_t backend) {
"H 999asdasd" ,
"H" ,
"H" };
const char* sym = "B3U with some comments";
/*================= START OF TEST ==================*/
@ -96,11 +98,11 @@ int test_write(const char* file_name, const back_end_t backend) {
assert (rc == TREXIO_SUCCESS);
rc = trexio_write_nucleus_point_group(file, sym, 32);
assert (rc == TREXIO_SUCCESS);
// close current session
rc = trexio_close(file);
assert (rc == TREXIO_SUCCESS);
// reopen file in 'write' mode
file = trexio_open(file_name, 'w', backend, &rc);
assert (file != NULL);
@ -188,7 +190,7 @@ int test_read(const char* file_name, const back_end_t backend) {
assert (rc == TREXIO_SUCCESS);
assert (strcmp(label[0], "C") == 0);
assert (strcmp(label[1], "Na") == 0);
for (int i=0; i<num; i++){
free(label[i]);
}
@ -220,8 +222,6 @@ int test_read(const char* file_name, const back_end_t backend) {
assert (file2 == NULL);
/*================= END OF TEST =====================*/
return 0;
}

View File

@ -3,6 +3,7 @@ program test_trexio
use, intrinsic :: iso_c_binding
implicit none
integer :: rc
logical :: have_hdf5
print * , "============================================"
@ -11,6 +12,8 @@ program test_trexio
print'(a,i3)', " TREXIO MINOR VERSION : ", TREXIO_VERSION_MINOR
print * , "============================================"
rc = trexio_info()
call system('rm -rf -- test_write_f.dir')
print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)'
call test_write('test_write_f.dir', TREXIO_TEXT)