Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve a bit the test on searching non-existant data
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 22 Aug 2006 15:27:47 +0000 (15:27 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 22 Aug 2006 15:27:47 +0000 (15:27 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2722 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/dict.c

index 6d788f0..8f2a80f 100644 (file)
@@ -517,18 +517,21 @@ static void traverse(xbt_dict_t head) {
 }
 
 static void search_not_found(xbt_dict_t head, const char *data) {
 }
 
 static void search_not_found(xbt_dict_t head, const char *data) {
+  int ok=0;
   xbt_ex_t e;
 
   xbt_test_add1("Search %s (expected not to be found)",data);
 
   TRY {    
   xbt_ex_t e;
 
   xbt_test_add1("Search %s (expected not to be found)",data);
 
   TRY {    
-    data = xbt_dict_get(head,"Can't be found");
+    data = xbt_dict_get(head, data);
     THROW1(unknown_error,0,"Found something which shouldn't be there (%s)",data);
   } CATCH(e) {
     if (e.category != not_found_error) 
       xbt_test_exception(e);
     xbt_ex_free(e);
     THROW1(unknown_error,0,"Found something which shouldn't be there (%s)",data);
   } CATCH(e) {
     if (e.category != not_found_error) 
       xbt_test_exception(e);
     xbt_ex_free(e);
+    ok=1;
   }
   }
+  xbt_test_assert0(ok,"Exception not raised");
 }
 
 static void count(xbt_dict_t dict, int length) {
 }
 
 static void count(xbt_dict_t dict, int length) {