Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : update tests for snapshot comparison
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 30 Jul 2012 14:17:15 +0000 (16:17 +0200)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 30 Jul 2012 19:37:06 +0000 (21:37 +0200)
src/mc/test/compare_snapshot.c

index 59d2e64..b97a629 100644 (file)
@@ -21,11 +21,11 @@ static void test1()
   mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1);
   MC_take_snapshot_liveness(snapshot2);
 
-  MC_UNSET_RAW_MEM;
-
   int res = snapshot_compare(snapshot1, snapshot2);
   xbt_assert(res == 0);
 
+  MC_UNSET_RAW_MEM;
+
   fprintf(stderr, "\n**************** END TEST 1 ****************\n");
 
   MC_SET_RAW_MEM;
@@ -49,7 +49,7 @@ static void test2()
 
   MC_UNSET_RAW_MEM;
 
-  char* t = strdup("toto");
+  char* t = malloc(5);
 
   MC_SET_RAW_MEM;
 
@@ -87,7 +87,7 @@ static void test3()
 
   MC_UNSET_RAW_MEM;
 
-  char *t = strdup("toto");;
+  char *t = malloc(5);
   free(t);
 
   MC_SET_RAW_MEM;
@@ -116,7 +116,7 @@ static void test4()
 
   fprintf(stderr, "\n**************** TEST 4 ****************\n\n");
 
-  char *t = strdup("toto");
+  char *t = malloc(5);
 
   MC_SET_RAW_MEM;
 
@@ -238,6 +238,9 @@ void MC_test_snapshot_comparison(){
   MC_UNSET_RAW_MEM;
 
   test1();
+
+  MC_restore_snapshot(initial);
+  MC_UNSET_RAW_MEM;
   
   test2();
   
@@ -260,4 +263,7 @@ void MC_test_snapshot_comparison(){
   MC_UNSET_RAW_MEM;
   
   test6();
+
+  MC_restore_snapshot(initial);
+  MC_UNSET_RAW_MEM;
 }