summaryrefslogtreecommitdiff
path: root/ccan/idtree/test/run-wrap.c
blob: ee64ad1198d02a2634e8e44b50506caf7d1c3402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <ccan/idtree/idtree.c>
#include <ccan/tap/tap.h>
#include <limits.h>

int main(int argc, char *argv[])
{
	unsigned int i;
	struct idtree *idtree;

	plan_tests(6);
	idtree = idtree_new(NULL);

	ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX-1);
	ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX);
	ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == -1);

	ok1(idtree_remove(idtree, INT_MAX-1) == true);
	ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == INT_MAX-1);
	ok1(idtree_add_above(idtree, &i, INT_MAX-1, INT_MAX) == -1);
	tal_free(idtree);
	exit(exit_status());
}