Skip to content

Commit 255b93c

Browse files
committed
invoke fake
1 parent 6f66780 commit 255b93c

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/PrintFake.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ class PrintFakeProxy : public Print
4444

4545
size_t write(const uint8_t *buffer, size_t size)
4646
{
47-
return this->write(buffer, size);
47+
return printFake->write(buffer, size);
4848
}
4949

5050
size_t write(uint8_t value)
5151
{
52-
return this->write(value);
52+
return printFake->write(value);
5353
}
5454

5555
public:

src/StreamFake.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,26 @@ class StreamFakeProxy : public Stream, public PrintFakeProxy
5050

5151
size_t write(uint8_t value)
5252
{
53-
return this->write(value);
53+
return streamFake->write(value);
5454
}
5555

5656
int available()
5757
{
58-
return this->available();
58+
return streamFake->available();
5959
}
6060

6161
int read()
6262
{
63-
return this->read();
63+
return streamFake->read();
6464
}
6565

6666
int peek()
6767
{
68-
return this->peek();
68+
return streamFake->peek();
6969
}
7070

7171
void flush()
7272
{
73-
this->flush();
73+
streamFake->flush();
7474
}
7575
};

test/test_stream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ namespace StreamTest
4444
When(Method(ArduinoFake(Stream), peek)).Return(21, 22, 23);
4545
When(Method(ArduinoFake(Stream), flush)).AlwaysReturn();
4646

47+
Stream* stream = ArduinoFakeMock(Stream);
48+
4749
TEST_ASSERT_EQUAL(0, ArduinoFakeInstance(Stream)->available());
4850
TEST_ASSERT_EQUAL(1, ArduinoFakeInstance(Stream)->available());
4951
TEST_ASSERT_EQUAL(0, ArduinoFakeInstance(Stream)->available());

0 commit comments

Comments
 (0)