diff --git a/tests/io_dset_sparse_text.c b/tests/io_dset_sparse_text.c index ee33e68..1d28813 100644 --- a/tests/io_dset_sparse_text.c +++ b/tests/io_dset_sparse_text.c @@ -1,25 +1,37 @@ -#include -#include -#include #include "trexio.h" #include +#include +#include +#include -#define FILENAME "test_sparse.dir" +#define TEST_BACKEND TREXIO_TEXT +#define TREXIO_FILE "test_dset_sparse.dir" +#define RM_COMMAND "rm -rf " TREXIO_FILE +#define SIZE 100 +#define N_CHUNKS 5 +static int test_write_dset_sparse (const char* file_name, const back_end_t backend) { -int main(){ +/* Try to write an array of sparse data into the TREXIO file */ - uint64_t offset_f = 0; + trexio_t* file = NULL; + trexio_exit_code rc; - // create the data to write - uint64_t size = 100; +/*================= START OF TEST ==================*/ + + // open file in 'write' mode + file = trexio_open(file_name, 'w', backend, &rc); + assert (file != NULL); + assert (rc == TREXIO_SUCCESS); + + // parameters to be written int32_t* index; double* value; - index = calloc(4L*size, sizeof(int32_t)); - value = calloc(size, sizeof(double)); + index = calloc(4L*SIZE, sizeof(int32_t)); + value = calloc(SIZE, sizeof(double)); - for(int i=0; i