diff --git a/Makefile.am b/Makefile.am index 65e0e1b..a8f57ab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,6 +90,7 @@ TESTS_C = \ tests/io_num_text \ tests/io_dset_float_text \ tests/io_dset_int_text \ + tests/io_dset_sparse_text \ tests/io_safe_dset_float_text \ tests/io_str_text \ tests/io_dset_str_text \ @@ -123,6 +124,7 @@ tests_open_text_LDFLAGS = -no-install tests_io_num_text_LDFLAGS = -no-install tests_io_dset_float_text_LDFLAGS = -no-install tests_io_dset_int_text_LDFLAGS = -no-install +tests_io_dset_sparse_text_LDFLAGS = -no-install tests_io_safe_dset_float_text_LDFLAGS = -no-install tests_io_str_text_LDFLAGS = -no-install tests_io_dset_str_text_LDFLAGS = -no-install @@ -271,4 +273,3 @@ CLEANFILES += $(pytrexio_c) \ .PHONY: cppcheck python-test python-install python-sdist check-numpy FORCE endif - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cf2d896..b4269e6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,11 +1,12 @@ -# ================= TESTING ================= +# ================= TESTING ================= # Create a list of tests for TEXT back end. set(Tests_text open_text io_dset_float_text io_dset_str_text + io_dset_sparse_text io_safe_dset_float_text io_dset_int_text io_num_text @@ -43,4 +44,3 @@ endforeach() add_executable(test_f test_f.f90) target_link_libraries(test_f PRIVATE trexio_f) add_test(NAME test_f COMMAND $) - diff --git a/tests/io_dset_sparse_text.c b/tests/io_dset_sparse_text.c new file mode 100644 index 0000000..a20d1a0 --- /dev/null +++ b/tests/io_dset_sparse_text.c @@ -0,0 +1,108 @@ +#include +#include +#include +#include "trexio.h" +#include + +#define FILENAME "test_sparse.dir" + + +int main(){ + + uint64_t offset_f = 0; + + // create the data to write + uint64_t size = 100; + int32_t* index; + double* value; + + index = calloc(4L*size, sizeof(int32_t)); + value = calloc(size, sizeof(double)); + + for(int i=0; i