Skip to content

Commit 427674d

Browse files
Antti KauppilaAri Parkkila
authored andcommitted
IOTCELL-553 fixed
Unittests reports an error as there is no coverage file created for cellular_mux. This is now fixed by running an init function.
1 parent fb25c60 commit 427674d

File tree

6 files changed

+137
-3
lines changed

6 files changed

+137
-3
lines changed

features/cellular/UNITTESTS/mux/cellular_mux/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ TEST_SRC_FILES = \
1010
main.cpp \
1111
cellular_muxtest.cpp \
1212
test_cellular_mux.cpp \
13+
../../stubs/mbed_assert_stub.cpp \
14+
../../stubs/FileHandle_stub.cpp \
15+
../../stubs/EventQueue_stub.cpp \
16+
../../stubs/equeue_stub.c \
17+
../../stubs/cellular_mux_data_service_stub.cpp \
18+
../../stubs/Semaphore_stub.cpp \
1319

1420
include ../../MakefileWorker.mk
1521

features/cellular/UNITTESTS/mux/cellular_mux/cellular_muxtest.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ TEST(cellular_mux, Create)
3737
CHECK(unit != NULL);
3838
}
3939

40+
TEST(cellular_mux, test_cellular_mux_module_init)
41+
{
42+
unit->test_cellular_mux_module_init();
43+
}
4044

45+
TEST(cellular_mux, test_cellular_mux_mux_start)
46+
{
47+
unit->test_cellular_mux_mux_start();
48+
}
49+
50+
TEST(cellular_mux, test_cellular_mux_dlci_establish)
51+
{
52+
unit->test_cellular_mux_dlci_establish();
53+
}
54+
55+
TEST(cellular_mux, test_cellular_mux_serial_attach)
56+
{
57+
unit->test_cellular_mux_serial_attach();
58+
}
59+
60+
TEST(cellular_mux, test_cellular_mux_eventqueue_attach)
61+
{
62+
unit->test_cellular_mux_eventqueue_attach();
63+
}
4164

4265

features/cellular/UNITTESTS/mux/cellular_mux/test_cellular_mux.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
*/
1717
#include "CppUTest/TestHarness.h"
1818
#include "test_cellular_mux.h"
19+
#include "cellular_mux.h"
1920
#include <string.h>
2021

22+
using namespace mbed;
23+
using namespace events;
24+
2125
Test_cellular_mux::Test_cellular_mux()
2226
{
2327

@@ -27,3 +31,27 @@ Test_cellular_mux::~Test_cellular_mux()
2731
{
2832
}
2933

34+
void Test_cellular_mux::test_cellular_mux_module_init()
35+
{
36+
Mux::module_init();
37+
}
38+
39+
void Test_cellular_mux::test_cellular_mux_mux_start()
40+
{
41+
}
42+
43+
void Test_cellular_mux::test_cellular_mux_dlci_establish()
44+
{
45+
46+
}
47+
48+
void Test_cellular_mux::test_cellular_mux_serial_attach()
49+
{
50+
51+
}
52+
53+
void Test_cellular_mux::test_cellular_mux_eventqueue_attach()
54+
{
55+
56+
}
57+

features/cellular/UNITTESTS/mux/cellular_mux/test_cellular_mux.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ class Test_cellular_mux
2323
Test_cellular_mux();
2424

2525
virtual ~Test_cellular_mux();
26+
27+
void test_cellular_mux_module_init();
28+
29+
void test_cellular_mux_mux_start();
30+
31+
void test_cellular_mux_dlci_establish();
32+
33+
void test_cellular_mux_serial_attach();
34+
35+
void test_cellular_mux_eventqueue_attach();
2636
};
2737

2838
#endif // TEST_cellular_mux_H

features/cellular/UNITTESTS/stubs/Semaphore_stub.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,41 @@
1717

1818
#include "Semaphore.h"
1919

20+
namespace rtos {
2021

22+
Semaphore::Semaphore(int32_t count)
23+
{
24+
25+
}
26+
27+
Semaphore::Semaphore(int32_t count, uint16_t max_count)
28+
{
29+
30+
}
31+
32+
void Semaphore::constructor(int32_t count, uint16_t max_count)
33+
{
34+
35+
}
36+
37+
int32_t Semaphore::wait(uint32_t millisec)
38+
{
39+
return 0;
40+
}
41+
42+
int32_t Semaphore::wait_until(uint64_t millisec)
43+
{
44+
return 0;
45+
}
46+
47+
osStatus Semaphore::release(void)
48+
{
49+
return 0;
50+
}
51+
52+
Semaphore::~Semaphore()
53+
{
54+
55+
}
56+
57+
}

features/cellular/UNITTESTS/target_h/Semaphore2.h renamed to features/cellular/UNITTESTS/stubs/cellular_mux_data_service_stub.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,37 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
namespace rtos {
18-
class Semaphore {
19-
};
17+
#include "cellular_mux.h"
18+
19+
namespace mbed
20+
{
21+
22+
ssize_t MuxDataService::write(const void* buffer, size_t size)
23+
{
24+
return 0;
25+
}
26+
27+
28+
ssize_t MuxDataService::read(void *buffer, size_t size)
29+
{
30+
return 0;
31+
}
32+
33+
34+
off_t MuxDataService::seek(off_t offset, int whence)
35+
{
36+
return 0;
37+
}
38+
39+
40+
int MuxDataService::close()
41+
{
42+
return 0;
43+
}
44+
45+
46+
void MuxDataService::sigio(Callback<void()> func)
47+
{
48+
}
49+
2050
}

0 commit comments

Comments
 (0)