Skip to content

Commit f26074c

Browse files
author
Antti Kauppila
committed
Added missing include + cleaned up some tests
1 parent 6adc244 commit f26074c

File tree

5 files changed

+5
-22
lines changed

5 files changed

+5
-22
lines changed

TESTS/netsocket/dns/asynchronous_dns_external_event_queue.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,7 @@ static nsapi_error_t event_queue_call(int delay, mbed::Callback<void()> func)
5353

5454
void ASYNCHRONOUS_DNS_EXTERNAL_EVENT_QUEUE()
5555
{
56-
// Ensures that cache does not contain entries
5756
nsapi_dns_reset();
58-
do_asynchronous_gethostbyname(dns_test_hosts, MBED_CONF_NSAPI_DNS_CACHE_SIZE, &result_ok, &result_no_mem,
59-
&result_dns_failure, &result_exp_timeout);
60-
61-
TEST_ASSERT_EQUAL(MBED_CONF_NSAPI_DNS_CACHE_SIZE, result_ok);
62-
TEST_ASSERT_EQUAL(0, result_no_mem);
63-
TEST_ASSERT_EQUAL(0, result_dns_failure);
64-
TEST_ASSERT_EQUAL(0, result_exp_timeout);
6557

6658
// Dispatch event queue
6759
Thread eventThread(osPriorityNormal, EXTERNAL_THREAD_SIZE);

TESTS/netsocket/dns/asynchronous_dns_invalid_host.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ int result_exp_timeout;
3232

3333
void ASYNCHRONOUS_DNS_INVALID_HOST()
3434
{
35-
// Ensures that cache does not contain entries
3635
nsapi_dns_reset();
37-
do_asynchronous_gethostbyname(dns_test_hosts_second, MBED_CONF_NSAPI_DNS_CACHE_SIZE, &result_ok, &result_no_mem,
38-
&result_dns_failure, &result_exp_timeout);
3936

4037
char dns_test_hosts_new[MBED_CONF_APP_DNS_TEST_HOSTS_NUM][DNS_TEST_HOST_LEN];
4138
memcpy(dns_test_hosts_new, dns_test_hosts, sizeof(dns_test_hosts_new));

TESTS/netsocket/dns/asynchronous_dns_simultaneous_cache.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ void ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE()
3636
do_asynchronous_gethostbyname(dns_test_hosts_second, MBED_CONF_APP_DNS_SIMULT_QUERIES + 1, &result_ok, &result_no_mem,
3737
&result_dns_failure, &result_exp_timeout);
3838

39-
// Addresses were cached on last step, OK for all
40-
TEST_ASSERT_EQUAL(MBED_CONF_APP_DNS_SIMULT_QUERIES + 1, result_ok);
41-
TEST_ASSERT_EQUAL(0, result_no_mem);
39+
// As cache is empty, 6th entry will return out of memory.
40+
TEST_ASSERT_EQUAL(MBED_CONF_APP_DNS_SIMULT_QUERIES, result_ok);
41+
TEST_ASSERT_EQUAL(1, result_no_mem);
4242
TEST_ASSERT_EQUAL(0, result_dns_failure);
4343
TEST_ASSERT_EQUAL(0, result_exp_timeout);
4444
}

TESTS/netsocket/dns/asynchronous_dns_timeouts.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@ static nsapi_error_t event_queue_call(int delay, mbed::Callback<void()> func)
4949

5050
void ASYNCHRONOUS_DNS_TIMEOUTS()
5151
{
52-
// Ensures that cache does not contain entries
5352
nsapi_dns_reset();
54-
do_asynchronous_gethostbyname(dns_test_hosts, MBED_CONF_NSAPI_DNS_CACHE_SIZE, &result_ok, &result_no_mem,
55-
&result_dns_failure, &result_exp_timeout);
56-
57-
TEST_ASSERT_EQUAL(MBED_CONF_NSAPI_DNS_CACHE_SIZE, result_ok);
58-
TEST_ASSERT_EQUAL(0, result_no_mem);
59-
TEST_ASSERT_EQUAL(0, result_dns_failure);
60-
TEST_ASSERT_EQUAL(0, result_exp_timeout);
6153

6254
// Dispatch event queue
6355
Thread eventThread(osPriorityNormal, EXTERNAL_THREAD_SIZE);

TESTS/netsocket/dns/dns_tests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#ifndef DNS_TESTS_H
1919
#define DNS_TESTS_H
2020

21+
#include "nsapi_dns.h"
22+
2123
#ifndef MBED_CONF_APP_DNS_SIMULT_QUERIES
2224
#ifdef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
2325
#define MBED_CONF_APP_DNS_SIMULT_QUERIES MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES

0 commit comments

Comments
 (0)