X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fats%2Ftest_ats_api_scheduling_update_address.c;h=03f7ecfabb17d6a90ed36637a0da2c38deb7fda8;hb=056f559d916d785164f40e63ca56c153ea0e9ebe;hp=0801e6eba489a5887b9444ebc8051aaa53c7712f;hpb=569cc456f08e53be0723236cb925cf3bcd67c5fd;p=oweals%2Fgnunet.git diff --git a/src/ats/test_ats_api_scheduling_update_address.c b/src/ats/test_ats_api_scheduling_update_address.c index 0801e6eba..03f7ecfab 100644 --- a/src/ats/test_ats_api_scheduling_update_address.c +++ b/src/ats/test_ats_api_scheduling_update_address.c @@ -26,7 +26,7 @@ */ #include "platform.h" #include "gnunet_ats_service.h" -#include "gnunet_testing_lib-new.h" +#include "gnunet_testing_lib.h" #include "ats.h" #include "test_ats_api_common.h" @@ -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;