"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/array-test.c" between
wayland-1.17.0.tar.xz and wayland-1.18.0.tar.xz

About: Wayland is a computer display server protocol for a compositor to talk to its clients and a library for Linux implementing that protocol.

array-test.c  (wayland-1.17.0.tar.xz):array-test.c  (wayland-1.18.0.tar.xz)
skipping to change at line 90 skipping to change at line 90
assert((i + 1) * datasize == array.size); assert((i + 1) * datasize == array.size);
ptr->a = i * 3; ptr->a = i * 3;
ptr->b = 20000 - i; ptr->b = 20000 - i;
ptr->c = (double)(i); ptr->c = (double)(i);
ptr->d = (double)(i / 2.); ptr->d = (double)(i / 2.);
} }
/* verify the data */ /* verify the data */
for (i = 0; i < iterations; ++i) { for (i = 0; i < iterations; ++i) {
const int index = datasize * i; struct mydata* check = (struct mydata*)array.data + i;
struct mydata* check = (struct mydata*)(array.data + index);
assert(check->a == i * 3); assert(check->a == i * 3);
assert(check->b == 20000 - i); assert(check->b == 20000 - i);
assert(check->c == (double)(i)); assert(check->c == (double)(i));
assert(check->d == (double)(i/2.)); assert(check->d == (double)(i/2.));
} }
wl_array_release(&array); wl_array_release(&array);
} }
skipping to change at line 124 skipping to change at line 123
assert(p); assert(p);
*p = i * 2 + i; *p = i * 2 + i;
} }
/* copy the array */ /* copy the array */
wl_array_init(&copy); wl_array_init(&copy);
wl_array_copy(&copy, &source); wl_array_copy(&copy, &source);
/* check the copy */ /* check the copy */
for (i = 0; i < iterations; i++) { for (i = 0; i < iterations; i++) {
const int index = sizeof(int) * i; int *s = (int *)source.data + i;
int *s = (int *)(source.data + index); int *c = (int *)copy.data + i;
int *c = (int *)(copy.data + index);
assert(*s == *c); /* verify the values are the same */ assert(*s == *c); /* verify the values are the same */
assert(s != c); /* ensure the addresses aren't the same */ assert(s != c); /* ensure the addresses aren't the same */
assert(*s == i * 2 + i); /* sanity check */ assert(*s == i * 2 + i); /* sanity check */
} }
wl_array_release(&source); wl_array_release(&source);
wl_array_release(&copy); wl_array_release(&copy);
} }
 End of changes. 2 change blocks. 
5 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)