Fix test cases

This commit is contained in:
Erik Ekman 2009-09-20 21:10:45 +00:00 committed by Erik Ekman
parent 3c48602747
commit 85104a4088
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,7 @@ START_TEST(test_users_waiting)
fail_unless(users_waiting_on_reply() == 0); fail_unless(users_waiting_on_reply() == 0);
users[3].conn = CONN_DNS_NULL;
users[3].q.id = 1; users[3].q.id = 1;
fail_unless(users_waiting_on_reply() == 1); fail_unless(users_waiting_on_reply() == 1);
@ -76,6 +77,7 @@ START_TEST(test_find_user_by_ip)
ip = inet_addr("127.0.0.1"); ip = inet_addr("127.0.0.1");
init_users(ip, 27); init_users(ip, 27);
users[0].conn = CONN_DNS_NULL;
testip = (unsigned int) inet_addr("10.0.0.1"); testip = (unsigned int) inet_addr("10.0.0.1");
fail_unless(find_user_by_ip(testip) == -1); fail_unless(find_user_by_ip(testip) == -1);
@ -104,15 +106,21 @@ START_TEST(test_all_users_waiting_to_send)
fail_unless(all_users_waiting_to_send() == 1); fail_unless(all_users_waiting_to_send() == 1);
users[0].conn = CONN_DNS_NULL;
users[0].active = 1; users[0].active = 1;
fail_unless(all_users_waiting_to_send() == 1); fail_unless(all_users_waiting_to_send() == 1);
users[0].last_pkt = time(NULL); users[0].last_pkt = time(NULL);
users[0].outpacket.len = 0;
fail_unless(all_users_waiting_to_send() == 0); fail_unless(all_users_waiting_to_send() == 0);
#ifdef OUTPACKETQ_LEN
users[0].outpacketq_filled = 1;
#else
users[0].outpacket.len = 44; users[0].outpacket.len = 44;
#endif
fail_unless(all_users_waiting_to_send() == 1); fail_unless(all_users_waiting_to_send() == 1);
} }