OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestMonitor.cpp File Reference

Unit tests for lightweight Monitor behavior. More...

#include <gtest/gtest.h>
#include "Ippl.h"
#include "AbsBeamline/Monitor.h"
#include "Fields/EMField.h"
#include <memory>
Include dependency graph for TestMonitor.cpp:

Go to the source code of this file.

Classes

class  DummyMonitorField
 
class  TestMonitor
 
class  MonitorTest
 

Macros

#define private   public
 

Functions

 TEST_F (MonitorTest, GetType)
 
 TEST_F (MonitorTest, Bends)
 
 TEST_F (MonitorTest, RequiredNumberOfTimeStepsIsOne)
 
 TEST_F (MonitorTest, GetFieldExtendUsesMonitorHalfLength)
 
 TEST_F (MonitorTest, DefaultCollectionTypeIsSpatial)
 
 TEST_F (MonitorTest, SetCollectionTypeUpdatesCollectionMode)
 
 TEST_F (MonitorTest, PlaneDefaultsToOff)
 
 TEST_F (MonitorTest, PlaneCanBeSetInConcreteTestMonitor)
 
 TEST_F (MonitorTest, IsInsideAcceptsPointsWithinElementLength)
 
 TEST_F (MonitorTest, IsInsideRejectsPointsOutsideElementLength)
 
 TEST_F (MonitorTest, ApplyNullParticleContainerReturnsFalse)
 
 TEST_F (MonitorTest, ApplyToReferenceParticleWithoutReferenceBunchReturnsFalse)
 
 TEST_F (MonitorTest, FieldOnlyApplyOverloadReturnsFalseAndLeavesFieldsUnchanged)
 
 TEST_F (MonitorTest, GoOfflineWithoutLossDataSinkIsSafe)
 

Detailed Description

Unit tests for lightweight Monitor behavior.

This test suite validates basic Monitor behavior using:

  • a minimal concrete Monitor implementation
  • direct access to internal state where needed
  • a single-rank initialized IPPL/MPI environment

Coverage

  1. Basic API
    • getType()
    • bends()
    • getRequiredNumberOfTimeSteps()
    • getFieldExtend()
  2. Collection type bookkeeping
    • default collection type is SPATIAL
    • setCollectionType() updates the stored collection mode
  3. Geometry / containment
    • isInside() accepts points inside the monitor length
    • isInside() rejects points outside the monitor length
  4. Safe early-return behavior
    • apply(nullptr) returns false
    • applyToReferenceParticle() returns false without a reference bunch
    • goOffline() is safe before a LossDataSink is created

Notes

  • Monitor is field-free. The dummy field exists only to satisfy the abstract Component interface in the concrete test class.
  • These tests intentionally avoid file-output checks. They focus on behavior that can be verified without constructing a full PartBunch/ParticleContainer tracking setup.

Definition in file TestMonitor.cpp.

Macro Definition Documentation

◆ private

#define private   public

Definition at line 49 of file TestMonitor.cpp.

Function Documentation

◆ TEST_F() [1/14]

TEST_F ( MonitorTest  ,
ApplyNullParticleContainerReturnsFalse   
)

Definition at line 204 of file TestMonitor.cpp.

References Monitor::apply().

Here is the call graph for this function:

◆ TEST_F() [2/14]

TEST_F ( MonitorTest  ,
ApplyToReferenceParticleWithoutReferenceBunchReturnsFalse   
)

Definition at line 210 of file TestMonitor.cpp.

References Monitor::applyToReferenceParticle(), and Monitor::goOnline().

Here is the call graph for this function:

◆ TEST_F() [3/14]

TEST_F ( MonitorTest  ,
Bends   
)

Definition at line 119 of file TestMonitor.cpp.

References Monitor::bends().

Here is the call graph for this function:

◆ TEST_F() [4/14]

TEST_F ( MonitorTest  ,
DefaultCollectionTypeIsSpatial   
)

Definition at line 146 of file TestMonitor.cpp.

References SPATIAL, and Monitor::type_m.

◆ TEST_F() [5/14]

TEST_F ( MonitorTest  ,
FieldOnlyApplyOverloadReturnsFalseAndLeavesFieldsUnchanged   
)

Definition at line 223 of file TestMonitor.cpp.

References Monitor::apply().

Here is the call graph for this function:

◆ TEST_F() [6/14]

TEST_F ( MonitorTest  ,
GetFieldExtendUsesMonitorHalfLength   
)

Definition at line 131 of file TestMonitor.cpp.

References Monitor::getFieldExtend().

Here is the call graph for this function:

◆ TEST_F() [7/14]

TEST_F ( MonitorTest  ,
GetType   
)

Definition at line 113 of file TestMonitor.cpp.

References Monitor::getType(), and MONITOR.

Here is the call graph for this function:

◆ TEST_F() [8/14]

TEST_F ( MonitorTest  ,
GoOfflineWithoutLossDataSinkIsSafe   
)

Definition at line 250 of file TestMonitor.cpp.

References Monitor::goOffline().

Here is the call graph for this function:

◆ TEST_F() [9/14]

TEST_F ( MonitorTest  ,
IsInsideAcceptsPointsWithinElementLength   
)

Definition at line 184 of file TestMonitor.cpp.

References Monitor::isInside(), and TestMonitor::setLength().

Here is the call graph for this function:

◆ TEST_F() [10/14]

TEST_F ( MonitorTest  ,
IsInsideRejectsPointsOutsideElementLength   
)

Definition at line 193 of file TestMonitor.cpp.

References Monitor::isInside(), and TestMonitor::setLength().

Here is the call graph for this function:

◆ TEST_F() [11/14]

TEST_F ( MonitorTest  ,
PlaneCanBeSetInConcreteTestMonitor   
)

Definition at line 173 of file TestMonitor.cpp.

References TestMonitor::getPlane(), TestMonitor::setPlane(), and Monitor::XY.

Here is the call graph for this function:

◆ TEST_F() [12/14]

TEST_F ( MonitorTest  ,
PlaneDefaultsToOff   
)

Definition at line 167 of file TestMonitor.cpp.

References TestMonitor::getPlane(), and Monitor::OFF.

Here is the call graph for this function:

◆ TEST_F() [13/14]

TEST_F ( MonitorTest  ,
RequiredNumberOfTimeStepsIsOne   
)

Definition at line 125 of file TestMonitor.cpp.

References Monitor::getRequiredNumberOfTimeSteps().

Here is the call graph for this function:

◆ TEST_F() [14/14]

TEST_F ( MonitorTest  ,
SetCollectionTypeUpdatesCollectionMode   
)

Definition at line 152 of file TestMonitor.cpp.

References Monitor::setCollectionType(), SPATIAL, TEMPORAL, and Monitor::type_m.

Here is the call graph for this function: