summaryrefslogtreecommitdiff
path: root/ccan/aga/test/trivial.c
blob: 8d4284568168249cb09d2089aaf247ff54093a2b (plain)
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
#include "config.h"

#include <assert.h>

#include <ccan/container_of/container_of.h>

#include <ccan/aga/aga.h>

#include "simple-graph.h"

static const void *trivial_first_edge(const struct aga_graph *g,
				      const struct aga_node *node)
{
	struct trivial_graph *tg = container_of(g, struct trivial_graph, sg.g);

	assert(node == &tg->sg.nodes[1]);
	return NULL;
}

static const void *trivial_next_edge(const struct aga_graph *g,
				     const struct aga_node *node,
				     const void *edge)
{
	assert(0);
}

static int trivial_edge_info(const struct aga_graph *g,
			     const struct aga_node *node,
			     const void *edge,
			     struct aga_edge_info *ei)
{
	assert(0);
}

void trivial_graph_init(struct trivial_graph *tg)
{
	simple_graph_init(&tg->sg, trivial_first_edge, trivial_next_edge,
			  trivial_edge_info);
}