summaryrefslogtreecommitdiff
path: root/src/shared/test-tables.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-13 17:36:03 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-13 21:59:17 -0400
commitbf502e636be8f76e05b0334b4e78ea7a398ba241 (patch)
tree61e012ab928cf7b16a21fe7c63207c7bc765bba3 /src/shared/test-tables.h
parent6aea6d10f460853111ca8744201ec8dade97de3c (diff)
test: add trivial test for syscall table and extend table tests to error paths
Diffstat (limited to 'src/shared/test-tables.h')
-rw-r--r--src/shared/test-tables.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/test-tables.h b/src/shared/test-tables.h
index ac7deda39b..deebec2ed2 100644
--- a/src/shared/test-tables.h
+++ b/src/shared/test-tables.h
@@ -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);
}
}