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

Unit tests for BinningCmd (input command parsing/validation and parameter mapping). More...

#include <gtest/gtest.h>
#include "Ippl.h"
#include "Attributes/Attributes.h"
#include "Structure/BinningCmd.h"
#include "Utilities/OpalException.h"
#include <memory>
#include <string>
Include dependency graph for TestBinningCmd.cpp:

Go to the source code of this file.

Classes

class  TestableBinningCmd
 
class  BinningCmdTest
 

Functions

 TEST_F (BinningCmdTest, UpdateAppendsJsonExtensionAndValidatesFreq)
 
 TEST_F (BinningCmdTest, DumpBinsToFileRespectsNoneAndEmpty)
 
 TEST_F (BinningCmdTest, InvalidDumpFreqThrowsWhenDumpingEnabled)
 
 TEST_F (BinningCmdTest, InvalidTablePrintFrequencyThrowsWhenNegative)
 
 TEST_F (BinningCmdTest, ConstructionDefaults)
 
 TEST_F (BinningCmdTest, GettersReflectAttributes)
 
 TEST_F (BinningCmdTest, ExecuteMapsKnownParameters)
 
 TEST_F (BinningCmdTest, ExecuteThrowsOnUnknownParameter)
 
 TEST_F (BinningCmdTest, CloneCopiesState)
 
 TEST_F (BinningCmdTest, PrintInfoDoesNotThrow)
 

Detailed Description

Unit tests for BinningCmd (input command parsing/validation and parameter mapping).

This file tests the behavior of the OPAL command object BinningCmd, focusing on:

  • Default construction values (max bins, desired width, alpha/beta, default parameter, print frequency).
  • Getter/setter consistency via a small test helper (TestableBinningCmd) that writes to internal attributes using the standard Attributes interface.
  • update() validation logic:
    • Appending .json to DUMPBINSFILE when a filename is provided without the suffix.
    • Enforcing that DUMPBINSFREQ is positive when dumping is enabled.
    • Rejecting negative TABLEPRINTFREQ.
  • execute() behavior:
    • Mapping supported PARAMETER strings to the corresponding BinningParameter enum.
    • Throwing OpalException for unknown/unsupported parameter strings.
  • clone(name):
    • Copies attribute state and cached parameter selection into a new named command object.
  • printInfo():
    • Smoke test that the informational printing path can be invoked without throwing.

These tests ensure the object properly handles invalid configurations and is stable in its public API.

Definition in file TestBinningCmd.cpp.

Function Documentation

◆ TEST_F() [1/10]

TEST_F ( BinningCmdTest  ,
CloneCopiesState   
)

Definition at line 221 of file TestBinningCmd.cpp.

◆ TEST_F() [2/10]

◆ TEST_F() [3/10]

TEST_F ( BinningCmdTest  ,
DumpBinsToFileRespectsNoneAndEmpty   
)

Definition at line 106 of file TestBinningCmd.cpp.

◆ TEST_F() [4/10]

TEST_F ( BinningCmdTest  ,
ExecuteMapsKnownParameters   
)

Definition at line 185 of file TestBinningCmd.cpp.

References GAMMAZ, POSITIONZ, PZ, and VELOCITYZ.

◆ TEST_F() [5/10]

TEST_F ( BinningCmdTest  ,
ExecuteThrowsOnUnknownParameter   
)

Definition at line 210 of file TestBinningCmd.cpp.

◆ TEST_F() [6/10]

TEST_F ( BinningCmdTest  ,
GettersReflectAttributes   
)

Definition at line 158 of file TestBinningCmd.cpp.

◆ TEST_F() [7/10]

TEST_F ( BinningCmdTest  ,
InvalidDumpFreqThrowsWhenDumpingEnabled   
)

Definition at line 121 of file TestBinningCmd.cpp.

◆ TEST_F() [8/10]

TEST_F ( BinningCmdTest  ,
InvalidTablePrintFrequencyThrowsWhenNegative   
)

Definition at line 132 of file TestBinningCmd.cpp.

◆ TEST_F() [9/10]

TEST_F ( BinningCmdTest  ,
PrintInfoDoesNotThrow   
)

Definition at line 249 of file TestBinningCmd.cpp.

References BinningCmd::printInfo().

Here is the call graph for this function:

◆ TEST_F() [10/10]

TEST_F ( BinningCmdTest  ,
UpdateAppendsJsonExtensionAndValidatesFreq   
)

Definition at line 90 of file TestBinningCmd.cpp.