fnv1a assert tests
This commit is contained in:
parent
49d616dc9f
commit
eedaf13eff
1 changed files with 11 additions and 0 deletions
11
fnv1a.c
11
fnv1a.c
|
|
@ -2,6 +2,7 @@
|
|||
* Check wikipedia for details and pseudocode.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -46,4 +47,14 @@ int main(void) {
|
|||
|
||||
printf("FNV1a64 of \"Hello\": %lX\n", h64_2);
|
||||
printf("FNV1a32 of \"Hello\": %X\n", h32_2);
|
||||
|
||||
fflush(stdin);
|
||||
|
||||
assert(h64 == 0xA430D84680AABD0B);
|
||||
assert(h32 == 0x4F9F2CAB);
|
||||
|
||||
assert(h64_2 == 0x63F0BFACF2C00F6B);
|
||||
assert(h32_2 == 0xF55C314B);
|
||||
|
||||
printf("All tests passed!\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue