Cellular: fixed unit tests to compile after rebasing to latest.

pull/7102/head
Teppo Järvelin 2018-06-04 13:27:50 +03:00
parent 3311a6e456
commit 9a3c3b531f
10 changed files with 83 additions and 12 deletions

View File

@ -25,5 +25,5 @@ TEST_SRC_FILES = \
include ../../MakefileWorker.mk
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DMBED_CONF_CELLULAR_DEBUG_AT=1

View File

@ -207,9 +207,9 @@ TEST(ATHandler, test_ATHandler_consume_to_stop_tag)
unit->test_ATHandler_consume_to_stop_tag();
}
TEST(ATHandler, test_ATHandler_enable_debug)
TEST(ATHandler, test_ATHandler_set_debug)
{
unit->test_ATHandler_enable_debug();
unit->test_ATHandler_set_debug();
}
TEST(ATHandler, test_ATHandler_get_3gpp_error)

View File

@ -778,15 +778,15 @@ void Test_ATHandler::test_ATHandler_consume_to_stop_tag()
CHECK(at.consume_to_stop_tag());
}
void Test_ATHandler::test_ATHandler_enable_debug()
void Test_ATHandler::test_ATHandler_set_debug()
{
EventQueue que;
FileHandle_stub fh1;
ATHandler at(&fh1, que, 0, ",");
at.enable_debug(true);
at.set_debug(true);
at.enable_debug(false);
at.set_debug(false);
}
void Test_ATHandler::test_ATHandler_get_3gpp_error()

View File

@ -92,7 +92,7 @@ public:
void test_ATHandler_consume_to_stop_tag();
void test_ATHandler_enable_debug();
void test_ATHandler_set_debug();
void test_ATHandler_get_3gpp_error();
};

View File

@ -54,9 +54,9 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char
ATHandler_stub::ref_count = 1;
}
void ATHandler::enable_debug(bool enable)
void ATHandler::set_debug(bool debug_on)
{
ATHandler_stub::debug_on = enable;
ATHandler_stub::debug_on = debug_on;
}
ATHandler::~ATHandler()

View File

@ -74,3 +74,7 @@ void AT_CellularPower::remove_device_ready_urc_cb(mbed::Callback<void()> callbac
}
nsapi_error_t AT_CellularPower::is_device_ready()
{
return NSAPI_ERROR_OK;
}

View File

@ -77,3 +77,13 @@ nsapi_error_t NetworkInterface::set_blocking(bool blocking)
return NSAPI_ERROR_UNSUPPORTED;
}
nsapi_value_or_error_t NetworkInterface::gethostbyname_async(char const*, mbed::Callback<void (int, SocketAddress*)>, nsapi_version)
{
return NSAPI_ERROR_UNSUPPORTED;
}
nsapi_error_t NetworkInterface::gethostbyname_async_cancel(int id)
{
return NSAPI_ERROR_UNSUPPORTED;
}

View File

@ -21,7 +21,6 @@
#include "stddef.h"
#include <new>
// Default NetworkStack operations
nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version)
{
@ -33,6 +32,11 @@ nsapi_error_t NetworkStack::add_dns_server(const SocketAddress &address)
return NSAPI_ERROR_OK;
}
nsapi_error_t NetworkStack::get_dns_server(int index, SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}
nsapi_error_t NetworkStack::setstackopt(int level, int optname, const void *optval, unsigned optlen)
{
return NSAPI_ERROR_UNSUPPORTED;
@ -64,3 +68,28 @@ NetworkStack *nsapi_create_stack(NetworkStack *stack)
return NULL;
}
nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *host, hostbyname_cb_t callback,
nsapi_version_t version)
{
return NSAPI_ERROR_UNSUPPORTED;
}
nsapi_error_t NetworkStack::gethostbyname_async_cancel(int id)
{
return NSAPI_ERROR_UNSUPPORTED;
}
call_in_callback_cb_t NetworkStack::get_call_in_callback()
{
return NULL;
}
nsapi_error_t NetworkStack::call_in(int delay, mbed::Callback<void()> func)
{
return NSAPI_ERROR_UNSUPPORTED;
}
const char *NetworkStack::get_ip_address()
{
return NULL;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_
#define MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_
//usage macros:
#define tr_debug(...)
#define tr_info(...)
#define tr_warning(...)
#define tr_warn(...)
#define tr_error(...)
#define tr_err(...)
#endif /* MBED_OS_FEATURES_CELLULAR_MBED_TRACE_H_ */

View File

@ -18,8 +18,6 @@
#ifndef CELLULAR_LOG_H_
#define CELLULAR_LOG_H_
#include "rtos.h"
#if defined(HAVE_DEBUG) && !defined(FEA_TRACE_SUPPORT)
#define FEA_TRACE_SUPPORT
#endif