summaryrefslogtreecommitdiffstats
path: root/src/libmain.c
blob: 25a340dbc39d5364d94f9bb5e0816a9db521fda7 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "xxhash.h"
#include <string.h>

#include <stdint.h>
#include <stdio.h>

#define HT_IMPLEMENTATIONS
#include "htgen.h"

#if 1
int main(int argc, char **argv) {
  shash_t *hash = shash_create(4, 0.75f);
  printf("%d\n", shash_put(hash, "test1", "value1"));
  printf("%d\n", shash_put(hash, "testbro", "val2"));
  shash__debug_table(hash);

  char *oldval = shash_pop(hash, "test1", NULL);
  printf("%s:%s\n", "test1", oldval);
  free(oldval);

  shash__debug_table(hash);
  printf("%d\n", shash_put(hash, "testbro", "val3"));
  shash__debug_table(hash);

  shash_free(hash);
  
  return 0;
}
#else

int main(int argc, char **argv)
{
  ihash_t *hash = ihash_create(8, 0.75f);

  printf("%d\n", ihash_put(hash, 1, 10));
  ihash__debug_table(hash);
  printf("%d\n", ihash_put(hash, 5, 20));
  printf("%d\n", ihash_put(hash, 3, 19));
  printf("%d\n", ihash_put(hash, 56, 101));
  ihash__debug_table(hash);
  printf("%d\n", ihash_put(hash, 90, 6));
  printf("%d\n", ihash_put(hash, 2000, 1));
  ihash__debug_table(hash);
  printf("%d\n", ihash_put(hash, 4, 2020));

  ihash__debug_table(hash);

  ihash_free(hash);

  return 0;
}

#endif