Eliminate compiler warnings in tests

This commit is contained in:
Willem Toorop 2021-05-26 15:44:24 +02:00
parent 1184f2b8ea
commit df2997d9b7
8 changed files with 18 additions and 18 deletions

View File

@ -466,23 +466,23 @@
callback_canceled++;
ck_assert_msg(transaction_id % 2,
"Only callbacks with odd transaction_ids were canceled, this one is even: %d",
transaction_id);
(int)transaction_id);
}
else if(callback_type == GETDNS_CALLBACK_COMPLETE)
{
callback_completed++;
ck_assert_msg((transaction_id % 2) == 0,
"One callbacks with even transaction_ids should complete, this one is odd: %d",
transaction_id);
(int)transaction_id);
}
else
{
if(transaction_id % 2)
ck_abort_msg("callback_type should == GETDNS_CALLBACK_CANCEL for odd transaction_id (%d), got: %d",
transaction_id, callback_type);
(int)transaction_id, (int)callback_type);
else
ck_abort_msg("callback_type should == GETDNS_CALLBACK_COMPLETE for even transaction_id (%d), got %d",
transaction_id, callback_type);
(int)transaction_id, (int)callback_type);
}
}

View File

@ -196,7 +196,7 @@ void assert_nodata(struct extracted_response *ex_response)
ASSERT_RC(getdns_list_get_length(ex_response->answer, &length),
GETDNS_RETURN_GOOD, "Failed to extract \"answer\" length");
ck_assert_msg(length == 0, "Expected \"answer\" length == 0, got %d", length);
ck_assert_msg(length == 0, "Expected \"answer\" length == 0, got %d", (int)length);
ASSERT_RC(ex_response->status, GETDNS_RESPSTATUS_NO_NAME, "Unexpected value for \"status\"");
}
@ -222,7 +222,7 @@ void assert_address_in_answer(struct extracted_response *ex_response, int a, int
ASSERT_RC(getdns_list_get_length(ex_response->answer, &length),
GETDNS_RETURN_GOOD, "Failed to extract \"answer\" length");
ck_assert_msg(length == ancount, "Expected \"answer\" length == ancount: %d, got %d", ancount, length);
ck_assert_msg(length == ancount, "Expected \"answer\" length == ancount: %d, got %d", (int)ancount, (int)length);
for(i = 0; i < length; i++)
{
@ -257,7 +257,7 @@ void assert_address_in_just_address_answers(struct extracted_response *ex_respon
GETDNS_RETURN_GOOD, "Failed to extract \"just_address_answers\" length");
if (length == 0) resp_str = getdns_pretty_print_dict(ex_response->response);
ck_assert_msg(length > 0, "Expected \"just_address_answers\" length > 0, got %d\n%s", length, resp_str);
ck_assert_msg(length > 0, "Expected \"just_address_answers\" length > 0, got %d\n%s", (int)length, resp_str);
if (length == 0) free(resp_str);
}
@ -294,7 +294,7 @@ void assert_soa_in_authority(struct extracted_response *ex_response)
ASSERT_RC(getdns_list_get_length(ex_response->authority, &length),
GETDNS_RETURN_GOOD, "Failed to extract \"authority\" length");
ck_assert_msg(length == nscount, "Expected \"authority\" length == nscount: %d, got %d", nscount, length);
ck_assert_msg(length == nscount, "Expected \"authority\" length == nscount: %d, got %d", (int)nscount, (int)length);
for(i = 0; i < length; i++)
{
@ -328,7 +328,7 @@ void assert_ptr_in_answer(struct extracted_response *ex_response)
ASSERT_RC(getdns_list_get_length(ex_response->answer, &length),
GETDNS_RETURN_GOOD, "Failed to extract \"answer\" length");
ck_assert_msg(length == ancount, "Expected \"answer\" length == ancount: %d, got %d", ancount, length);
ck_assert_msg(length == ancount, "Expected \"answer\" length == ancount: %d, got %d", (int)ancount, (int)length);
for(i = 0; i < length; i++)
{

View File

@ -44,7 +44,7 @@
char *alabel = NULL;
ck_assert_msg( getdns_convert_alabel_to_ulabel( alabel ) == 0,
"Was not expecting %d from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) );
"Was not expecting %p from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) );
}
END_TEST

View File

@ -45,7 +45,7 @@
ck_assert_msg(( getdns_convert_ulabel_to_alabel( ulabel ) == 0 ),
"Was not expecting %d from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) );
"Was not expecting %p from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) );
}
END_TEST

View File

@ -161,7 +161,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_get_bindata()");
ck_assert_msg(answer->size == bindata.size, "Expected bindata size == %d, got: %d",
bindata.size, answer->size);
(int)bindata.size, (int)answer->size);
ck_assert_msg(strcmp((char *)answer->data, (char *)bindata.data) == 0,
"Expected bindata data to be \"%s\", got: \"%s\"",
(char *)bindata.data, (char *)answer->data);

View File

@ -98,7 +98,7 @@
ASSERT_RC(getdns_list_get_length(answer, &length),
GETDNS_RETURN_GOOD, "Return code from getdns_list_get_length()");
ck_assert_msg(length == 3, "Expected length == 3, got %d", length);
ck_assert_msg(length == 3, "Expected length == 3, got %d", (int)length);
for(i = 0; i < length; i++)
{

View File

@ -112,9 +112,9 @@
ASSERT_RC(getdns_dict_get_bindata(this_dict, "bindata", &retrieved_bindata),
GETDNS_RETURN_GOOD, "Return code from getdns_dict_get_bindata()");
ck_assert_msg(retrieved_bindata->size, second_bindata.size,
ck_assert_msg(retrieved_bindata->size == second_bindata.size,
"Expected retrieved bindata size == %d, got: %d",
second_bindata.size, retrieved_bindata->size);
(int)second_bindata.size, (int)retrieved_bindata->size);
ck_assert_msg(strcmp((char *)retrieved_bindata->data, (char *)second_bindata.data) == 0,
"Expected retrieved bindata to be \"%s\", got: \"%s\"",
@ -152,7 +152,7 @@
ck_assert_msg(retrieved_bindata->size == bindata.size,
"Expected retrieved bindata size == %d, got: %d",
bindata.size, retrieved_bindata->size);
(int)bindata.size, (int)retrieved_bindata->size);
ck_assert_msg(strcmp((char *)retrieved_bindata->data, (char *)bindata.data) == 0,
"Expected bindata data to be \"%s\", got: \"%s\"",

View File

@ -89,7 +89,7 @@
ASSERT_RC(getdns_list_get_length(list, &length),
GETDNS_RETURN_GOOD, "Return code from getdns_list_get_length()");
ck_assert_msg(length == 3, "Expected length == 3, got %d", length);
ck_assert_msg(length == 3, "Expected length == 3, got %d", (int)length);
LIST_DESTROY(list);
}
@ -110,7 +110,7 @@
ASSERT_RC(getdns_list_get_length(list, &length),
GETDNS_RETURN_GOOD, "Return code from getdns_list_get_length()");
ck_assert_msg(length == 0, "Expected length == 3, got %d", length);
ck_assert_msg(length == 0, "Expected length == 3, got %d", (int)length);
LIST_DESTROY(list);
}