Skip to content

Commit 2e75d18

Browse files
committed
unittests: Remove ATHandler test interdependencies
Some tests in athandlertest.cpp relied on the state of stubs set in previous tests. This caused test failures if the tests cases were ran in isolation. Remove the interdependencies between tests by setting stub values in the tests that rely on them.
1 parent a09d089 commit 2e75d18

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

connectivity/cellular/tests/UNITTESTS/framework/device/athandler/athandlertest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ TEST_F(TestATHandler, test_ATHandler_resp_start)
906906

907907
filehandle_stub_table = NULL;
908908
filehandle_stub_table_pos = 0;
909+
mbed_poll_stub::revents_value = POLLIN;
909910

910911
ATHandler at(&fh1, que, 0, ",");
911912
at.resp_start();
@@ -914,6 +915,7 @@ TEST_F(TestATHandler, test_ATHandler_resp_start)
914915
char table2[] = "\"2,\"OK\r\n\0";
915916
filehandle_stub_table = table2;
916917
filehandle_stub_table_pos = 0;
918+
mbed_poll_stub::int_value = strlen(table2);
917919

918920
at.flush();
919921
at.clear_error();
@@ -1052,12 +1054,14 @@ TEST_F(TestATHandler, test_ATHandler_resp_stop)
10521054
{
10531055
EventQueue que;
10541056
FileHandle_stub fh1;
1057+
mbed_poll_stub::revents_value = POLLIN;
10551058

10561059
ATHandler at(&fh1, que, 0, ",");
10571060

10581061
char table[] = "21 OK\r\n\0";
10591062
filehandle_stub_table = table;
10601063
filehandle_stub_table_pos = 0;
1064+
mbed_poll_stub::int_value = strlen(table);
10611065

10621066
at.info_elem('2');
10631067
at.set_stop_tag("OK\r\n");
@@ -1266,6 +1270,7 @@ TEST_F(TestATHandler, test_ATHandler_at_cmd_str)
12661270
{
12671271
EventQueue que;
12681272
FileHandle_stub fh1;
1273+
mbed_poll_stub::revents_value = POLLIN;
12691274

12701275
ATHandler at(&fh1, que, 0, ",");
12711276
uint8_t byte[] = {1, 2, 3, 4};

0 commit comments

Comments
 (0)