AUnit  1.2.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Public Member Functions | Static Public Attributes | List of all members
aunit::fake::FakePrint Class Reference

An implementation of Print that writes to an in-memory buffer. More...

#include <FakePrint.h>

Inheritance diagram for aunit::fake::FakePrint:
Inheritance graph
[legend]
Collaboration diagram for aunit::fake::FakePrint:
Collaboration graph
[legend]

Public Member Functions

size_t write (uint8_t c) override
 
size_t write (const uint8_t *buffer, size_t size) override
 
void flush () override
 
const char * getBuffer () const
 Return the NUL terminated string buffer. More...
 

Static Public Attributes

static const uint8_t kBufSize = 8 * sizeof(long long) + 2 + 1
 Size of the internal buffer. More...
 

Detailed Description

An implementation of Print that writes to an in-memory buffer.

The buffer can be retrieved using getBuffer() to verify that the expected string was written to the Print object.

Definition at line 39 of file FakePrint.h.

Member Function Documentation

◆ getBuffer()

const char* aunit::fake::FakePrint::getBuffer ( ) const
inline

Return the NUL terminated string buffer.

After the buffer is no longer needed, the flush() method should be called to reset the internal buffer index to 0.

Definition at line 85 of file FakePrint.h.

Member Data Documentation

◆ kBufSize

const uint8_t aunit::fake::FakePrint::kBufSize = 8 * sizeof(long long) + 2 + 1
static

Size of the internal buffer.

This is just large enough to hold the string representation of one 64-bit integer in binary format (64 bytes), including 2 bytes for the '\r\n' from println() and 1 byte for the terminating NUL.

Definition at line 47 of file FakePrint.h.


The documentation for this class was generated from the following file: