X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6ee7e9c2e455536ab817ae0136acfbb53822eecd..51f0b3ebf52e6b7c6422e0be68bfc7a8cf732eb3:/testsuite/surf/lmm_usage.c diff --git a/testsuite/surf/lmm_usage.c b/testsuite/surf/lmm_usage.c index e6c60cf9b0..37bb41e52b 100644 --- a/testsuite/surf/lmm_usage.c +++ b/testsuite/surf/lmm_usage.c @@ -31,7 +31,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, typedef enum { MAXMIN, LAGRANGE_RENO, - LAGRANGE_VEGAS, + LAGRANGE_VEGAS } method_t; static double dichotomy(double func(double), double min, double max, @@ -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); @@ -221,7 +221,7 @@ void test1(method_t method) a - x, lmm_variable_getvalue(R_1_2_3) - (a - x)); } } else { - xbt_assert0(0, "Invalid method"); + xbt_die( "Invalid method"); } PRINT_VAR(R_1_2_3); @@ -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); @@ -273,12 +277,14 @@ void test2(method_t method) } else if (method == LAGRANGE_RENO) { lagrange_solve(Sys); } else { - xbt_assert0(0, "Invalid method"); + xbt_die("Invalid 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); @@ -445,17 +450,24 @@ void test3(method_t method) } else if (method == LAGRANGE_RENO) { lagrange_solve(Sys); } else { - xbt_assert0(0, "Invalid method"); + xbt_die("Invalid method"); } for (j = 0; j < 16; j++) { 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__