Skip to content

Commit 2b7a087

Browse files
author
Antti Kauppila
committed
Rebased & fixed
1 parent a6b4938 commit 2b7a087

File tree

7 files changed

+80
-9
lines changed

7 files changed

+80
-9
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellulardevice/at_cellulardevicetest.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_network)
124124
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
125125

126126
dev.close_network();
127-
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
127+
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
128128
}
129129

130130
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
@@ -139,7 +139,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
139139
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
140140

141141
dev.close_sms();
142-
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
142+
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
143143
}
144144

145145
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_power)
@@ -154,7 +154,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_power)
154154
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
155155

156156
dev.close_power();
157-
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
157+
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
158158
}
159159

160160
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
@@ -163,16 +163,19 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
163163
AT_CellularDevice dev(que);
164164
FileHandle_stub fh1;
165165
ATHandler_stub::ref_count = 0;
166-
166+
int ana = 0;
167167

168168
EXPECT_TRUE(dev.open_sim(&fh1));
169169
AT_CellularBase_stub::handler_value = AT_CellularBase_stub::handler_at_constructor_value;
170170

171+
ana = ATHandler_stub::ref_count;
172+
171173
dev.close_sms(); // this should not affect to refcount as it's not opened
172174
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
175+
ana = ATHandler_stub::ref_count;
173176

174177
dev.close_sim();
175-
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
178+
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
176179
}
177180

178181
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_information)

UNITTESTS/features/netsocket/InternetSocket/test_InternetSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ TEST_F(TestInternetSocket, sigio)
153153
callback_is_called = false;
154154
// I'm calling sigio() through the DEPRECATED method, just to get coverage for both.
155155
// Not sure if this is wise at all, we should not aim for 100%
156-
socket->attach(mbed::callback(my_callback));
156+
socket->sigio(mbed::callback(my_callback));
157157
socket->event();
158158
EXPECT_EQ(callback_is_called, true);
159159
}

UNITTESTS/features/netsocket/InternetSocket/unittest.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ set(unittest-sources
1515
)
1616

1717
set(unittest-test-sources
18+
features/netsocket/InternetSocket/test_InternetSocket.cpp
1819
stubs/Mutex_stub.cpp
1920
stubs/mbed_assert_stub.c
2021
stubs/equeue_stub.c
2122
stubs/EventQueue_stub.cpp
2223
stubs/mbed_shared_queues_stub.cpp
2324
stubs/nsapi_dns_stub.cpp
2425
stubs/EventFlags_stub.cpp
25-
features/netsocket/InternetSocket/test_InternetSocket.cpp
26+
stubs/stoip4_stub.c
27+
stubs/ip4tos_stub.c
2628
)

UNITTESTS/features/netsocket/TCPSocket/unittest.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ set(unittest-sources
1515
)
1616

1717
set(unittest-test-sources
18+
features/netsocket/TCPSocket/test_TCPSocket.cpp
1819
stubs/Mutex_stub.cpp
1920
stubs/mbed_assert_stub.c
2021
stubs/EventFlags_stub.cpp
21-
features/netsocket/TCPSocket/test_TCPSocket.cpp
22+
stubs/stoip4_stub.c
23+
stubs/ip4tos_stub.c
2224
)

UNITTESTS/features/netsocket/UDPSocket/unittest.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ set(unittest-sources
1616
)
1717

1818
set(unittest-test-sources
19+
features/netsocket/UDPSocket/test_UDPSocket.cpp
1920
stubs/Mutex_stub.cpp
2021
stubs/mbed_assert_stub.c
2122
stubs/equeue_stub.c
2223
stubs/EventQueue_stub.cpp
2324
stubs/mbed_shared_queues_stub.cpp
2425
stubs/EventFlags_stub.cpp
2526
stubs/nsapi_dns_stub.cpp
26-
features/netsocket/UDPSocket/test_UDPSocket.cpp
27+
stubs/stoip4_stub.c
28+
stubs/ip4tos_stub.c
2729
)

UNITTESTS/stubs/ip4tos_stub.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2014-2018 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#include <stdio.h>
17+
#include <string.h>
18+
#include "common_functions.h"
19+
#include "ip4string.h"
20+
21+
static void ipv4_itoa(char *string, uint8_t byte);
22+
23+
uint_fast8_t ip4tos(const void *ip4addr, char *p)
24+
{
25+
return 0;
26+
}
27+
28+
static void ipv4_itoa(char *string, uint8_t byte)
29+
{
30+
}

UNITTESTS/stubs/stoip4_stub.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2014-2018 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#include <string.h>
17+
#include <stdlib.h>
18+
#include <stdint.h>
19+
#include "common_functions.h"
20+
#include "ip4string.h"
21+
22+
/**
23+
* Convert numeric IPv4 address string to a binary.
24+
* \param ip4addr IPv4 address in string format.
25+
* \param len Length of IPv4 string, maximum of 16..
26+
* \param dest buffer for address. MUST be 4 bytes.
27+
* \return boolean set to true if conversion succeded, false if it didn't
28+
*/
29+
bool stoip4(const char *ip4addr, size_t len, void *dest)
30+
{
31+
return true;
32+
}

0 commit comments

Comments
 (0)