22
33namespace ClientTest
44{
5+ const char * localhost = " localhost" ;
6+
57 class MyService
68 {
79 public:
@@ -30,7 +32,7 @@ namespace ClientTest
3032 Client* client = ArduinoFakeMock (Client);
3133
3234 TEST_ASSERT_EQUAL (0 , client->connected ());
33- TEST_ASSERT_EQUAL (1 , client->connect (" localhost" , 8080 ));
35+ TEST_ASSERT_EQUAL (1 , client->connect (localhost, 8080 ));
3436 TEST_ASSERT_EQUAL (1 , client->connected ());
3537 TEST_ASSERT_EQUAL (2 , client->peek ());
3638
@@ -41,7 +43,7 @@ namespace ClientTest
4143 Verify (Method (ArduinoFake (Client), peek)).Once ();
4244 Verify (Method (ArduinoFake (Client), flush)).Once ();
4345 Verify (Method (ArduinoFake (Client), connected)).Exactly (2_Times);
44- Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (" localhost" , 8080 )).Once ();
46+ Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (localhost, 8080 )).Once ();
4547 }
4648
4749 void test_connect (void )
@@ -54,14 +56,14 @@ namespace ClientTest
5456
5557 Client* client = ArduinoFakeMock (Client);
5658
57- TEST_ASSERT_EQUAL (1 , client->connect (" localhost" , 8080 ));
58- TEST_ASSERT_EQUAL (0 , client->connect (" localhost" , 80 ));
59+ TEST_ASSERT_EQUAL (1 , client->connect (localhost, 8080 ));
60+ TEST_ASSERT_EQUAL (0 , client->connect (localhost, 80 ));
5961
6062 TEST_ASSERT_EQUAL (0 , client->connect (ipAddress1, 8080 ));
6163 TEST_ASSERT_EQUAL (1 , client->connect (ipAddress2, 8080 ));
6264
63- Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (" localhost" , 8080 )).Once ();
64- Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (" localhost" , 80 )).Once ();
65+ Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (localhost, 8080 )).Once ();
66+ Verify (OverloadedMethod (ArduinoFake (Client), connect, int (const char *, uint16_t )).Using (localhost, 80 )).Once ();
6567
6668 Verify (OverloadedMethod (ArduinoFake (Client), connect, int (IPAddress, uint16_t )).Using (ipAddress1, 8080 )).Once ();
6769 Verify (OverloadedMethod (ArduinoFake (Client), connect, int (IPAddress, uint16_t )).Using (ipAddress2, 8080 )).Once ();
0 commit comments