From 9cb8888dff58376e17f0aefee9b0f5e7240515f7 Mon Sep 17 00:00:00 2001 From: JP Aumasson Date: Sun, 23 Mar 2014 18:03:51 +0100 Subject: [PATCH] test tweaks --- README.md | 5 +++-- main.c | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6912c80..caa8b86 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ version of SipHash: verifies 64 test vectors, and -```C +```c ./siphash24_test_debug ``` @@ -49,7 +49,8 @@ lines License ------- -The SipHash reference code is released under [CC0 license](https://creativecommons.org/publicdomain/zero/1.0/), a public +The SipHash reference code is released under [CC0 +license](https://creativecommons.org/publicdomain/zero/1.0/), a public domain-like licence. diff --git a/main.c b/main.c index 28bc2de..12e52d4 100644 --- a/main.c +++ b/main.c @@ -107,7 +107,7 @@ int test_vectors() #define MAXLEN 64 u8 in[MAXLEN], out[8], k[16]; int i; - int ok = 1; + int fails = 0; for( i = 0; i < 16; ++i ) k[i] = i; @@ -119,20 +119,18 @@ int test_vectors() if ( memcmp( out, vectors[i], 8 ) ) { printf( "test vector failed for %d bytes\n", i ); - ok = 0; + fails++; } } - return ok; + return fails; } int main() { - if ( test_vectors() ) - printf( "test vectors ok\n" ); - else - printf( "test vectors fail\n" ); + if ( !test_vectors() ) + printf( "test vector ok\n" ); return 0; }