@@ -178,17 +178,21 @@ TEST_F(TestPPPInterface, disconnect)
178
178
179
179
TEST_F (TestPPPInterface, set_network)
180
180
{
181
- char ipAddress[NSAPI_IPv4_SIZE] = " 127.0.0.1" ;
182
- char netmask[NSAPI_IPv4_SIZE] = " 255.255.0.0" ;
183
- char gateway[NSAPI_IPv4_SIZE] = " 127.0.0.2" ;
181
+ SocketAddress ipAddress ( " 127.0.0.1" ) ;
182
+ SocketAddress netmask ( " 255.255.0.0" ) ;
183
+ SocketAddress gateway ( " 127.0.0.2" ) ;
184
184
185
185
const char *ipAddressArg;
186
186
const char *netmaskArg;
187
187
const char *gatewayArg;
188
188
189
- EXPECT_EQ (0 , iface->get_ip_address ());
190
- EXPECT_EQ (0 , iface->get_netmask ());
191
- EXPECT_EQ (0 , iface->get_gateway ());
189
+ SocketAddress ipAddr;
190
+ SocketAddress netmaskAddr;
191
+ SocketAddress gatewayAddr;
192
+
193
+ EXPECT_EQ (NSAPI_ERROR_NO_CONNECTION, iface->get_ip_address (&ipAddr));
194
+ EXPECT_EQ (NSAPI_ERROR_NO_CONNECTION, iface->get_netmask (&netmaskAddr));
195
+ EXPECT_EQ (NSAPI_ERROR_NO_CONNECTION, iface->get_gateway (&gatewayAddr));
192
196
193
197
EXPECT_CALL (*pppMock, set_stream (_));
194
198
EXPECT_CALL (*pppMock, set_ip_stack (_));
@@ -213,25 +217,28 @@ TEST_F(TestPPPInterface, set_network)
213
217
Return (NSAPI_ERROR_OK)));
214
218
EXPECT_EQ (NSAPI_ERROR_OK, iface->connect ());
215
219
// Check the contents of the stored pointer arguments.
216
- EXPECT_TRUE (0 == strcmp (ipAddress, ipAddressArg));
217
- EXPECT_TRUE (0 == strcmp (netmask, netmaskArg));
218
- EXPECT_TRUE (0 == strcmp (gateway, gatewayArg));
220
+ EXPECT_TRUE (0 == strcmp (ipAddress. get_ip_address () , ipAddressArg));
221
+ EXPECT_TRUE (0 == strcmp (netmask. get_ip_address () , netmaskArg));
222
+ EXPECT_TRUE (0 == strcmp (gateway. get_ip_address () , gatewayArg));
219
223
220
224
// Testing the getters makes sense now.
221
- EXPECT_CALL (*netStackIface, get_ip_address (_, _ ))
225
+ EXPECT_CALL (*netStackIface, get_ip_address (_))
222
226
.Times (1 )
223
- .WillOnce (DoAll (SetArgPointee<0 >(*ipAddress), Return (ipAddress)));
224
- EXPECT_EQ (std::string (ipAddress), std::string (iface->get_ip_address ()));
227
+ .WillOnce (DoAll (SetArgPointee<0 >(ipAddress), Return (NSAPI_ERROR_OK)));
228
+ EXPECT_EQ (NSAPI_ERROR_OK, iface->get_ip_address (&ipAddr));
229
+ EXPECT_EQ (ipAddress, ipAddr);
225
230
226
- EXPECT_CALL (*netStackIface, get_netmask (_, _ ))
231
+ EXPECT_CALL (*netStackIface, get_netmask (_))
227
232
.Times (1 )
228
- .WillOnce (DoAll (SetArgPointee<0 >(*netmask), Return (netmask)));
229
- EXPECT_EQ (std::string (netmask), std::string (iface->get_netmask ()));
233
+ .WillOnce (DoAll (SetArgPointee<0 >(netmask), Return (NSAPI_ERROR_OK)));
234
+ EXPECT_EQ (NSAPI_ERROR_OK, iface->get_netmask (&netmaskAddr));
235
+ EXPECT_EQ (netmask, netmaskAddr);
230
236
231
- EXPECT_CALL (*netStackIface, get_gateway (_, _ ))
237
+ EXPECT_CALL (*netStackIface, get_gateway (_))
232
238
.Times (1 )
233
- .WillOnce (DoAll (SetArgPointee<0 >(*gateway), Return (gateway)));
234
- EXPECT_EQ (std::string (gateway), std::string (iface->get_gateway ()));
239
+ .WillOnce (DoAll (SetArgPointee<0 >(gateway), Return (NSAPI_ERROR_OK)));
240
+ EXPECT_EQ (NSAPI_ERROR_OK, iface->get_gateway (&gatewayAddr));
241
+ EXPECT_EQ (gateway, gatewayAddr);
235
242
}
236
243
237
244
TEST_F (TestPPPInterface, get_connection_status)
0 commit comments