X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/271392270efac4b11390c5809e1b8d47be253d87..9f1d484852065d8e224f03acb1d11bcca28dd07a:/testsuite/xbt/graphxml_usage.c diff --git a/testsuite/xbt/graphxml_usage.c b/testsuite/xbt/graphxml_usage.c index f0b67d55eb..e49db05b1b 100644 --- a/testsuite/xbt/graphxml_usage.c +++ b/testsuite/xbt/graphxml_usage.c @@ -1,85 +1,174 @@ -/* $Id$ */ - /* A few basic tests for the graphxml library */ -/* Copyright (c) 2006 Darina Dimitrova, Arnaud Legrand. All rights reserved.*/ +/* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#ifdef __BORLANDC__ +#pragma hdrstop +#endif #include -#include + +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + +#include "xbt/module.h" +#include "xbt/sysdep.h" #include "xbt/graph.h" #include "xbt/graphxml.h" -#include "xbt/dynar.h" -#include +#include "xbt/log.h" +XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to graphxml test"); +static void *node_label_and_data(xbt_node_t node, const char *label, + const char *data) +{ + char *lbl = xbt_strdup(label); + return lbl; +} + +#define free_label free + +static const char *node_name(xbt_node_t n) +{ + return xbt_graph_node_get_data(n); +} + void test(char *graph_file); void test(char *graph_file) { - int i,j; + int test_node_deletion = 0; + int test_edge_deletion = 0; + int test_export_xml = 1; + int test_export_dot = 1; + int test_export_length = 1; + int test_shortest_paths = 1; + int test_topo_sort = 1; + + unsigned long i, j; unsigned long n; - xbt_dynar_t dynar=NULL; - xbt_dynar_t dynar1=NULL; - xbt_node_t * route=NULL; - - xbt_graph_t graph = xbt_graph_read(graph_file); - n=xbt_dynar_length(xbt_graph_get_nodes( graph)); - - double *adj=xbt_graph_get_length_matrix(graph); - - - for(i=0;idata) ); *\/ */ -/* } */ -/* fprintf(stderr,"\n" ); */ -/* } */ - - - - - - /* while(xbt_dynar_length(dynar)) */ -/* xbt_graph_free_node(graph,*((xbt_node_t*)xbt_dynar_get_ptr(dynar,0)),NULL,NULL); */ - - dynar = xbt_graph_get_edges(graph); -while(xbt_dynar_length(dynar)) - xbt_graph_free_edge(graph,*((xbt_edge_t*)xbt_dynar_get_ptr(dynar,0)),NULL); - - printf("%lu edges\n",xbt_dynar_length(dynar)); - dynar1 = xbt_graph_get_nodes(graph); - printf("%lu nodes\n",xbt_dynar_length(dynar1)); -/* free(d); */ - xbt_graph_free_graph(graph, NULL, NULL, NULL); } -int main(int argc, char** argv) +#ifdef __BORLANDC__ +#pragma argsused +#endif + +int main(int argc, char **argv) { - xbt_init(&argc,argv); - if(argc==1) - { - fprintf(stderr,"Usage : %s graph.xml\n",argv[0]); - - return 1; + xbt_init(&argc, argv); + if (argc == 1) { + fprintf(stderr, "Usage : %s graph.xml\n", argv[0]); + + return 1; } test(argv[1]); - return 0; }