aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Altendorf <sda@fstab.net>2019-09-21 10:05:25 -0400
committerKyle Altendorf <sda@fstab.net>2019-09-21 10:06:07 -0400
commit8d38d5e6fd82fc38b61e9667b446bf84ed858445 (patch)
treead69838dd8da4225577028b836dcd8ef2ad414ff
parentMerge pull request #21 from altendky/full_siphash_format_specifiers (diff)
downloadsiphash-8d38d5e6fd82fc38b61e9667b446bf84ed858445.tar.gz
siphash-8d38d5e6fd82fc38b61e9667b446bf84ed858445.tar.xz
Return non-zero when tests fail
This allows for shell scripts to check for success or failure without parsing the printed output. If the function name is later changed from main() it will also allow other code calling the tests to also easily check the pass or fail status.
Diffstat (limited to '')
-rw-r--r--test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test.c b/test.c
index b6547a5..1f57594 100644
--- a/test.c
+++ b/test.c
@@ -13,6 +13,7 @@
*/
#include "vectors.h"
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -46,6 +47,7 @@ size_t lengths[4] = {8, 16, 4, 8};
int main() {
uint8_t in[64], out[16], k[16];
int i;
+ bool any_failed;
#ifndef GETVECTORS
int fails = 0;
#endif
@@ -91,6 +93,7 @@ int main() {
if (memcmp(out, v + (i * len), len)) {
printf("fail for %d bytes\n", i);
fails++;
+ any_failed = true;
}
#endif
}
@@ -105,5 +108,5 @@ int main() {
#endif
}
- return 0;
+ return any_failed;
}