test-tables: make the assert more readable

Doing it all in one line and with negation in front seemed like a good
idea at some point, but I think it is vastly easier to understand when
it is split out a bit.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-10 14:43:10 +01:00
parent b357fe57b2
commit 3c3cd61e75
+7 -3
View File
@@ -31,9 +31,13 @@ static inline void _test_table(const char *name,
else if (boring == 1)
printf("%*s ...\n", (int) strlen(name), "");
assert_se(!(i >= 0 && i < size ?
sparse ? rev != i && rev != -1 : val == NULL || rev != i :
val != NULL || rev != -1));
if (i >= 0 && i < size) {
if (sparse)
assert_se(rev == i || rev == -1);
else
assert_se(val != NULL && rev == i);
} else
assert_se(val == NULL && rev == -1);
}
}