Loading...
Searching...
No Matches
MemoryMapArrayTest Class Reference
Inheritance diagram for MemoryMapArrayTest:
[legend]
Collaboration diagram for MemoryMapArrayTest:
[legend]

## Public Member Functions

| MemoryMapArrayTest (const char *title)
void | testBool ()
void | test2Bit ()
void | test4Bit ()
void | test32Bit ()
void | test ()
Public Member Functions inherited from UnitTest
| UnitTest (const char *title)
void | test ()
int | getPassCount ()
int | getFailureCount ()
const std::string | getTitle () const
| UnitTest (const char *title)
void | test ()
int | getPassCount ()
int | getFailureCount ()
const std::string | getTitle () const

## Additional Inherited Members

Protected Attributes inherited from UnitTest
std::string | m_title
int | m_failures
int | m_testNum

## Detailed Description

Definition at line 29 of file MemoryMapArrayTest.cpp.

## Constructor & Destructor Documentation

## MemoryMapArrayTest()

MemoryMapArrayTest::MemoryMapArrayTest | ( | const char * | title | ) |

inline

Definition at line 32 of file MemoryMapArrayTest.cpp.

: UnitTest(title) {;}

## Member Function Documentation

## test()

void MemoryMapArrayTest::test | ( |  | ) |

inline

Definition at line 38 of file MemoryMapArrayTest.cpp.

{
testBool();
test2Bit();
test4Bit();
test32Bit();
}

## test2Bit()

void MemoryMapArrayTest::test2Bit | ( | void |  | ) |

Definition at line 101 of file MemoryMapArrayTest.cpp.

