MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

plugins/askrene/test/run-graph.c:28–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28int main(int argc, char *argv[])
29{
30 common_setup(argv[0]);
31 printf("Allocating a memory context\n");
32 tal_t *ctx = tal(NULL, tal_t);
33 assert(ctx);
34
35 printf("Allocating a graph\n");
36 struct graph *graph = graph_new(ctx, MAX_NODES, MAX_ARCS, DUAL_BIT);
37 assert(graph);
38
39 bool success;
40
41 success = graph_add_arc(graph, arc_obj(0), node_obj(0), node_obj(1));
42 assert(success);
43
44 success = graph_add_arc(graph, arc_obj(1), node_obj(0), node_obj(2));
45 assert(success);
46
47 success = graph_add_arc(graph, arc_obj(2), node_obj(0), node_obj(3));
48 assert(success);
49
50 success = graph_add_arc(graph, arc_obj(3), node_obj(3), node_obj(2));
51 assert(success);
52
53 show(graph, node_obj(0));
54 show(graph, node_obj(1));
55 show(graph, node_obj(2));
56 show(graph, node_obj(3));
57
58 printf("Freeing memory\n");
59 ctx = tal_free(ctx);
60 common_shutdown();
61 return 0;
62}
63

Callers

nothing calls this directly

Calls 8

common_setupFunction · 0.85
graph_newFunction · 0.85
graph_add_arcFunction · 0.85
arc_objFunction · 0.85
node_objFunction · 0.85
tal_freeFunction · 0.85
common_shutdownFunction · 0.85
showFunction · 0.70

Tested by

no test coverage detected