![]() |
Peano
|
#include <TestHelpers.h>
Public Member Functions | |
TestHelpers () | |
virtual void | run () override |
This routine is triggered by the TestCaseCollection. | |
![]() | |
TestCase (const std::string &testCaseName) | |
Constructor. | |
virtual | ~TestCase () |
Destructor. | |
int | getNumberOfErrors () const |
std::string | getTestCaseName () const |
Private Member Functions | |
void | testTruthTableSearchAndIDKeys () |
Test whether ParticleIdentifier and ParticleSearchIdentifier work as intended in a map for a fuzzy search. | |
void | testAddingSweepsToDatabase () |
Make sure that adding mesh sweeps to the database works. | |
void | testAddingParticleEvents () |
Test the adding of particle events to the database. | |
void | testRemovingParticleEvents () |
Test the removal of particle events once their history gets too long. | |
void | testParticleMoveEvents () |
Test adding move events of particles. | |
void | testAddingParticleMovingEvents (int nsweeps=100, int nEventsToKeep=1000) |
Test the adding of particle events to the database with a moving particle. | |
void | testParticleWalkSameTreeLevel () |
Test a particle walking from vertex to vertex on the same depth of the tree, i.e. | |
void | testParticleLiftDrop () |
Test a particle being assigned up and down the vertex hierarchy. | |
void | testParticleWalk () |
Test a particle walking through the box using lift-drop vertex assignments. | |
void | testPeriodicBoundaryConditions () |
Particles are identified in the events database using their unique ID. | |
void | testPeriodicBoundaryConditionsCorner () |
Test the periodic boundary conditions of a particle in a corner, being replicated to any other corner of the box. | |
void | testSieveSet () |
Test particle assignments to sieve sets. | |
Additional Inherited Members | |
![]() | |
TestCase ()=delete | |
![]() | |
const std::string | _testCaseName |
Name of the test case. | |
int | _errors |
Error counter. | |
bool | _error |
Indicate within macro if one specific validation failed. | |
Definition at line 88 of file TestHelpers.h.
toolbox::particles::assignmentchecks::tests::TestHelpers::TestHelpers | ( | ) |
Definition at line 18 of file TestHelpers.cpp.
|
overridevirtual |
This routine is triggered by the TestCaseCollection.
Implements tarch::tests::TestCase.
Definition at line 2226 of file TestHelpers.cpp.
References testMethod.
|
private |
Test the adding of particle events to the database.
This also serves as a unit test for all possible events: I let the particles run through some meaningless mesh sweeps, and add all the event types.
Here, I only use static particles, so the identifier remains the same all the time. Switching particle identifiers will be done in a separate test. We're also adding events without them having any meaning. Proper event tracing including consistency checks will also be done later.
Definition at line 332 of file TestHelpers.cpp.
References assertion3, assertion4, logDebug, logTraceIn, and logTraceOut.
|
private |
Test the adding of particle events to the database with a moving particle.
The catch is twofold: Firstly, the fuzzy search needs to work. Secondly, a moving particle will eventually need to change its identifier in the database. This tests both of these cases, but not the event deletion when the database becomes too large.
We're also adding events without them having any meaning. Proper event tracing including consistency checks will also be done in a different test.
Note that this stupidly just adds new move events to the database. This is not what we do in the actual tracing, where consecutive move events are compacted into a single one. That too will be tested in different test methods. Here we just test the adding of events and the replacement of the identifier once a particle has moved too much.
nsweeps | How many mesh sweeps to simulate. |
nEventsToKeep | How many events per particle the database should keep. If < nsweeps , then events from the database will be purged. |
Definition at line 616 of file TestHelpers.cpp.
References assertion2, assertion6, dx, logDebug, logTraceInWith2Arguments, and logTraceOut.
|
private |
Make sure that adding mesh sweeps to the database works.
Definition at line 263 of file TestHelpers.cpp.
References assertion3, assertion4, logTraceIn, and logTraceOut.
|
private |
Test a particle being assigned up and down the vertex hierarchy.
Definition at line 927 of file TestHelpers.cpp.
References assertion2, assertion3, toolbox::particles::assignmentchecks::tests::internal::dropParticle(), toolbox::particles::assignmentchecks::tests::internal::findVertexX(), toolbox::particles::assignmentchecks::tests::internal::liftParticle(), logDebug, logTraceIn, and logTraceOut.
|
private |
Test adding move events of particles.
Calls testAddingParticleMovingEvents() with different configurations.
Definition at line 607 of file TestHelpers.cpp.
|
private |
Test a particle walking through the box using lift-drop vertex assignments.
Definition at line 1105 of file TestHelpers.cpp.
References assertion, toolbox::particles::assignmentchecks::tests::internal::dropParticle(), dx, toolbox::particles::assignmentchecks::tests::internal::findVertexX(), toolbox::particles::assignmentchecks::tests::internal::liftParticle(), logDebug, logTraceIn, and logTraceOut.
|
private |
Test a particle walking from vertex to vertex on the same depth of the tree, i.e.
assignments from vertex to vertex without lifts and drops.
Definition at line 736 of file TestHelpers.cpp.
References assertion2, assertion3, dx, toolbox::particles::assignmentchecks::tests::internal::findVertexInd(), toolbox::particles::assignmentchecks::tests::internal::findVertexX(), logDebug, logTraceIn, and logTraceOut.
|
private |
Particles are identified in the events database using their unique ID.
However, if we have periodic boundary conditions, we may find that particles with the same ID exist several times on the same tree, on either side of the boundary, provided the tree spans both edges of the domain. So check that we indeed find the correct ancestors.
Definition at line 1297 of file TestHelpers.cpp.
References assertion, toolbox::particles::assignmentchecks::tests::internal::dropParticle(), dx, toolbox::particles::assignmentchecks::tests::internal::findVertexInd(), toolbox::particles::assignmentchecks::tests::internal::findVertexX(), toolbox::particles::assignmentchecks::tests::TestParticle::getPartid(), toolbox::particles::assignmentchecks::tests::TestParticle::getVertexH(), toolbox::particles::assignmentchecks::tests::TestParticle::getX(), toolbox::particles::assignmentchecks::tests::internal::liftParticle(), logDebug, logTraceIn, logTraceOut, tarch::la::oneSmaller(), toolbox::particles::assignmentchecks::tests::TestParticle::setDepth(), and toolbox::particles::assignmentchecks::tests::TestParticle::setVertexH().
|
private |
Test the periodic boundary conditions of a particle in a corner, being replicated to any other corner of the box.
The assignment checks struggled with PBCs in the past, and they also had several bugs in it. So this test should prevent them from reoccurring. We assume that particles never cross the boundary.
Definition at line 1676 of file TestHelpers.cpp.
References assertion, toolbox::particles::assignmentchecks::tests::internal::dropParticle(), dx, toolbox::particles::assignmentchecks::tests::internal::findVertexInd(), toolbox::particles::assignmentchecks::tests::internal::findVertexX(), toolbox::particles::assignmentchecks::tests::internal::liftParticle(), logDebug, logTraceIn, logTraceOut, and toolbox::particles::assignmentchecks::tests::internal::mirrorParticleAlongPeriodicBoundary().
|
private |
Test the removal of particle events once their history gets too long.
Definition at line 484 of file TestHelpers.cpp.
References assertion3, logTraceIn, and logTraceOut.
|
private |
Test particle assignments to sieve sets.
Definition at line 2039 of file TestHelpers.cpp.
References assertion2, assertion5, dx, toolbox::particles::assignmentchecks::tests::internal::findVertexX(), logDebug, logTraceIn, and logTraceOut.
|
private |
Test whether ParticleIdentifier and ParticleSearchIdentifier work as intended in a map for a fuzzy search.
Definition at line 133 of file TestHelpers.cpp.
References a, assert, assertion, logDebug, logTraceIn, and logTraceOut.