{
mmapArray2Bit_t testVector;
// ignore return code here
if(unlink(TEST_FILE_NAME) == 0)
{
// Nothing to do, just deleting previous test file
}
check(m_failures, ++m_testNum, "Create 2 bit vector file", 0,
testVector.create(TEST_FILE_NAME, 11));
testVector.set(0,0);
testVector.set(1,1);
testVector.set(2,2);
testVector.set(3,3);
testVector.set(4,3);
testVector.set(5,2);
testVector.set(6,1);
testVector.set(7,0);
testVector.set(8,2);
testVector.set(9,1);
testVector.set(10,3);
check(m_failures, ++m_testNum, "Access 2 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 2 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 2 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 2 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 2 bit element 4", 3U, testVector[4]);
check(m_failures, ++m_testNum, "Access 2 bit element 5", 2U, testVector[5]);
check(m_failures, ++m_testNum, "Access 2 bit element 6", 1U, testVector[6]);
check(m_failures, ++m_testNum, "Access 2 bit element 7", 0U, testVector[7]);
check(m_failures, ++m_testNum, "Access 2 bit element 8", 2U, testVector[8]);
check(m_failures, ++m_testNum, "Access 2 bit element 9", 1U, testVector[9]);
check(m_failures, ++m_testNum, "Access 2 bit element 10", 3U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Re-open vector file", false, testVector.open(TEST_FILE_NAME));
check(m_failures, ++m_testNum, "Access 2 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 2 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 2 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 2 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 2 bit element 4", 3U, testVector[4]);
check(m_failures, ++m_testNum, "Access 2 bit element 5", 2U, testVector[5]);
check(m_failures, ++m_testNum, "Access 2 bit element 6", 1U, testVector[6]);
check(m_failures, ++m_testNum, "Access 2 bit element 7", 0U, testVector[7]);
check(m_failures, ++m_testNum, "Access 2 bit element 8", 2U, testVector[8]);
check(m_failures, ++m_testNum, "Access 2 bit element 9", 1U, testVector[9]);
check(m_failures, ++m_testNum, "Access 2 bit element 10", 3U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Unlink vector file", 0, unlink(TEST_FILE_NAME));
}
MemoryMapArray::open
bool open(const char *file, int flags=O_RDONLY)
open a previously created mapped vector
Definition MemoryMapArray.h:269
MemoryMapArray::create
int create(const char *file, indexT elementCount, int optionalHeaderCount=0)
Create a vector with elementCount memebers.
Definition MemoryMapArray.h:208

## test32Bit()

void MemoryMapArrayTest::test32Bit | ( | void |  | ) |

Definition at line 210 of file MemoryMapArrayTest.cpp.

{
mmapArrayUint32_t testVector;
// ignore return code here
if(unlink(TEST_FILE_NAME) == 0)
{
// Nothing to do, just deleting previous test file
}
check(m_failures, ++m_testNum, "Create 32 bit vector file", 0,
testVector.create(TEST_FILE_NAME, 11));
testVector.set(0,0);
testVector.set(1,1);
testVector.set(2,2);
testVector.set(3,3);
testVector.set(4,4);
testVector.set(5,5);
testVector.set(6,6);
testVector.set(7,7);
testVector.set(8,8);
testVector.set(9,9);
testVector.set(10,10);
check(m_failures, ++m_testNum, "Access 32 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 32 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 32 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 32 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 32 bit element 4", 4U, testVector[4]);
check(m_failures, ++m_testNum, "Access 32 bit element 5", 5U, testVector[5]);
check(m_failures, ++m_testNum, "Access 32 bit element 6", 6U, testVector[6]);
check(m_failures, ++m_testNum, "Access 32 bit element 7", 7U, testVector[7]);
check(m_failures, ++m_testNum, "Access 32 bit element 8", 8U, testVector[8]);
check(m_failures, ++m_testNum, "Access 32 bit element 9", 9U, testVector[9]);
check(m_failures, ++m_testNum, "Access 32 bit element 10", 10U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Re-open vector file", false, testVector.open(TEST_FILE_NAME));
check(m_failures, ++m_testNum, "Access 32 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 32 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 32 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 32 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 32 bit element 4", 4U, testVector[4]);
check(m_failures, ++m_testNum, "Access 32 bit element 5", 5U, testVector[5]);
check(m_failures, ++m_testNum, "Access 32 bit element 6", 6U, testVector[6]);
check(m_failures, ++m_testNum, "Access 32 bit element 7", 7U, testVector[7]);
check(m_failures, ++m_testNum, "Access 32 bit element 8", 8U, testVector[8]);
check(m_failures, ++m_testNum, "Access 32 bit element 9", 9U, testVector[9]);
check(m_failures, ++m_testNum, "Access 32 bit element 10", 10U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Unlink vector file", 0, unlink(TEST_FILE_NAME));
}

## test4Bit()

void MemoryMapArrayTest::test4Bit | ( | void |  | ) |

Definition at line 155 of file MemoryMapArrayTest.cpp.

{
mmapArray4Bit_t testVector;
// ignore return code here
if(unlink(TEST_FILE_NAME) == 0)
{
// Nothing to do, just deleting previous test file
}
check(m_failures, ++m_testNum, "Create 4 bit vector file", 0,
testVector.create(TEST_FILE_NAME, 11));
testVector.set(0,0);
testVector.set(1,1);
testVector.set(2,2);
testVector.set(3,3);
testVector.set(4,4);
testVector.set(5,5);
testVector.set(6,6);
testVector.set(7,7);
testVector.set(8,8);
testVector.set(9,9);
testVector.set(10,10);
check(m_failures, ++m_testNum, "Access 4 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 4 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 4 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 4 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 4 bit element 4", 4U, testVector[4]);
check(m_failures, ++m_testNum, "Access 4 bit element 5", 5U, testVector[5]);
check(m_failures, ++m_testNum, "Access 4 bit element 6", 6U, testVector[6]);
check(m_failures, ++m_testNum, "Access 4 bit element 7", 7U, testVector[7]);
check(m_failures, ++m_testNum, "Access 4 bit element 8", 8U, testVector[8]);
check(m_failures, ++m_testNum, "Access 4 bit element 9", 9U, testVector[9]);
check(m_failures, ++m_testNum, "Access 4 bit element 10", 10U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Re-open vector file", false, testVector.open(TEST_FILE_NAME));
check(m_failures, ++m_testNum, "Access 4 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 4 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 4 bit element 2", 2U, testVector[2]);
check(m_failures, ++m_testNum, "Access 4 bit element 3", 3U, testVector[3]);
check(m_failures, ++m_testNum, "Access 4 bit element 4", 4U, testVector[4]);
check(m_failures, ++m_testNum, "Access 4 bit element 5", 5U, testVector[5]);
check(m_failures, ++m_testNum, "Access 4 bit element 6", 6U, testVector[6]);
check(m_failures, ++m_testNum, "Access 4 bit element 7", 7U, testVector[7]);
check(m_failures, ++m_testNum, "Access 4 bit element 8", 8U, testVector[8]);
check(m_failures, ++m_testNum, "Access 4 bit element 9", 9U, testVector[9]);
check(m_failures, ++m_testNum, "Access 4 bit element 10", 10U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Unlink vector file", 0, unlink(TEST_FILE_NAME));
}

## testBool()

void MemoryMapArrayTest::testBool | ( | void |  | ) |

Definition at line 46 of file MemoryMapArrayTest.cpp.

{
mmapArrayBool_t testVector;
// ignore return code here
if(unlink(TEST_FILE_NAME) == 0)
{
// Nothing to do, just deleting previous test file
}
check(m_failures, ++m_testNum, "Create 1 bit vector file", 0,
testVector.create(TEST_FILE_NAME, 11));
testVector.set(0,0);
testVector.set(1,1);
testVector.set(2,0);
testVector.set(3,1);
testVector.set(4,1);
testVector.set(5,0);
testVector.set(6,1);
testVector.set(7,0);
testVector.set(8,0);
testVector.set(9,0);
testVector.set(10,1);
check(m_failures, ++m_testNum, "Access 1 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 1 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 1 bit element 2", 0U, testVector[2]);
check(m_failures, ++m_testNum, "Access 1 bit element 3", 1U, testVector[3]);
check(m_failures, ++m_testNum, "Access 1 bit element 4", 1U, testVector[4]);
check(m_failures, ++m_testNum, "Access 1 bit element 5", 0U, testVector[5]);
check(m_failures, ++m_testNum, "Access 1 bit element 6", 1U, testVector[6]);
check(m_failures, ++m_testNum, "Access 1 bit element 7", 0U, testVector[7]);
check(m_failures, ++m_testNum, "Access 1 bit element 8", 0U, testVector[8]);
check(m_failures, ++m_testNum, "Access 1 bit element 9", 0U, testVector[9]);
check(m_failures, ++m_testNum, "Access 1 bit element 10", 1U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Re-open vector file", false, testVector.open(TEST_FILE_NAME));
check(m_failures, ++m_testNum, "Access 1 bit element 0", 0U, testVector[0]);
check(m_failures, ++m_testNum, "Access 1 bit element 1", 1U, testVector[1]);
check(m_failures, ++m_testNum, "Access 1 bit element 2", 0U, testVector[2]);
check(m_failures, ++m_testNum, "Access 1 bit element 3", 1U, testVector[3]);
check(m_failures, ++m_testNum, "Access 1 bit element 4", 1U, testVector[4]);
check(m_failures, ++m_testNum, "Access 1 bit element 5", 0U, testVector[5]);
check(m_failures, ++m_testNum, "Access 1 bit element 6", 1U, testVector[6]);
check(m_failures, ++m_testNum, "Access 1 bit element 7", 0U, testVector[7]);
check(m_failures, ++m_testNum, "Access 1 bit element 8", 0U, testVector[8]);
check(m_failures, ++m_testNum, "Access 1 bit element 9", 0U, testVector[9]);
check(m_failures, ++m_testNum, "Access 1 bit element 10", 1U, testVector[10]);
check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
check(m_failures, ++m_testNum, "Unlink vector file", 0, unlink(TEST_FILE_NAME));
}

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

- general/test/memoryMapArrayTest/MemoryMapArrayTest.cpp