Skip to content

Commit

Permalink
fix bug in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter J. Verveer committed Nov 23, 2017
1 parent ddaec6d commit eb94c9d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test_strides3.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ int main(int argc, const char* argv[]) {
Ics_DataType dt;
int ndims;
size_t dims[ICS_MAXDIM];
size_t imelsize;
size_t bufsize;
ptrdiff_t strides[3];
void* buf1;
Expand All @@ -30,8 +31,9 @@ int main(int argc, const char* argv[]) {
}
IcsGetLayout(ip, &dt, &ndims, dims);
strides[0] = -1;
strides[1] = -(ptrdiff_t)(dims[0]*dims[2]);
strides[2] = -(ptrdiff_t)dims[0];
strides[1] = -(ptrdiff_t)dims[0];
strides[2] = -(ptrdiff_t)(dims[0]*dims[1]);

This comment has been minimized.

Copy link
@crisluengo

crisluengo Nov 29, 2017

Contributor

@pjverveer The strides were like this on purpose, to test re-ordering of dimensions.

imelsize = IcsGetImelSize(ip);
bufsize = IcsGetDataSize(ip);
buf1 = malloc(bufsize);
if (buf1 == NULL) {
Expand All @@ -49,7 +51,7 @@ int main(int argc, const char* argv[]) {
fprintf(stderr, "Could not allocate memory.\n");
exit(-1);
}
retval = IcsGetDataWithStrides(ip, buf3 + bufsize - 1, 0, strides, 3);
retval = IcsGetDataWithStrides(ip, buf3 + bufsize - imelsize, 0, strides, 3);
if (retval != IcsErr_Ok) {
fprintf(stderr, "Could not read input image data using strides: %s\n",
IcsGetErrorText(retval));
Expand All @@ -70,7 +72,7 @@ int main(int argc, const char* argv[]) {
exit(-1);
}
IcsSetLayout(ip, dt, ndims, dims);
IcsSetDataWithStrides(ip, buf3 + bufsize - 1, bufsize, strides, 3);
IcsSetDataWithStrides(ip, buf3 + bufsize - imelsize, bufsize, strides, 3);
IcsSetCompression(ip, IcsCompr_gzip, 6);
retval = IcsClose(ip);
if (retval != IcsErr_Ok) {
Expand Down

0 comments on commit eb94c9d

Please sign in to comment.