@@ -178,17 +178,21 @@ TEST_F(TestPPPInterface, disconnect)
178178
179179TEST_F (TestPPPInterface, set_network)
180180{
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" ) ;
184184
185185 const char *ipAddressArg;
186186 const char *netmaskArg;
187187 const char *gatewayArg;
188188
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));
192196
193197 EXPECT_CALL (*pppMock, set_stream (_));
194198 EXPECT_CALL (*pppMock, set_ip_stack (_));
@@ -213,25 +217,28 @@ TEST_F(TestPPPInterface, set_network)
213217 Return (NSAPI_ERROR_OK)));
214218 EXPECT_EQ (NSAPI_ERROR_OK, iface->connect ());
215219 // 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));
219223
220224 // Testing the getters makes sense now.
221- EXPECT_CALL (*netStackIface, get_ip_address (_, _ ))
225+ EXPECT_CALL (*netStackIface, get_ip_address (_))
222226 .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);
225230
226- EXPECT_CALL (*netStackIface, get_netmask (_, _ ))
231+ EXPECT_CALL (*netStackIface, get_netmask (_))
227232 .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);
230236
231- EXPECT_CALL (*netStackIface, get_gateway (_, _ ))
237+ EXPECT_CALL (*netStackIface, get_gateway (_))
232238 .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);
235242}
236243
237244TEST_F (TestPPPInterface, get_connection_status)
0 commit comments