File tests/test_hashset.c added (mode: 100644) (index 0000000..eade8b2) |
|
1 |
|
/* |
|
2 |
|
* test_hstr.c |
|
3 |
|
* |
|
4 |
|
* Created on: Jan 10, 2014 |
|
5 |
|
* Author: dvorka |
|
6 |
|
*/ |
|
7 |
|
|
|
8 |
|
#include "../src/include/hashset.h" |
|
9 |
|
|
|
10 |
|
int main(int argc, char *argv[]) |
|
11 |
|
{ |
|
12 |
|
const char *commandBlacklist[] = {"ls", "pwd", "cd", "hh", "mc"}; |
|
13 |
|
HashSet blacklist; |
|
14 |
|
int i; |
|
15 |
|
hashset_init(&blacklist); |
|
16 |
|
for(i=0; i<5; i++) { |
|
17 |
|
hashset_add(&blacklist, commandBlacklist[i]); |
|
18 |
|
} |
|
19 |
|
|
|
20 |
|
for(i=0; i<5; i++) { |
|
21 |
|
printf("match %d\n", hashset_contains(&blacklist, strdup(commandBlacklist[i]))); |
|
22 |
|
} |
|
23 |
|
} |
|
24 |
|
|