diff options
Diffstat (limited to 'tests/test-graph.c')
-rw-r--r-- | tests/test-graph.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test-graph.c b/tests/test-graph.c index 1184a0a..d50857e 100644 --- a/tests/test-graph.c +++ b/tests/test-graph.c @@ -124,6 +124,28 @@ test_get_num_edges (Fixture *fixture, gconstpointer data) } static void +test_get_edges (Fixture *fixture, gconstpointer data) +{ + GList *edges; + UfoEdge *edge; + + edges = ufo_graph_get_edges (fixture->graph); + g_assert (g_list_length (edges) == 2); + + edge = g_list_nth_data (edges, 0); + g_assert (edge->source == fixture->root); + g_assert (edge->target == fixture->target1 || + edge->target == fixture->target2); + + edge = g_list_nth_data (edges, 1); + g_assert (edge->source == fixture->root); + g_assert (edge->target == fixture->target1 || + edge->target == fixture->target2); + + g_list_free (edges); +} + +static void test_get_successors (Fixture *fixture, gconstpointer data) { GList *successors; @@ -231,6 +253,10 @@ test_add_graph (void) Fixture, NULL, fixture_setup, test_get_num_edges, fixture_teardown); + g_test_add ("/graph/edges/get", + Fixture, NULL, + fixture_setup, test_get_edges, fixture_teardown); + g_test_add ("/graph/get-successors", Fixture, NULL, fixture_setup, test_get_successors, fixture_teardown); |