- doxygen
[oweals/gnunet.git] / src / ats / test_ats_api_scheduling_update_address.c
index 2f52d64aead49b585997ae7542834bf4e777ecf9..03f7ecfabb17d6a90ed36637a0da2c38deb7fda8 100644 (file)
@@ -128,7 +128,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
       return;
     }
 
-    if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))
+    if ((ats_count != test_ats_count) ||
+               (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 0: Callback with incorrect ats info \n");
       ret = 1;
@@ -141,10 +142,10 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
     test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
     test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN);
     test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
-    test_ats_info[1].value = htonl(3);
-    test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
-    test_ats_info[1].value = htonl(30);
-    test_ats_count = 2;
+    test_ats_info[1].value = htonl(5);
+    test_ats_info[2].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
+    test_ats_info[2].value = htonl(30);
+    test_ats_count = 3;
 
     GNUNET_ATS_address_update (sched_ats, &test_hello_address, test_session, test_ats_info, test_ats_count);
 
@@ -168,7 +169,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
         ret = 1;
       }
 
-      if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))
+      if ((ats_count != test_ats_count) ||
+               (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 1: Callback with incorrect ats info \n");
         ret = 1;
@@ -198,24 +200,13 @@ run (void *cls,
   }
 
   /* Set up peer */
-  if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string(PEERID0, &p.id.hashPubKey))
-  {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not setup peer!\n");
-      ret = GNUNET_SYSERR;
-      end ();
-      return;
-  }
-
-  GNUNET_assert (0 == strcmp (PEERID0, GNUNET_i2s_full (&p.id)));
-
+  memset (&p.id, '1', sizeof (p.id));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n",
               GNUNET_i2s_full(&p.id));
 
   /* Prepare ATS Information */
   test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
   test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN);
-  test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
-  test_ats_info[1].value = htonl(1);
   test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
   test_ats_info[1].value = htonl(10);
   test_ats_count = 2;