-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhash.c
More file actions
32 lines (26 loc) · 731 Bytes
/
hash.c
File metadata and controls
32 lines (26 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <assert.h>
#include <stddef.h>
extern int sLength(const char* source);
extern int gHash(const char* source);
#define TABLE_SIZE (16)
int main()
{
assert(sLength(0) == 0);
assert(sLength("a") == 1);
printf("sLength OK\n");
assert(gHash("mccoll") == 639467543);
assert(gHash("alex35") == 5560235);
assert(gHash("jim45") == 643145);
assert(gHash("robin99") == 72863299);
assert(gHash("sam00") == 725100);
assert(gHash("john76") == 6492276);
assert(gHash("micheal09") == -1862749583);
assert(gHash("harry20") == 61633320);
assert(gHash("manuel65") == 665949065);
assert(gHash("ram75") == 715175);
assert(gHash("derrick21") == 1508259625);
printf("gHash OK\n");
printf("ALL OK\n");
return 0;
}