Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use C++ style includes when available.
[simgrid.git] / teshsuite / xbt / mmalloc / mmalloc_test.cpp
index c5706b6fd536cc02778e57b1fa859a950827ef01..569c756796851af155a46c47914ddca465aee4e9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014. The SimGrid Team.
+/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,14 +6,16 @@
 
 #include "xbt/mmalloc.h"
 #include "xbt.h"
-#include <stdio.h>
-#include <assert.h>
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <xbt/ex.hpp>
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(test,"this test");
 
 #define BUFFSIZE 204800
@@ -38,7 +40,8 @@ int main(int argc, char**argv)
 
   XBT_INFO("HeapA allocated");
 
-  int i, size;
+  int i;
+  int size;
   for (i = 0; i < TESTSIZE; i++) {
     size = size_of_block(i);
     pointers[i] = mmalloc(heapA, size);
@@ -68,7 +71,7 @@ int main(int argc, char**argv)
     } catch(xbt_ex& e) {
       gotit = true;
     }
-    if (!gotit)
+    if (not gotit)
       xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
   }
 
@@ -80,7 +83,7 @@ int main(int argc, char**argv)
     } catch(xbt_ex& e) {
       gotit = true;
     }
-    if (!gotit)
+    if (not gotit)
       xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
   }