Skip to content

Unittests: fix for PRs 12051 and 11996 #12073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ set(unittest-test-sources
stubs/NetworkInterface_stub.cpp
stubs/NetworkInterfaceDefaults_stub.cpp
stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)

set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ set(unittest-test-sources
stubs/randLIB_stub.cpp
stubs/ConditionVariable_stub.cpp
stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)

set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ set(unittest-test-sources
stubs/NetworkInterface_stub.cpp
stubs/NetworkInterfaceDefaults_stub.cpp
stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)

set(unittest-test-flags
-DMBED_CONF_CELLULAR_USE_SMS=1
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
)
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ set(unittest-test-sources
stubs/ThisThread_stub.cpp
stubs/ConditionVariable_stub.cpp
stubs/Mutex_stub.cpp
stubs/Semaphore_stub.cpp
)

set(unittest-test-flags
-DDEVICE_SERIAL=1
-DDEVICE_INTERRUPTIN=1
)

28 changes: 17 additions & 11 deletions UNITTESTS/stubs/AT_CellularDevice_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ int AT_CellularDevice_stub::get_sim_failure_count = 0;
bool AT_CellularDevice_stub::pin_needed = 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)
{
}
Expand Down Expand Up @@ -87,12 +91,23 @@ CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)
_modem_debug_on), *this);
return _network;
}

#if MBED_CONF_CELLULAR_USE_SMS
CellularSMS *AT_CellularDevice::open_sms(FileHandle *fh)
{
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)
{
return NULL;
Expand All @@ -108,10 +123,6 @@ void AT_CellularDevice::close_network()
}
}

void AT_CellularDevice::close_sms()
{
}

void AT_CellularDevice::close_information()
{
}
Expand Down Expand Up @@ -142,11 +153,6 @@ AT_CellularNetwork *AT_CellularDevice::open_network_impl(ATHandler &at)
return _network;
}

AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at)
{
return NULL;
}

AT_CellularInformation *AT_CellularDevice::open_information_impl(ATHandler &at)
{
return NULL;
Expand Down
8 changes: 6 additions & 2 deletions UNITTESTS/stubs/CellularDevice_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
}
}

CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0),
_info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0)
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(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)
{
}

Expand Down
1 change: 1 addition & 0 deletions UNITTESTS/target_h/myCellularDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ATHandler_stub.h"
#include "AT_CellularContext.h"
#include "gtest/gtest.h"
#include "UARTSerial.h"

using namespace events;

Expand Down