@@ -18,17 +18,22 @@ TEST_CASE ("Testing parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = N
18
18
{
19
19
StreamMock mock;
20
20
21
- WHEN (" Only a integer is contained in stream" )
21
+ WHEN (" A positive integer is contained in stream" )
22
22
{
23
23
mock << " 1234" ;
24
24
REQUIRE (mock.parseInt () == 1234 );
25
25
}
26
- WHEN (" The integer is prepended by digits" )
26
+ WHEN (" A negative integer is contained in stream" )
27
+ {
28
+ mock << " -1234" ;
29
+ REQUIRE (mock.parseInt () == -1234 );
30
+ }
31
+ WHEN (" A integer is prepended by digits" )
27
32
{
28
33
mock << " abcdef1234" ;
29
34
REQUIRE (mock.parseInt () == 1234 );
30
35
}
31
- WHEN (" The integer is prepended by whitespace chars" )
36
+ WHEN (" A integer is prepended by whitespace chars" )
32
37
{
33
38
mock << " \r\n\t 1234" ;
34
39
REQUIRE (mock.parseInt () == 1234 );
@@ -39,19 +44,19 @@ TEST_CASE ("Testing parseInt(LookaheadMode lookahead = SKIP_NONE, char ignore =
39
44
{
40
45
StreamMock mock;
41
46
42
- WHEN (" Only a integer is contained in stream" )
47
+ WHEN (" A positive integer is contained in stream" )
43
48
{
44
49
mock << " 1234" ;
45
50
REQUIRE (mock.parseInt (SKIP_NONE) == 1234 );
46
51
REQUIRE (mock.readString () == arduino::String (" " ));
47
52
}
48
- WHEN (" The integer is prepended by digits" )
53
+ WHEN (" A integer is prepended by digits" )
49
54
{
50
55
mock << " abcdef1234" ;
51
56
REQUIRE (mock.parseInt (SKIP_NONE) == 0 );
52
57
REQUIRE (mock.readString () == arduino::String (" abcdef1234" ));
53
58
}
54
- WHEN (" The integer is prepended by whitespace chars" )
59
+ WHEN (" A integer is prepended by whitespace chars" )
55
60
{
56
61
mock << " \r\n\t 1234" ;
57
62
REQUIRE (mock.parseInt (SKIP_NONE) == 0 );
@@ -63,19 +68,7 @@ TEST_CASE ("Testing parseInt(LookaheadMode lookahead = SKIP_WHITESPACE, char ign
63
68
{
64
69
StreamMock mock;
65
70
66
- WHEN (" Only a integer is contained in stream" )
67
- {
68
- mock << " 1234" ;
69
- REQUIRE (mock.parseInt (SKIP_WHITESPACE) == 1234 );
70
- REQUIRE (mock.readString () == arduino::String (" " ));
71
- }
72
- WHEN (" The integer is prepended by digits" )
73
- {
74
- mock << " abcdef1234" ;
75
- REQUIRE (mock.parseInt (SKIP_WHITESPACE) == 0 );
76
- REQUIRE (mock.readString () == arduino::String (" abcdef1234" ));
77
- }
78
- WHEN (" The integer is prepended by whitespace chars" )
71
+ WHEN (" A integer is prepended by whitespace chars" )
79
72
{
80
73
mock << " \r\n\t 1234" ;
81
74
REQUIRE (mock.parseInt (SKIP_WHITESPACE) == 1234 );
@@ -87,22 +80,22 @@ TEST_CASE ("Testing parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = '
87
80
{
88
81
StreamMock mock;
89
82
90
- WHEN (" Only a integer is contained in stream" )
83
+ WHEN (" A positive integer is contained in stream" )
91
84
{
92
85
mock << " 1234" ;
93
86
REQUIRE (mock.parseInt (SKIP_ALL, ' a' ) == 1234 );
94
87
REQUIRE (mock.readString () == arduino::String (" " ));
95
88
}
96
- WHEN (" The integer contains only ignore char values" )
89
+ WHEN (" A integer contains only ignore char values" )
97
90
{
98
91
mock << " 12a3a4a" ;
99
- REQUIRE (mock.parseInt (SKIP_NONE , ' a' ) == 1234 );
92
+ REQUIRE (mock.parseInt (SKIP_ALL , ' a' ) == 1234 );
100
93
REQUIRE (mock.readString () == arduino::String (" " ));
101
94
}
102
- WHEN (" The integer contains other than ignore chars" )
95
+ WHEN (" A integer contains other than ignore chars" )
103
96
{
104
97
mock << " 1bed234" ;
105
- REQUIRE (mock.parseInt (SKIP_NONE , ' a' ) == 1 );
98
+ REQUIRE (mock.parseInt (SKIP_ALL , ' a' ) == 1 );
106
99
REQUIRE (mock.readString () == arduino::String (" bed234" ));
107
100
}
108
101
}
0 commit comments