test: add trivial test for syscall table and extend table tests to error paths

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-07-13 21:59:17 -04:00
parent 6aea6d10f4
commit bf502e636b
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -29,15 +29,17 @@ static inline void _test_table(const char *name,
int size) {
int i;
for (i = 0; i < size; i++) {
for (i = 0; i < size + 1; i++) {
const char* val = lookup(i);
int rev = -1;
int rev;
if (val)
rev = reverse(val);
else
rev = reverse("--no-such--value----");
printf("%s: %d → %s → %d\n", name, i, val, rev);
if (!val || rev != i)
if (i < size ? val == NULL || rev != i : val != NULL || rev != -1)
exit(EXIT_FAILURE);
}
}