Skip to content

Commit a771f04

Browse files
Teppo Järvelinadbridge
authored andcommitted
Cellular: fixed unit tests to compile after rebasing to latest.
1 parent 64e8363 commit a771f04

File tree

10 files changed

+83
-12
lines changed

10 files changed

+83
-12
lines changed

features/cellular/UNITTESTS/at/athandler/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ TEST_SRC_FILES = \
2525

2626
include ../../MakefileWorker.mk
2727

28-
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT
28+
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DMBED_CONF_CELLULAR_DEBUG_AT=1
2929

features/cellular/UNITTESTS/at/athandler/athandlertest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ TEST(ATHandler, test_ATHandler_consume_to_stop_tag)
207207
unit->test_ATHandler_consume_to_stop_tag();
208208
}
209209

210-
TEST(ATHandler, test_ATHandler_enable_debug)
210+
TEST(ATHandler, test_ATHandler_set_debug)
211211
{
212-
unit->test_ATHandler_enable_debug();
212+
unit->test_ATHandler_set_debug();
213213
}
214214

215215
TEST(ATHandler, test_ATHandler_get_3gpp_error)

features/cellular/UNITTESTS/at/athandler/test_athandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,15 +778,15 @@ void Test_ATHandler::test_ATHandler_consume_to_stop_tag()
778778
CHECK(at.consume_to_stop_tag());
779779
}
780780

781-
void Test_ATHandler::test_ATHandler_enable_debug()
781+
void Test_ATHandler::test_ATHandler_set_debug()
782782
{
783783
EventQueue que;
784784
FileHandle_stub fh1;
785785

786786
ATHandler at(&fh1, que, 0, ",");
787-
at.enable_debug(true);
787+
at.set_debug(true);
788788

789-
at.enable_debug(false);
789+
at.set_debug(false);
790790
}
791791

792792
void Test_ATHandler::test_ATHandler_get_3gpp_error()

features/cellular/UNITTESTS/at/athandler/test_athandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class Test_ATHandler
9292

9393
void test_ATHandler_consume_to_stop_tag();
9494

95-
void test_ATHandler_enable_debug();
95+
void test_ATHandler_set_debug();
9696

9797
void test_ATHandler_get_3gpp_error();
9898
};

features/cellular/UNITTESTS/stubs/ATHandler_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char
5454
ATHandler_stub::ref_count = 1;
5555
}
5656

57-
void ATHandler::enable_debug(bool enable)
57+
void ATHandler::set_debug(bool debug_on)
5858
{
59-
ATHandler_stub::debug_on = enable;
59+
ATHandler_stub::debug_on = debug_on;
6060
}
6161

6262
ATHandler::~ATHandler()

features/cellular/UNITTESTS/stubs/AT_CellularPower_stub.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@ void AT_CellularPower::remove_device_ready_urc_cb(mbed::Callback<void()> callbac
7474

7575
}
7676

77+
nsapi_error_t AT_CellularPower::is_device_ready()
78+
{
79+
return NSAPI_ERROR_OK;
80+
}

features/cellular/UNITTESTS/stubs/NetworkInterface_stub.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,13 @@ nsapi_error_t NetworkInterface::set_blocking(bool blocking)
7777
return NSAPI_ERROR_UNSUPPORTED;
7878
}
7979

80+
nsapi_value_or_error_t NetworkInterface::gethostbyname_async(char const*, mbed::Callback<void (int, SocketAddress*)>, nsapi_version)
81+
{
82+
return NSAPI_ERROR_UNSUPPORTED;
83+
}
84+
85+
nsapi_error_t NetworkInterface::gethostbyname_async_cancel(int id)
86+
{
87+
return NSAPI_ERROR_UNSUPPORTED;
88+
}
89+

features/cellular/UNITTESTS/stubs/NetworkStack_stub.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "stddef.h"
2222
#include <new>
2323

24-
2524
// Default NetworkStack operations
2625
nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version)
2726
{
@@ -33,6 +32,11 @@ nsapi_error_t NetworkStack::add_dns_server(const SocketAddress &address)
3332
return NSAPI_ERROR_OK;
3433
}
3534

35+
nsapi_error_t NetworkStack::get_dns_server(int index, SocketAddress *address)
36+
{
37+
return NSAPI_ERROR_UNSUPPORTED;
38+
}
39+
3640
nsapi_error_t NetworkStack::setstackopt(int level, int optname, const void *optval, unsigned optlen)
3741
{
3842
return NSAPI_ERROR_UNSUPPORTED;
@@ -64,3 +68,28 @@ NetworkStack *nsapi_create_stack(NetworkStack *stack)
6468
return NULL;
6569
}
6670

71+
nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *host, hostbyname_cb_t callback,
72+
nsapi_version_t version)
73+
{
74+
return NSAPI_ERROR_UNSUPPORTED;
75+
}
76+
77+
nsapi_error_t NetworkStack::gethostbyname_async_cancel(int id)
78+
{
79+
return NSAPI_ERROR_UNSUPPORTED;
80+
}
81+
82+
call_in_callback_cb_t NetworkStack::get_call_in_callback()
83+
{
84+
return NULL;
85+
}
86+
87+
nsapi_error_t NetworkStack::call_in(int delay, mbed::Callback<void()> func)
88+
{
89+
return NSAPI_ERROR_UNSUPPORTED;
90+
}
91+
92+
const char *NetworkStack::get_ip_address()
93+
{
94+
return NULL;
95+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2017, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_
18+
#define MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_
19+
20+
21+
//usage macros:
22+
#define tr_debug(...)
23+
#define tr_info(...)
24+
#define tr_warning(...)
25+
#define tr_warn(...)
26+
#define tr_error(...)
27+
#define tr_err(...)
28+
29+
30+
#endif /* MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_ */

features/cellular/framework/common/CellularLog.h

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

21-
#include "rtos.h"
22-
2321
#if defined(HAVE_DEBUG) && !defined(FEA_TRACE_SUPPORT)
2422
#define FEA_TRACE_SUPPORT
2523
#endif

0 commit comments

Comments
 (0)