Skip to content

Commit 861867e

Browse files
author
Teppo Järvelin
committed
Cellular: Added network unit tests.
1 parent 7efa041 commit 861867e

File tree

8 files changed

+951
-74
lines changed

8 files changed

+951
-74
lines changed

features/cellular/UNITTESTS/at/at_cellularnetwork/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ COMPONENT_NAME = AT_CellularNetwork_unit
44

55
#This must be changed manually
66
SRC_FILES = \
7-
../../../framework/AT/AT_CellularNetwork.cpp
7+
../../../framework/AT/AT_CellularNetwork.cpp \
8+
../../../framework/AT/AT_CellularStack.cpp \
9+
../../../framework/common/CellularUtil.cpp \
810

911
TEST_SRC_FILES = \
1012
main.cpp \
@@ -15,9 +17,10 @@ TEST_SRC_FILES = \
1517
../../stubs/EventQueue_stub.cpp \
1618
../../stubs/FileHandle_stub.cpp \
1719
../../stubs/NetworkInterface_stub.cpp \
18-
../../stubs/CellularUtil_stub.cpp \
20+
../../stubs/NetworkStack_stub.cpp \
1921
../../stubs/us_ticker_stub.cpp \
2022
../../stubs/mbed_assert_stub.cpp \
23+
../../stubs/SocketAddress_stub.cpp \
2124

2225
include ../../MakefileWorker.mk
2326

features/cellular/UNITTESTS/at/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
#include "CppUTest/TestHarness.h"
1818
#include "test_at_cellularnetwork.h"
19+
#include "ATHandler_stub.h"
1920

2021
TEST_GROUP(AT_CellularNetwork)
2122
{
@@ -24,6 +25,9 @@ TEST_GROUP(AT_CellularNetwork)
2425
void setup()
2526
{
2627
unit = new Test_AT_CellularNetwork();
28+
ATHandler_stub::int_count = kRead_int_table_size;
29+
ATHandler_stub::read_string_index = kRead_string_table_size;
30+
ATHandler_stub::resp_stop_success_count = kResp_stop_count_default;
2731
}
2832

2933
void teardown()
@@ -42,11 +46,21 @@ TEST(AT_CellularNetwork, test_AT_CellularNetwork_constructor)
4246
unit->test_AT_CellularNetwork_constructor();
4347
}
4448

49+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_init)
50+
{
51+
unit->test_AT_CellularNetwork_init();
52+
}
53+
4554
TEST(AT_CellularNetwork, test_AT_CellularNetwork_set_credentials)
4655
{
4756
unit->test_AT_CellularNetwork_set_credentials();
4857
}
4958

59+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_activate_context)
60+
{
61+
unit->test_AT_CellularNetwork_activate_context();
62+
}
63+
5064
TEST(AT_CellularNetwork, test_AT_CellularNetwork_connect)
5165
{
5266
unit->test_AT_CellularNetwork_connect();
@@ -72,6 +86,16 @@ TEST(AT_CellularNetwork, test_AT_CellularNetwork_get_registration_status)
7286
unit->test_AT_CellularNetwork_get_registration_status();
7387
}
7488

89+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_get_network_registering_mode)
90+
{
91+
unit->test_AT_CellularNetwork_get_network_registering_mode();
92+
}
93+
94+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_set_registration_urc)
95+
{
96+
unit->test_AT_CellularNetwork_set_registration_urc();
97+
}
98+
7599
TEST(AT_CellularNetwork, test_AT_CellularNetwork_set_attach)
76100
{
77101
unit->test_AT_CellularNetwork_set_attach();
@@ -107,6 +131,11 @@ TEST(AT_CellularNetwork, test_AT_CellularNetwork_set_access_technology)
107131
unit->test_AT_CellularNetwork_set_access_technology();
108132
}
109133

134+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_get_access_technology)
135+
{
136+
unit->test_AT_CellularNetwork_get_access_technology();
137+
}
138+
110139
TEST(AT_CellularNetwork, test_AT_CellularNetwork_scan_plmn)
111140
{
112141
unit->test_AT_CellularNetwork_scan_plmn();
@@ -166,3 +195,19 @@ TEST(AT_CellularNetwork, test_AT_CellularNetwork_get_operator_names)
166195
{
167196
unit->test_AT_CellularNetwork_get_operator_names();
168197
}
198+
199+
TEST(AT_CellularNetwork, test_AT_CellularNetwork_attach)
200+
{
201+
unit->test_AT_CellularNetwork_attach();
202+
}
203+
204+
TEST(AT_CellularNetwork, test_get_connection_status)
205+
{
206+
unit->test_get_connection_status();
207+
}
208+
209+
TEST(AT_CellularNetwork, test_set_blocking)
210+
{
211+
unit->test_set_blocking();
212+
}
213+

0 commit comments

Comments
 (0)