Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding basic graphxml test
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 20 Mar 2006 15:38:34 +0000 (15:38 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 20 Mar 2006 15:38:34 +0000 (15:38 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1963 48e7efb5-ca39-0410-a469-dd3cf9ba447f

testsuite/Makefile.am
testsuite/run_tests.in
testsuite/xbt/graph.xml [new file with mode: 0644]
testsuite/xbt/graphxml_usage.c [new file with mode: 0644]

index 9d9e2ec..405ffd9 100644 (file)
@@ -9,6 +9,7 @@ EXTRA_DIST=run_tests.in \
   gras/datadesc.little64\
   gras/datadesc.big32 gras/datadesc.big32_8_4 gras/datadesc.big32_2 \
   gras/mk_datadesc_structs.pl \
   gras/datadesc.little64\
   gras/datadesc.big32 gras/datadesc.big32_8_4 gras/datadesc.big32_2 \
   gras/mk_datadesc_structs.pl \
+  xbt/graph.xml \
   surf/trace_A.txt surf/trace_B.txt surf/trace_A_failure.txt surf/platform.xml
 
 # Data sets still to regenerate:
   surf/trace_A.txt surf/trace_B.txt surf/trace_A_failure.txt surf/platform.xml
 
 # Data sets still to regenerate:
@@ -21,6 +22,7 @@ EXTRA_DIST=run_tests.in \
 xbt_tests =                                                      \
        xbt/log_usage                                            \
        xbt/heap_bench                                           \
 xbt_tests =                                                      \
        xbt/log_usage                                            \
        xbt/heap_bench                                           \
+       xbt/graphxml_usage                                       \
        xbt/context_usage                                        
 
 RL_tests =                                              \
        xbt/context_usage                                        
 
 RL_tests =                                              \
@@ -49,6 +51,8 @@ xbt_log_usage_LDADD=          $(LDADD_RL)
 
 xbt_heap_bench_LDADD=         $(LDADD_RL)
 
 
 xbt_heap_bench_LDADD=         $(LDADD_RL)
 
+xbt_graphxml_usage_LDADD=     $(LDADD_SG)
+
 xbt_context_usage_LDADD=      $(LDADD_SG)
 
 surf_maxmin_usage_LDADD=      $(LDADD_SG)
 xbt_context_usage_LDADD=      $(LDADD_SG)
 
 surf_maxmin_usage_LDADD=      $(LDADD_SG)
index 53c5458..5eb6290 100755 (executable)
@@ -33,6 +33,7 @@ fi
 xbt_TESTS=" \
             xbt/log_usage@EXEEXT@;        \
             xbt/context_usage@EXEEXT@;    \
 xbt_TESTS=" \
             xbt/log_usage@EXEEXT@;        \
             xbt/context_usage@EXEEXT@;    \
+            xbt/graphxml_usage@EXEEXT@ @srcdir@/xbt/graph.xml;    \
             xbt/heap_bench@EXEEXT@;"
           
 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
             xbt/heap_bench@EXEEXT@;"
           
 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
diff --git a/testsuite/xbt/graph.xml b/testsuite/xbt/graph.xml
new file mode 100644 (file)
index 0000000..7ed7e71
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version='1.0'?>
+<!DOCTYPE graph SYSTEM "graphxml.dtd">
+<graph>
+  <node name="A"/>
+  <node name="B"/>
+  <edge source="A" target="B"/>
+</graph>
diff --git a/testsuite/xbt/graphxml_usage.c b/testsuite/xbt/graphxml_usage.c
new file mode 100644 (file)
index 0000000..58efba4
--- /dev/null
@@ -0,0 +1,33 @@
+/*      $Id$      */
+
+/* A few basic tests for the graphxml library                               */
+
+/* Copyright (c) 2006 Darina Dimitrova, Arnaud Legrand. 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. */
+
+#include <stdio.h>
+#include <xbt/module.h>
+#include "xbt/graph.h"
+#include "xbt/graphxml.h"
+
+
+void test(char *graph_file);
+void test(char *graph_file)
+{
+  xbt_graph_t graph = xbt_graph_read(graph_file);
+  xbt_graph_free_graph(graph, NULL, NULL, NULL);
+}
+
+int main(int argc, char** argv)
+{
+  xbt_init(&argc,argv);
+  if(argc==1) {
+     fprintf(stderr,"Usage : %s graph.xml\n",argv[0]);
+     return 1;
+  }
+  test(argv[1]);
+
+  return 0;
+}