Commit c2547c70 authored by Bryce Harrington's avatar Bryce Harrington
Browse files

tests: Don't increment variables inside an assert()



Addresses this warning found by Denis Denisov:

  [tests/array-test.c:137]: (warning) Assert statement modifies 'i'.
Signed-off-by: default avatarBryce Harrington <bryce@osg.samsung.com>
Reviewed-by: default avatarJon A. Cruz <jonc@osg.samsung.com>
parent ab254f7e
......@@ -126,7 +126,8 @@ TEST(array_for_each)
{
static const int elements[] = { 77, 12, 45192, 53280, 334455 };
struct wl_array array;
int *p, i;
int *p;
int i;
wl_array_init(&array);
for (i = 0; i < 5; i++) {
......@@ -136,8 +137,10 @@ TEST(array_for_each)
}
i = 0;
wl_array_for_each(p, &array)
assert(*p == elements[i++]);
wl_array_for_each(p, &array) {
assert(*p == elements[i]);
i++;
}
assert(i == 5);
wl_array_release(&array);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment