test tweaks

main
JP Aumasson 2014-03-23 18:03:51 +01:00
parent 2d4d778ffd
commit 9cb8888dff
2 changed files with 8 additions and 9 deletions

View File

@ -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.

12
main.c
View File

@ -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;
}