Peano
Loading...
Searching...
No Matches
toolbox::particles::assignmentchecks::tests::TestHelpers Class Reference

#include <TestHelpers.h>

Inheritance diagram for toolbox::particles::assignmentchecks::tests::TestHelpers:
Collaboration diagram for toolbox::particles::assignmentchecks::tests::TestHelpers:

Public Member Functions

 TestHelpers ()
 
virtual void run () override
 This routine is triggered by the TestCaseCollection.
 
- Public Member Functions inherited from tarch::tests::TestCase
 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

- Protected Member Functions inherited from tarch::tests::TestCase
 TestCase ()=delete
 
- Protected Attributes inherited from tarch::tests::TestCase
const std::string _testCaseName
 Name of the test case.
 
int _errors
 Error counter.
 
bool _error
 Indicate within macro if one specific validation failed.
 

Detailed Description

Definition at line 88 of file TestHelpers.h.

Constructor & Destructor Documentation

◆ TestHelpers()

toolbox::particles::assignmentchecks::tests::TestHelpers::TestHelpers ( )

Definition at line 18 of file TestHelpers.cpp.

Member Function Documentation

◆ run()

void toolbox::particles::assignmentchecks::tests::TestHelpers::run ( )
overridevirtual

This routine is triggered by the TestCaseCollection.

Implements tarch::tests::TestCase.

Definition at line 2226 of file TestHelpers.cpp.

References testMethod.

◆ testAddingParticleEvents()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testAddingParticleEvents ( )
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.

◆ testAddingParticleMovingEvents()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testAddingParticleMovingEvents ( int nsweeps = 100,
int nEventsToKeep = 1000 )
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.

Parameters
nsweepsHow many mesh sweeps to simulate.
nEventsToKeepHow 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.

◆ testAddingSweepsToDatabase()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testAddingSweepsToDatabase ( )
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.

◆ testParticleLiftDrop()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testParticleLiftDrop ( )
private

◆ testParticleMoveEvents()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testParticleMoveEvents ( )
private

Test adding move events of particles.

Calls testAddingParticleMovingEvents() with different configurations.

Definition at line 607 of file TestHelpers.cpp.

◆ testParticleWalk()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testParticleWalk ( )
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.

Here is the call graph for this function:

◆ testParticleWalkSameTreeLevel()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testParticleWalkSameTreeLevel ( )
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.

Here is the call graph for this function:

◆ testPeriodicBoundaryConditions()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testPeriodicBoundaryConditions ( )
private

◆ testPeriodicBoundaryConditionsCorner()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testPeriodicBoundaryConditionsCorner ( )
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().

Here is the call graph for this function:

◆ testRemovingParticleEvents()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testRemovingParticleEvents ( )
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.

◆ testSieveSet()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testSieveSet ( )
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.

Here is the call graph for this function:

◆ testTruthTableSearchAndIDKeys()

void toolbox::particles::assignmentchecks::tests::TestHelpers::testTruthTableSearchAndIDKeys ( )
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.


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