Skip to content

Commit

Permalink
Use srand and rand for Win compat
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Jul 3, 2023
1 parent da9d9de commit d4d99a2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@

int main(void) {
blosc2_init();
srandom(0);
char *name = NULL;
srand(0);
char *libname = NULL;
char *version = NULL;
if (blosc2_get_complib_info("zstd", &name, &version) < 0) {
int ret = blosc2_get_complib_info("zstd", &libname, &version);
if (libname != NULL) {
free(libname);
free(version);
}
if (ret < 0) {
// We need ZSTD for the test here...
return 0;
}

uint16_t *ref_data = (uint16_t *)malloc(CHUNKSIZE);
uint16_t *data_dest = (uint16_t *)malloc(CHUNKSIZE);
for (int i = 0; i < LEN; i++) {
ref_data[i] = random() % 118;
ref_data[i] = rand() % 118;
}
blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
cparams.compcode = BLOSC_ZSTD;
Expand Down

0 comments on commit d4d99a2

Please sign in to comment.