Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge back the master trunk into the smpi branch
[simgrid.git] / testsuite / surf / lmm_usage.c
index 2c97818..61b3ad7 100644 (file)
@@ -122,7 +122,7 @@ void test1(method_t method)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fpi,
                                       func_reno_fpi);
 
-  Sys = lmm_system_new();
+  Sys = lmm_system_new(1);
   L1 = lmm_constraint_new(Sys, (void *) "L1", a);
   L2 = lmm_constraint_new(Sys, (void *) "L2", b);
   L3 = lmm_constraint_new(Sys, (void *) "L3", a);
@@ -229,6 +229,10 @@ void test1(method_t method)
   PRINT_VAR(R_2);
   PRINT_VAR(R_3);
 
+  lmm_variable_free(Sys, R_1_2_3);
+  lmm_variable_free(Sys, R_1);
+  lmm_variable_free(Sys, R_2);
+  lmm_variable_free(Sys, R_3);
   lmm_system_free(Sys);
 }
 
@@ -250,7 +254,7 @@ void test2(method_t method)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
                                       func_reno_fpi);
 
-  Sys = lmm_system_new();
+  Sys = lmm_system_new(1);
   CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
   CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0);
 
@@ -279,6 +283,8 @@ void test2(method_t method)
   PRINT_VAR(T1);
   PRINT_VAR(T2);
 
+  lmm_variable_free(Sys, T1);
+  lmm_variable_free(Sys, T2);
   lmm_system_free(Sys);
 }
 
@@ -307,7 +313,6 @@ void test3(method_t method)
     1, 1, 1, 1, 1
   };
 
-  /*A = xbt_new0(double*, links + 5); */
   A = xbt_new0(double *, links + 5);
 
   for (i = 0; i < links + 5; i++) {
@@ -398,7 +403,7 @@ void test3(method_t method)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
                                       func_reno_fpi);
 
-  Sys = lmm_system_new();
+  Sys = lmm_system_new(1);
 
 
 
@@ -452,10 +457,17 @@ void test3(method_t method)
     PRINT_VAR(tmp_var[j]);
   }
 
-  free(tmp_var);
-  free(tmp_cnst);
-  free(tmp_name);
+  for (j = 0; j < 16; j++)
+    lmm_variable_free(Sys, tmp_var[j]);
+  xbt_free(tmp_var);
+  xbt_free(tmp_cnst);
+  for (i = 0; i < 31; i++)
+    xbt_free(tmp_name[i]);
+  xbt_free(tmp_name);
   lmm_system_free(Sys);
+  for (i = 0; i < links + 5; i++)
+    xbt_free(A[i]);
+  xbt_free(A);
 }
 
 #ifdef __BORLANDC__