Unittests fixed

PRs 12051 and 11996 were merged simultaneously without running tests in between.
This caused unittests to brake and those are fixed with this commit.
pull/12073/head
Antti Kauppila 2019-12-10 18:02:14 +02:00
parent f10e4ac04b
commit bda2d37bda
7 changed files with 46 additions and 13 deletions

View File

@ -34,4 +34,10 @@ set(unittest-test-sources
stubs/NetworkInterface_stub.cpp stubs/NetworkInterface_stub.cpp
stubs/NetworkInterfaceDefaults_stub.cpp stubs/NetworkInterfaceDefaults_stub.cpp
stubs/Mutex_stub.cpp stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)
set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
) )

View File

@ -36,4 +36,10 @@ set(unittest-test-sources
stubs/randLIB_stub.cpp stubs/randLIB_stub.cpp
stubs/ConditionVariable_stub.cpp stubs/ConditionVariable_stub.cpp
stubs/Mutex_stub.cpp stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)
set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
) )

View File

@ -37,8 +37,11 @@ set(unittest-test-sources
stubs/NetworkInterface_stub.cpp stubs/NetworkInterface_stub.cpp
stubs/NetworkInterfaceDefaults_stub.cpp stubs/NetworkInterfaceDefaults_stub.cpp
stubs/Mutex_stub.cpp stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
) )
set(unittest-test-flags set(unittest-test-flags
-DMBED_CONF_CELLULAR_USE_SMS=1 -DMBED_CONF_CELLULAR_USE_SMS=1
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
) )

View File

@ -43,4 +43,11 @@ set(unittest-test-sources
stubs/ThisThread_stub.cpp stubs/ThisThread_stub.cpp
stubs/ConditionVariable_stub.cpp stubs/ConditionVariable_stub.cpp
stubs/Mutex_stub.cpp stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
) )
set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
)

View File

@ -32,7 +32,11 @@ int AT_CellularDevice_stub::get_sim_failure_count = 0;
bool AT_CellularDevice_stub::pin_needed = false; bool AT_CellularDevice_stub::pin_needed = false;
bool AT_CellularDevice_stub::supported_bool = false; bool AT_CellularDevice_stub::supported_bool = false;
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _network(0), _sms(0), AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh),
#if MBED_CONF_CELLULAR_USE_SMS
_sms(0),
#endif // MBED_CONF_CELLULAR_USE_SMS
_network(0),
_information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT), _modem_debug_on(false) _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT), _modem_debug_on(false)
{ {
} }
@ -87,12 +91,23 @@ CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)
_modem_debug_on), *this); _modem_debug_on), *this);
return _network; return _network;
} }
#if MBED_CONF_CELLULAR_USE_SMS
CellularSMS *AT_CellularDevice::open_sms(FileHandle *fh) CellularSMS *AT_CellularDevice::open_sms(FileHandle *fh)
{ {
return NULL; return NULL;
} }
void AT_CellularDevice::close_sms()
{
}
AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at)
{
return NULL;
}
#endif // MBED_CONF_CELLULAR_USE_SMS
CellularInformation *AT_CellularDevice::open_information(FileHandle *fh) CellularInformation *AT_CellularDevice::open_information(FileHandle *fh)
{ {
return NULL; return NULL;
@ -108,10 +123,6 @@ void AT_CellularDevice::close_network()
} }
} }
void AT_CellularDevice::close_sms()
{
}
void AT_CellularDevice::close_information() void AT_CellularDevice::close_information()
{ {
} }
@ -142,11 +153,6 @@ AT_CellularNetwork *AT_CellularDevice::open_network_impl(ATHandler &at)
return _network; return _network;
} }
AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at)
{
return NULL;
}
AT_CellularInformation *AT_CellularDevice::open_information_impl(ATHandler &at) AT_CellularInformation *AT_CellularDevice::open_information_impl(ATHandler &at)
{ {
return NULL; return NULL;

View File

@ -37,8 +37,12 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
} }
} }
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0), CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0),
_info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0) #if MBED_CONF_CELLULAR_USE_SMS
_sms_ref_count(0),
#endif //MBED_CONF_CELLULAR_USE_SMS
_info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0),
_nw(0), _status_cb(0), _property_array(0)
{ {
} }

View File

@ -23,6 +23,7 @@
#include "ATHandler_stub.h" #include "ATHandler_stub.h"
#include "AT_CellularContext.h" #include "AT_CellularContext.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "UARTSerial.h"
using namespace events; using namespace events;