Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
EepromTest Class Reference

Test fixture class for testing the EEPROM emulation. More...

#include <EEPROMEmuTest.hxx>

Inheritance diagram for EepromTest:

Protected Member Functions

void create (bool clear=true)
 Creates the eeprom under test.
 
void write_to (unsigned ofs, const string &payload)
 Helper function to write to the test eeprom.
 
EEPROMee ()
 
string block_data (unsigned block_number)
 
void overflow_block ()
 Write enough much data to the eepromemu under test to overflow the current block.
 
uint32_t block_address (unsigned block_number)
 

Protected Attributes

std::unique_ptr< MyEEPROMe
 EEPROM under test.
 

Static Protected Attributes

static constexpr unsigned eeprom_size = 1000
 test eeprom size
 

Detailed Description

Test fixture class for testing the EEPROM emulation.

Definition at line 144 of file EEPROMEmuTest.hxx.

Member Function Documentation

◆ block_address()

uint32_t EepromTest::block_address ( unsigned  block_number)
inlineprotected
Returns
the address (that is, the file offset) of the payload stored in a given block.
Parameters
block_numberis the index of the block in question (0.. block count - 1).

Definition at line 194 of file EEPROMEmuTest.hxx.

◆ block_data()

string EepromTest::block_data ( unsigned  block_number)
inlineprotected
Returns
the data payload in a given block.
Parameters
block_numberwhich block's data to return

Definition at line 169 of file EEPROMEmuTest.hxx.

◆ create()

void EepromTest::create ( bool  clear = true)
inlineprotected

Creates the eeprom under test.

Parameters
clearif true, eeprom starts up empty.

Definition at line 148 of file EEPROMEmuTest.hxx.

◆ ee()

EEPROM * EepromTest::ee ( )
inlineprotected
Returns
the eeprom implementation under test.

Definition at line 163 of file EEPROMEmuTest.hxx.

◆ overflow_block()

void EepromTest::overflow_block ( )
inlineprotected

Write enough much data to the eepromemu under test to overflow the current block.

Definition at line 181 of file EEPROMEmuTest.hxx.

◆ write_to()

void EepromTest::write_to ( unsigned  ofs,
const string &  payload 
)
inlineprotected

Helper function to write to the test eeprom.

Parameters
ofswhere to write
payloadwhat to write

Definition at line 157 of file EEPROMEmuTest.hxx.

Member Data Documentation

◆ e

std::unique_ptr<MyEEPROM> EepromTest::e
protected

EEPROM under test.

Definition at line 204 of file EEPROMEmuTest.hxx.

◆ eeprom_size

constexpr unsigned EepromTest::eeprom_size = 1000
staticconstexprprotected

test eeprom size

Definition at line 203 of file EEPROMEmuTest.hxx.


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