TestPosList Class Reference
Inheritance diagram for TestPosList:
[legend]
Collaboration diagram for TestPosList:
[legend]

## Public Member Functions

void | testPosList ()
Public Member Functions inherited from PosList
| PosList ()
| Constructor. More...
| PosList (int numRefs, int numPositions)
| Reserves space for numRefs reference ids and numPositions for each id. More...
virtual | ~PosList ()
| Destructor. More...
void | addPosition (int refID, int refPosition)
| Add the specified reference id/position (negative values will not be added). More...
bool | hasPosition (int refID, int refPosition)
| Return whether or not this list contains the specified reference ID and position (negative values will automatically return false). More...

## Additional Inherited Members

Protected Member Functions inherited from PosList
| PosList (const PosList &p)
void | initVars ()
Protected Attributes inherited from PosList
std::vector< std::vector< bool > > | myPosList
int | myNumRefs
int | myNumPos

## Detailed Description

Definition at line 22 of file TestPosList.h.

## Constructor & Destructor Documentation

## TestPosList()

TestPosList::TestPosList | ( |  | ) |

Definition at line 28 of file TestPosList.cpp.

{
}

## ~TestPosList()

TestPosList::~TestPosList | ( |  | ) |

Definition at line 33 of file TestPosList.cpp.

{
}

## Member Function Documentation

## testPosList()

void TestPosList::testPosList | ( |  | ) |

Definition at line 38 of file TestPosList.cpp.

{
assert(myPosList.size() == 24);
for(int i = 0; i < 24; i++)
{
assert(myPosList.at(i).size() == 100);
}
bool caught = false;
try
{
myPosList.at(24);
}
catch(std::out_of_range& oor)
{
caught = true;
}
assert(caught == true);
//////////////////////////////
// Test accessing
for(int i = 0; i < 24; i++)
{
for(int j = 0; j < 100; j++)
{
assert(!hasPosition(i, j));
}
}
//////////////////////////////
// Test setting all
for(int i = 0; i < 24; i++)
{
for(int j = 0; j < 100; j++)
{
addPosition(i, j);
}
}
for(int i = 0; i < 24; i++)
{
for(int j = 0; j < 100; j++)
{
assert(hasPosition(i, j));
}
}
//////////////////////////////
// Test accessing out of range
assert(!hasPosition(-1, 0));
assert(!hasPosition(0, -1));
assert(!hasPosition(100, 0));
assert(!hasPosition(0, 1000));
//////////////////////////////
// Test adding more to ref 4,
// but skipping positions.
for(int j = 300; j < 350; j++)
{
addPosition(4, j);
}
for(int j = 0; j < 100; j++)
{
assert(hasPosition(4, j));
}
for(int j = 100; j < 300; j++)
{
assert(!hasPosition(4, j));
}
for(int j = 300; j < 350; j++)
{
assert(hasPosition(4, j));
}
// Test adding a new reference, 30,
// position 16.
addPosition(30, 16);
// Check the size now.
assert(myPosList.size() == 31);
for(int i = 0; i < 24; i++)
{
if(i != 4)
{
assert(myPosList.at(i).size() == 100);
}
else
{
assert(myPosList.at(i).size() == 350);
}
}
for(int i = 24; i < 31; i++)
{
assert(myPosList.at(i).size() == 350);
}
//////////////////////////////
// Test accessing
for(int i = 24; i < 30; i++)
{
for(int j = 0; j < 350; j++)
{
assert(!hasPosition(i, j));
}
}
for(int j = 0; j < 350; j++)
{
if(j != 16)
{
assert(!hasPosition(30, j));
}
else
{
assert(hasPosition(30, 16));
}
}
}
PosList::hasPosition
bool hasPosition(int refID, int refPosition)
Return whether or not this list contains the specified reference ID and position (negative values wil...
Definition: PosList.cpp:81
PosList::addPosition
void addPosition(int refID, int refPosition)
Add the specified reference id/position (negative values will not be added).
Definition: PosList.cpp:42

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

- bam/test/TestPosList.h
- bam/test/TestPosList.cpp