Commit 44d304b6 authored by Alexander Wiebel's avatar Alexander Wiebel

[ADD] tests that catch bug fixed in previous commit

parent 25ad9cc9
......@@ -137,11 +137,15 @@ public:
WPosition( 1, 0, 3 )
}
);
myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0, 1.0, 1.0 } );
myVisiTrace.m_candidatePositions.push_back(
{
WPosition( 1, 1, -3.5 ),
WPosition( 1, 1, -2.5 )
} );
myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0 } );
myVisiTrace.m_candidatePositions.push_back(
{
WPosition( 1, 1.2, 0 ),
......@@ -150,12 +154,79 @@ public:
WPosition( 1, 1.2, 3 )
}
);
myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0, 1.0, 1.0 } );
TS_ASSERT( myVisiTrace.m_candidatePositions.size() != 0 );
TS_ASSERT_THROWS_NOTHING( myVisiTrace.performDijkstra() );
TS_ASSERT( myVisiTrace.m_curve3D.size() !=0 );
TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[0], WPosition( 1, 0, 0 ) );
TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[1], WPosition( 1, 1, -2.5 ) );
TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[2], WPosition( 1, 1.2, 0 ) );
}
/**
* Does \ref addCandidatesForRay actually add positions
*/
void testAddingPositions()
{
WVisiTrace visiTraceAdding;
const size_t numCands1 = 11;
const size_t numCands2 = 12;
const size_t numCands3 = 13;
{
std::vector< std::pair< double, WPosition > > cands1;
const double someDoubleValue1 = 1.1;
for( size_t id = 0; id < numCands1; ++id )
{
cands1.push_back( std::make_pair( someDoubleValue1 * id, WPosition( someDoubleValue1 * id, someDoubleValue1, someDoubleValue1 ) ));
}
visiTraceAdding.addCandidatesForRay( cands1 );
}
{
std::vector< std::pair< double, WPosition > > cands2;
const double someDoubleValue2 = 1.2;
for( size_t id = 0; id < numCands2; ++id )
{
cands2.push_back( std::make_pair( someDoubleValue2 * id, WPosition( someDoubleValue2 * id, someDoubleValue2, someDoubleValue2 ) ));
}
visiTraceAdding.addCandidatesForRay( cands2 );
}
{
std::vector< std::pair< double, WPosition > > cands3;
const double someDoubleValue3 = 1.3;
for( size_t id = 0; id < numCands3; ++id )
{
cands3.push_back( std::make_pair( someDoubleValue3 * id, WPosition( someDoubleValue3 * id, someDoubleValue3, someDoubleValue3 ) ));
}
visiTraceAdding.addCandidatesForRay( cands3 );
}
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions.size(), 3 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidateJumps.size(), 3 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[0].size(), numCands1 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[1].size(), numCands2 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[2].size(), numCands3 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidateJumps[0].size(), numCands1 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidateJumps[1].size(), numCands2 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidateJumps[2].size(), numCands3 );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[0][0], WPosition( 0, 1.1, 1.1 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[0][1], WPosition( 1.1, 1.1, 1.1 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[0][10], WPosition( 11, 1.1, 1.1 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[1][0], WPosition( 0, 1.2, 1.2 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[1][1], WPosition( 1.2, 1.2, 1.2 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[1][10], WPosition( 12, 1.2, 1.2 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[2][0], WPosition( 0, 1.3, 1.3 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[2][1], WPosition( 1.3, 1.3, 1.3 ) );
TS_ASSERT_EQUALS( visiTraceAdding.m_candidatePositions[2][10], WPosition( 13, 1.3, 1.3 ) );
}
};
#endif // WVISITRACE_TEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment