adding more get functions to the tests

This commit is contained in:
Hoda Rohani 2017-05-10 16:47:51 +02:00
parent 6ec0f2e021
commit 053845332d
3 changed files with 21 additions and 2 deletions

View File

@ -55,9 +55,13 @@
* GETDNS_RETURN_GOOD
*/
struct getdns_context *context = NULL;
getdns_append_name_t append_name;
CONTEXT_CREATE(TRUE);
// TODO: Do something here to verify set_from_os = TRUE
getdns_context_set_append_name(context, GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST);
getdns_context_get_append_name(context, &append_name);
ck_assert_msg(append_name == GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST, "suffix is not correct");
CONTEXT_DESTROY;
}
END_TEST

View File

@ -111,6 +111,8 @@
*/
struct getdns_context *context = NULL;
getdns_namespace_t namespace_arr[2] = {GETDNS_NAMESPACE_DNS, GETDNS_NAMESPACE_LOCALNAMES};
size_t count;
getdns_namespace_t *namespaces;
CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
@ -118,8 +120,12 @@
expected_changed_item = GETDNS_CONTEXT_CODE_NAMESPACES;
ASSERT_RC(getdns_context_set_namespaces(context, 2,namespace_arr),
ASSERT_RC(getdns_context_set_namespaces(context, 2, namespace_arr),
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_namespaces()");
ASSERT_RC(getdns_context_get_namespaces(context, &count, &namespaces),
GETDNS_RETURN_GOOD, "Return code from getdns_context_get_namespaces()");
ck_assert_msg(count == 2 && namespaces[0] == 500 && namespaces[1] == 501, "namespaces are not correctly set");
CONTEXT_DESTROY;
@ -207,6 +213,7 @@
* expect: GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS
*/
struct getdns_context *context = NULL;
getdns_redirects_t redir;
CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
@ -215,6 +222,8 @@
expected_changed_item = GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS;
(void) getdns_context_set_follow_redirects(context, GETDNS_REDIRECTS_DO_NOT_FOLLOW);
(void) getdns_context_get_follow_redirects(context, &redir);
ck_assert_msg(redir == GETDNS_REDIRECTS_DO_NOT_FOLLOW, "getdns_context_get_follow_redirects failed");
CONTEXT_DESTROY;

View File

@ -94,15 +94,21 @@ END_TEST
START_TEST (getdns_context_set_idle_timeout_2)
{
/*
* timeout is 0
* timeout is 0 and then 100
* expect: GETDNS_RETURN_GOOD
*/
struct getdns_context *context = NULL;
uint64_t time;
CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_context_set_idle_timeout(context, 0),
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_timeout()");
ASSERT_RC(getdns_context_set_idle_timeout(context, 100),
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_timeout()");
ASSERT_RC(getdns_context_get_idle_timeout(context, &time),
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_timeout()");
ck_assert_msg(time == 100, "idle_timeout should be 100, got %d", (int)time);
CONTEXT_DESTROY;