Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Taking into account an old behavior modification of surf_solve
[simgrid.git] / testsuite / xbt / multidict_crash.c
index 0f7e5f0..0663563 100644 (file)
@@ -2,16 +2,14 @@
 
 /* multidict_crash - A crash test for multi-level dictionnaries             */
 
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2003 the OURAGAN project.                                  */
+/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
 
 /* This program is free software; you can redistribute it and/or modify it
  under the terms of the license (GNU LGPL) which comes with this package. */
* under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include <assert.h>
 
-#include <gras.h>
+#include "gras.h"
 
 #define NB_ELM 10/*00*/
 #define MULTICACHE_DEPTH 5
 #define NB_TEST 20
 int verbose=0;
 
-static gras_error_t test1();
+static xbt_error_t test1();
 
-static gras_error_t test1() {
-  gras_error_t errcode;
-  gras_dict_t *head=NULL;
+static xbt_error_t test1() {
+  xbt_error_t errcode;
+  xbt_dict_t *head=NULL;
   int i,j,k,l;
   char **key = NULL;
   char **val = NULL;
@@ -51,23 +49,23 @@ static gras_error_t test1() {
        }
        val[l][k]='\0';
        if (verbose) printf("%s ; ",val[l]);
-       key[l]=val[l];//  NOWADAYS, no need to strdup the key.
+       key[l]=val[l];/*  NOWADAYS, no need to strdup the key. */
       }
       if (verbose) printf("in multitree %p.\n",head);
-      TRYFAIL(gras_multidict_insert(&head,MULTICACHE_DEPTH,key,
-                                   strdup(val[0]),&free));
+      TRYFAIL(xbt_multidict_set(&head,MULTICACHE_DEPTH,key,
+                                strdup(val[0]),&free));
 
-      TRYFAIL(gras_multidict_retrieve(head,
-                                     MULTICACHE_DEPTH,(const char **)val,
-                                     &data));
+      TRYFAIL(xbt_multidict_get(head,
+                                MULTICACHE_DEPTH,(const char **)val,
+                                &data));
       if (!data || strcmp((char*)data,val[0])) {
        fprintf(stderr,"Retrieved value (%s) does not match the entrered one (%s)\n",
                (char*)data,val[0]);
        abort();
       }
     }
-    gras_dict_dump(head,&gras_dict_print);
-    gras_dict_free(&head);
+    xbt_dict_dump(head,&xbt_dict_print);
+    xbt_dict_free(&head);
 
     for (l=0 ; l<MULTICACHE_DEPTH ; l++)
       if (val[l]) free(val[l]);
@@ -80,18 +78,12 @@ static gras_error_t test1() {
   return no_error;
 }
 
-int main() {
-  gras_error_t errcode;
-
-  TRY(gras_log_control_set("root.thresh=debug"));
-  /*
-  //DirectDiagnostics(DIAGDEBUG, stdout);
-  DirectDiagnostics(DIAGINFO, stdout);
-  //  DirectDiagnostics(DIAGLOG, stdout);
-  DirectDiagnostics(DIAGWARN, stderr);
-  DirectDiagnostics(DIAGERROR, stderr);
-  DirectDiagnostics(DIAGFATAL, stderr);
-  */
+int main(int argc, char *argv[]) {
+  xbt_error_t errcode;
+
+  xbt_init(argc,argv,"root.thresh=debug"));
   TRYFAIL(test1());
+   
+  xbt_exit();
   return 0;
 }