blob: e9362abed26ac8f31434235a6d81564f7cdb8aee (
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
|
#include <assert.h>
#include <stdio.h>
#define MAP_KEY int
#define MAP_TYPE int
#define MAP_CMP(a, b) ((a) - (b))
#define MAP_NAME ints
#include <conts/map.h>
int main()
{
struct ints ints = ints_create();
for (int i = 0; i < 1000000; ++i) {
ints_insert(&ints, i, i);
}
assert(ints_len(&ints) == 1000000);
for (int i = 0; i < 1000000; ++i) {
int *v = ints_find(&ints, i);
assert(v && *v == i);
}
foreach(ints, iter, &ints) {
assert(iter->key == iter->data);
}
for (int i = 0; i < 1000000; ++i) {
ints_remove(&ints, i);
}
assert(ints_len(&ints) == 0);
ints_destroy(&ints);
}
|