2
2
3
3
namespace ClientTest
4
4
{
5
+ const char * localhost = " localhost" ;
6
+
5
7
class MyService
6
8
{
7
9
public:
@@ -30,7 +32,7 @@ namespace ClientTest
30
32
Client* client = ArduinoFakeMock (Client);
31
33
32
34
TEST_ASSERT_EQUAL (0 , client->connected ());
33
- TEST_ASSERT_EQUAL (1 , client->connect (" localhost" , 8080 ));
35
+ TEST_ASSERT_EQUAL (1 , client->connect (localhost, 8080 ));
34
36
TEST_ASSERT_EQUAL (1 , client->connected ());
35
37
TEST_ASSERT_EQUAL (2 , client->peek ());
36
38
@@ -41,7 +43,7 @@ namespace ClientTest
41
43
Verify (Method (ArduinoFake (Client), peek)).Once ();
42
44
Verify (Method (ArduinoFake (Client), flush)).Once ();
43
45
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 ();
45
47
}
46
48
47
49
void test_connect (void )
@@ -54,14 +56,14 @@ namespace ClientTest
54
56
55
57
Client* client = ArduinoFakeMock (Client);
56
58
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 ));
59
61
60
62
TEST_ASSERT_EQUAL (0 , client->connect (ipAddress1, 8080 ));
61
63
TEST_ASSERT_EQUAL (1 , client->connect (ipAddress2, 8080 ));
62
64
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 ();
65
67
66
68
Verify (OverloadedMethod (ArduinoFake (Client), connect, int (IPAddress, uint16_t )).Using (ipAddress1, 8080 )).Once ();
67
69
Verify (OverloadedMethod (ArduinoFake (Client), connect, int (IPAddress, uint16_t )).Using (ipAddress2, 8080 )).Once ();
0 commit comments