tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / util / test_container_bloomfilter.c
index c14adb0755373eee3dca9d28b318edea6951664e..42849af97114007c9c7f287ca5ad4e74e9b96282 100644 (file)
@@ -1,21 +1,21 @@
 /*
      This file is part of GNUnet.
-     (C) 2004, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2004, 2009 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /**
  * @file util/test_container_bloomfilter.c
@@ -25,8 +25,7 @@
  */
 
 #include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
 
 #define K 4
 #define SIZE 65536
  * Generate a random hashcode.
  */
 static void
-nextHC (GNUNET_HashCode * hc)
+nextHC (struct GNUNET_HashCode * hc)
 {
   GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc);
 }
 
 static int
-add_iterator (void *cls, GNUNET_HashCode * next)
+add_iterator (void *cls, struct GNUNET_HashCode * next)
 {
   int *ret = cls;
-  GNUNET_HashCode pos;
+  struct GNUNET_HashCode pos;
 
   if (0 == (*ret)--)
     return GNUNET_NO;
@@ -59,7 +58,7 @@ main (int argc, char *argv[])
 {
   struct GNUNET_CONTAINER_BloomFilter *bf;
   struct GNUNET_CONTAINER_BloomFilter *bfi;
-  GNUNET_HashCode tmp;
+  struct GNUNET_HashCode tmp;
   int i;
   int ok1;
   int ok2;
@@ -68,8 +67,8 @@ main (int argc, char *argv[])
   struct stat sbuf;
 
   GNUNET_log_setup ("test-container-bloomfilter", "WARNING", NULL);
-  SRANDOM (1);
-  if (0 == stat (TESTFILE, &sbuf))
+  GNUNET_CRYPTO_seed_weak_random (1);
+  if (0 == STAT (TESTFILE, &sbuf))
     if (0 != UNLINK (TESTFILE))
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", TESTFILE);
   bf = GNUNET_CONTAINER_bloomfilter_load (TESTFILE, SIZE, K);
@@ -79,7 +78,7 @@ main (int argc, char *argv[])
     nextHC (&tmp);
     GNUNET_CONTAINER_bloomfilter_add (bf, &tmp);
   }
-  SRANDOM (1);
+  GNUNET_CRYPTO_seed_weak_random (1);
   ok1 = 0;
   for (i = 0; i < 200; i++)
   {
@@ -106,7 +105,7 @@ main (int argc, char *argv[])
   bfi = GNUNET_CONTAINER_bloomfilter_init (buf, SIZE, K);
   GNUNET_assert (bfi != NULL);
 
-  SRANDOM (1);
+  GNUNET_CRYPTO_seed_weak_random (1);
   ok1 = 0;
   ok2 = 0;
   for (i = 0; i < 200; i++)
@@ -134,7 +133,7 @@ main (int argc, char *argv[])
     return -1;
   }
 
-  SRANDOM (1);
+  GNUNET_CRYPTO_seed_weak_random (1);
   for (i = 0; i < 100; i++)
   {
     nextHC (&tmp);
@@ -142,7 +141,7 @@ main (int argc, char *argv[])
     GNUNET_CONTAINER_bloomfilter_remove (bfi, &tmp);
   }
 
-  SRANDOM (1);
+  GNUNET_CRYPTO_seed_weak_random (1);
 
   ok1 = 0;
   ok2 = 0;
@@ -174,7 +173,7 @@ main (int argc, char *argv[])
     return -1;
   }
 
-  SRANDOM (3);
+  GNUNET_CRYPTO_seed_weak_random (3);
 
   GNUNET_CONTAINER_bloomfilter_clear (bf);
   falseok = 0;
@@ -198,14 +197,14 @@ main (int argc, char *argv[])
     return -1;
   }
 
-  SRANDOM (2);
+  GNUNET_CRYPTO_seed_weak_random (2);
   i = 20;
   GNUNET_CONTAINER_bloomfilter_resize (bfi, &add_iterator, &i, SIZE * 2, K);
 
-  SRANDOM (2);
+  GNUNET_CRYPTO_seed_weak_random (2);
   i = 20;
   GNUNET_CONTAINER_bloomfilter_resize (bf, &add_iterator, &i, SIZE * 2, K);
-  SRANDOM (2);
+  GNUNET_CRYPTO_seed_weak_random (2);
 
   ok1 = 0;
   ok2 = 0;