1 /* Computation tests */
3 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "simdag/simdag.h"
15 * This test checks if the reinitialization of
16 * surf works properly.
17 * 1 test: empty task, reinit, empty task
18 * 2 test: comm cost task, reinit, empty task
25 static SD_task_t create_empty_cost_root()
27 double no_cost[] = { 0.0 };
30 root = SD_task_create("Root", NULL, 1.0);
31 SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost,
37 static void zero_cost_test(int *argc, char *argv[])
44 SD_create_environment(argv[1]);
46 task = create_empty_cost_root();
47 ret = SD_simulate(-1.0);
49 SD_task_destroy(task);
51 SD_application_reinit();
53 task = create_empty_cost_root();
54 ret = SD_simulate(-1.0);
56 SD_task_destroy(task);
58 ret = SD_simulate(-1.0);
61 time = SD_get_clock();
68 static SD_task_t create_root_with_costs()
70 double comp_cost[] = { 0.0, 0.0 };
71 double comm_cost[] = { 0.0, 1.0, 0.0, 0.0 };
74 root = SD_task_create("Root", NULL, 1.0);
75 SD_task_schedule(root, 2, SD_workstation_get_list(), comp_cost,
81 static void zero_cost_test2(int *argc, char *argv[])
88 SD_create_environment(argv[1]);
90 task = create_root_with_costs();
91 ret = SD_simulate(-1.0);
93 SD_task_destroy(task);
95 SD_application_reinit();
97 task = create_empty_cost_root();
98 ret = SD_simulate(-1.0);
100 SD_task_destroy(task);
102 ret = SD_simulate(-1.0);
103 xbt_dynar_free(&ret);
105 time = SD_get_clock();
106 printf("%g\n", time);
112 int main(int argc, char **argv)
115 zero_cost_test(&argc, argv);
117 zero_cost_test2(&argc, argv);