X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cc01c6a871dbbfd0cc84e26eb9f94aeb539e613e..20801428bec07ed58c348d25ad39878f2c208389:/testsuite/xbt/graphxml_usage.c diff --git a/testsuite/xbt/graphxml_usage.c b/testsuite/xbt/graphxml_usage.c index a8f82b88eb..e49db05b1b 100644 --- a/testsuite/xbt/graphxml_usage.c +++ b/testsuite/xbt/graphxml_usage.c @@ -12,7 +12,7 @@ #include #ifdef _MSC_VER -#define snprintf _snprintf +#define snprintf _snprintf #endif #include "xbt/module.h" @@ -61,12 +61,12 @@ void test(char *graph_file) n = xbt_dynar_length(xbt_graph_get_nodes(graph)); if (test_export_xml) { - INFO0("---- Testing XML export. Exporting to testgraph.xml ----"); + XBT_INFO("---- Testing XML export. Exporting to testgraph.xml ----"); xbt_graph_export_graphxml(graph, "testgraph.xml", NULL, NULL, NULL, NULL); } if (test_export_dot) { - INFO0("---- Testing GraphViz export. Exporting to testgraph.dot ----"); + XBT_INFO("---- Testing GraphViz export. Exporting to testgraph.dot ----"); xbt_graph_export_graphviz(graph, "testgraph.dot", node_name, NULL); } @@ -74,14 +74,14 @@ void test(char *graph_file) char *buf = NULL; double *adj = NULL; - INFO0("---- Dumping Edge lengths ----"); + XBT_INFO("---- Dumping Edge lengths ----"); adj = xbt_graph_get_length_matrix(graph); buf = xbt_new0(char, n * 20); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]); } - INFO1("%s", buf); + XBT_INFO("%s", buf); buf[0] = '\000'; } free(buf); @@ -92,7 +92,7 @@ void test(char *graph_file) char *buf = NULL; xbt_node_t *route = NULL; - INFO0("---- Testing Shortest Paths ----"); + XBT_INFO("---- Testing Shortest Paths ----"); route = xbt_graph_shortest_paths(graph); buf = xbt_new0(char, n * 40); for (i = 0; i < n; i++) { @@ -101,7 +101,7 @@ void test(char *graph_file) snprintf(buf + strlen(buf), 40, "%s\t", node_name(route[i * n + j])); } - INFO1("%s", buf); + XBT_INFO("%s", buf); buf[0] = '\000'; } free(buf); @@ -111,11 +111,11 @@ void test(char *graph_file) if (test_topo_sort) { xbt_node_t *sorted = NULL; - INFO0("---- Testing Topological Sort ----"); + XBT_INFO("---- Testing Topological Sort ----"); sorted = xbt_graph_topo_sort(graph); for (i = 0; i < n; i++) { if (sorted[i]) { - INFO3("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]); + XBT_INFO("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]); } } free(sorted); @@ -123,37 +123,38 @@ void test(char *graph_file) if (test_node_deletion) { - INFO0("---- Testing Node Deletion ----"); + XBT_INFO("---- Testing Node Deletion ----"); nodes = xbt_graph_get_nodes(graph); edges = xbt_graph_get_edges(graph); - INFO2("Before Node deletion: %lu nodes, %lu edges", + XBT_INFO("Before Node deletion: %lu nodes, %lu edges", xbt_dynar_length(nodes), xbt_dynar_length(edges)); - while (xbt_dynar_length(nodes)) + while (!xbt_dynar_is_empty(nodes)) xbt_graph_free_node(graph, *((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)), free_label, NULL); - INFO2("After Node deletion: %lu nodes, %lu edges", + XBT_INFO("After Node deletion: %lu nodes, %lu edges", xbt_dynar_length(nodes), xbt_dynar_length(edges)); } if (test_edge_deletion) { - INFO0("---- Testing Edge Deletion ----"); + XBT_INFO("---- Testing Edge Deletion ----"); nodes = xbt_graph_get_nodes(graph); edges = xbt_graph_get_edges(graph); - INFO2("Before Edge deletion: %lu nodes, %lu edges", + XBT_INFO("Before Edge deletion: %lu nodes, %lu edges", xbt_dynar_length(nodes), xbt_dynar_length(edges)); - while (xbt_dynar_length(edges)) + while (!xbt_dynar_is_empty(edges)) xbt_graph_free_edge(graph, *((xbt_edge_t *) xbt_dynar_get_ptr(edges, 0)), NULL); - INFO2("After Edge deletion: %lu nodes, %lu edges", + XBT_INFO("After Edge deletion: %lu nodes, %lu edges", xbt_dynar_length(nodes), xbt_dynar_length(edges)); } xbt_graph_free_graph(graph, free_label, NULL, NULL); + } #ifdef __BORLANDC__ @@ -169,6 +170,5 @@ int main(int argc, char **argv) return 1; } test(argv[1]); - return 0; }