A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resource file of context usage project
[simgrid.git]
/
testsuite
/
xbt
/
graphxml_usage.c
diff --git
a/testsuite/xbt/graphxml_usage.c
b/testsuite/xbt/graphxml_usage.c
index
9e0a3c9
..
89255a7
100644
(file)
--- a/
testsuite/xbt/graphxml_usage.c
+++ b/
testsuite/xbt/graphxml_usage.c
@@
-15,12
+15,14
@@
XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to graphxml test");
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;
}
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)
{
static const char *node_name(xbt_node_t n)
{
@@
-30,8
+32,8
@@
static const char *node_name(xbt_node_t n)
void test(char *graph_file);
void test(char *graph_file)
{
void test(char *graph_file);
void test(char *graph_file)
{
- int test_node_deletion =
1
;
- int test_edge_deletion =
1
;
+ 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_export_xml = 1;
int test_export_dot = 1;
int test_export_length = 1;
@@
-43,12
+45,9
@@
void test(char *graph_file)
xbt_dynar_t edges = NULL;
xbt_dynar_t nodes = NULL;
xbt_dynar_t edges = NULL;
xbt_dynar_t nodes = NULL;
- xbt_node_t *sorted = NULL;
- xbt_node_t *route = NULL;
xbt_graph_t graph =
xbt_graph_read(graph_file, &node_label_and_data, NULL);
xbt_graph_t graph =
xbt_graph_read(graph_file, &node_label_and_data, NULL);
- double *adj = NULL;
n = xbt_dynar_length(xbt_graph_get_nodes(graph));
n = xbt_dynar_length(xbt_graph_get_nodes(graph));
@@
-64,6
+63,8
@@
void test(char *graph_file)
if (test_export_length) {
char *buf = NULL;
if (test_export_length) {
char *buf = NULL;
+ double *adj = NULL;
+
INFO0("---- Dumping Edge lengths ----");
adj = xbt_graph_get_length_matrix(graph);
buf = calloc(n * 20, sizeof(char));
INFO0("---- Dumping Edge lengths ----");
adj = xbt_graph_get_length_matrix(graph);
buf = calloc(n * 20, sizeof(char));
@@
-80,6
+81,8
@@
void test(char *graph_file)
if (test_shortest_paths) {
char *buf = NULL;
if (test_shortest_paths) {
char *buf = NULL;
+ xbt_node_t *route = NULL;
+
INFO0("---- Testing Shortest Paths ----");
route = xbt_graph_shortest_paths(graph);
buf = calloc(n * 40, sizeof(char));
INFO0("---- Testing Shortest Paths ----");
route = xbt_graph_shortest_paths(graph);
buf = calloc(n * 40, sizeof(char));
@@
-97,6
+100,8
@@
void test(char *graph_file)
}
if (test_topo_sort) {
}
if (test_topo_sort) {
+ xbt_node_t *sorted = NULL;
+
INFO0("---- Testing Topological Sort ----");
sorted = xbt_graph_topo_sort(graph);
for (i = 0; i < n; i++) {
INFO0("---- Testing Topological Sort ----");
sorted = xbt_graph_topo_sort(graph);
for (i = 0; i < n; i++) {
@@
-118,7
+123,7
@@
void test(char *graph_file)
while (xbt_dynar_length(nodes))
xbt_graph_free_node(graph,
*((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
while (xbt_dynar_length(nodes))
xbt_graph_free_node(graph,
*((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
-
NULL
, NULL);
+
free_label
, NULL);
INFO2("After Node deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
INFO2("After Node deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
@@
-139,7
+144,7
@@
void test(char *graph_file)
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
- xbt_graph_free_graph(graph,
NULL
, NULL, NULL);
+ xbt_graph_free_graph(graph,
free_label
, NULL, NULL);
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {