Skip to content

Commit

Permalink
fix Tests directory
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Jan 30, 2025
1 parent 18889f1 commit fa59d56
Show file tree
Hide file tree
Showing 27 changed files with 55 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ struct CubicTrackingGeometry {
/// Default constructor for the Cubic tracking geometry
///
/// @param gctx the geometry context for this geometry at building time
CubicTrackingGeometry(const GeometryContext& gctx) : geoContext(gctx) {
explicit CubicTrackingGeometry(const GeometryContext& gctx)
: geoContext(gctx) {
using namespace UnitLiterals;

// Construct the rotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct CylindricalTrackingGeometry {
std::reference_wrapper<const GeometryContext> geoContext;

/// Only allowed constructor with reference wrapper
CylindricalTrackingGeometry(const GeometryContext& gctx) : geoContext(gctx) {}
explicit CylindricalTrackingGeometry(const GeometryContext& gctx)
: geoContext(gctx) {}

using DetectorStore = std::vector<std::unique_ptr<const DetectorElementStub>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DetectorElementStub : public DetectorElementBase {
public:
DetectorElementStub() : DetectorElementBase() {}

DetectorElementStub(const Transform3& transform)
explicit DetectorElementStub(const Transform3& transform)
: DetectorElementBase(), m_elementTransform(transform) {}

/// Constructor for single sided detector element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class LineSurfaceStub : public LineSurface {
LineSurfaceStub(const Transform3& htrans, double radius, double halfz)
: GeometryObject(), LineSurface(htrans, radius, halfz) { /* nop */ }
//
LineSurfaceStub(const Transform3& htrans,
std::shared_ptr<const LineBounds> lbounds = nullptr)
explicit LineSurfaceStub(const Transform3& htrans,
std::shared_ptr<const LineBounds> lbounds = nullptr)
: GeometryObject(), LineSurface(htrans, std::move(lbounds)) { /*nop */ }
//
LineSurfaceStub(std::shared_ptr<const LineBounds> lbounds,
Expand Down
2 changes: 1 addition & 1 deletion Tests/IntegrationTests/InterpolatedSolenoidBFieldTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ auto bFieldMap = makeFieldMap(bSolenoidField);
auto bCache = bFieldMap.makeCache(Acts::MagneticFieldContext{});

struct StreamWrapper {
StreamWrapper(std::ofstream ofstr) : m_ofstr(std::move(ofstr)) {
explicit StreamWrapper(std::ofstream ofstr) : m_ofstr(std::move(ofstr)) {
m_ofstr << "x;y;z;B_x;B_y;B_z;Bm_x;Bm_y;Bm_z" << std::endl;
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Alignment/Kernel/AlignmentTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct TelescopeDetector {
/// Default constructor for the Cubic tracking geometry
///
/// @param gctx the geometry context for this geometry at building time
TelescopeDetector(std::reference_wrapper<const GeometryContext> gctx)
explicit TelescopeDetector(std::reference_wrapper<const GeometryContext> gctx)
: geoContext(gctx) {
// Construct the rotation
rotation.col(0) = Acts::Vector3(0, 0, -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Acts::Test {

struct Cell1D {
Cell1D(int colv) : col(colv) {}
explicit Cell1D(int colv) : col(colv) {}
int col;
Ccl::Label label{Ccl::NO_LABEL};
};
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Detector/DetectorBuilderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class CompBuilder final : public Acts::Experimental::IDetectorComponentBuilder {
public:
CompBuilder(
explicit CompBuilder(
const std::vector<std::shared_ptr<Acts::Surface>>& sensitives = {})
: m_sensitives(sensitives) {}

Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Detector/PortalTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class LinkToVolumeImpl : public IExternalNavigation {
std::shared_ptr<DetectorVolume> dVolume = nullptr;

/// Constructor from volume
LinkToVolumeImpl(std::shared_ptr<DetectorVolume> dv)
explicit LinkToVolumeImpl(std::shared_ptr<DetectorVolume> dv)
: dVolume(std::move(dv)) {}

/// @return the link to the contained volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Adapter {
using ValueType = value_type;

Adapter(SpacePointCollection&&) = delete;
Adapter(const SpacePointCollection& externalCollection)
explicit Adapter(const SpacePointCollection& externalCollection)
: m_storage(&externalCollection) {}

private:
Expand Down
5 changes: 3 additions & 2 deletions Tests/UnitTests/Core/Geometry/AlignmentContextTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ struct AlignmentContext {
AlignmentContext() = default;

/// Constructor with Store and context index
AlignmentContext(std::shared_ptr<const std::array<Transform3, 2>> aStore,
unsigned int aIndex = 0)
explicit AlignmentContext(
std::shared_ptr<const std::array<Transform3, 2>> aStore,
unsigned int aIndex = 0)
: alignmentStore(std::move(aStore)), alignmentIndex(aIndex) {}
};

Expand Down
7 changes: 4 additions & 3 deletions Tests/UnitTests/Core/Geometry/LayerStub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class LayerStub : virtual public SurfaceStub, public Layer {
/// copy constructor (deleted in Surface baseclass)
LayerStub(const LayerStub& otherLayer) = delete;
/// constructor with pointer to SurfaceArray (protected in Layer baseclass)
LayerStub(std::unique_ptr<SurfaceArray> surfaceArray, double thickness = 0,
std::unique_ptr<ApproachDescriptor> ad = nullptr,
LayerType ltype = passive)
explicit LayerStub(std::unique_ptr<SurfaceArray> surfaceArray,
double thickness = 0,
std::unique_ptr<ApproachDescriptor> ad = nullptr,
LayerType ltype = passive)
: SurfaceStub(),
Layer(std::move(surfaceArray), thickness, std::move(ad), ltype) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ template <typename Callable>
struct CallableHook : public Acts::GeometryIdentifierHook {
Callable callable;

CallableHook(const Callable& c) : callable(c) {}
explicit CallableHook(const Callable& c) : callable(c) {}

Acts::GeometryIdentifier decorateIdentifier(
Acts::GeometryIdentifier identifier,
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GlobalToZPhi final : public Acts::GridAccess::IGlobalToGridLocal {
public:
double zShift = 0.;

GlobalToZPhi(double shift) : zShift(shift) {}
explicit GlobalToZPhi(double shift) : zShift(shift) {}

std::array<double, 2u> g2ZPhi(const Acts::Vector3& global) const {
return {global.z() + zShift, Acts::VectorHelpers::phi(global)};
Expand All @@ -48,7 +48,7 @@ class LocalToZPhi final : public Acts::GridAccess::IBoundToGridLocal {
public:
double radius = 1.;

LocalToZPhi(double r) : radius(r) {}
explicit LocalToZPhi(double r) : radius(r) {}

std::array<double, 2u> l2ZPhi(const Acts::Vector2& local) const {
return {local[1u], local[0u] / radius};
Expand Down
3 changes: 2 additions & 1 deletion Tests/UnitTests/Core/Material/MaterialMapperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class IntersectSurfacesFinder : public IAssignmentFinder {
/// @brief Interface for the material mapping, this is the accumulation step
class MaterialBlender : public ISurfaceMaterialAccumulater {
public:
MaterialBlender(const std::vector<std::shared_ptr<Surface>>& surfaces = {})
explicit MaterialBlender(
const std::vector<std::shared_ptr<Surface>>& surfaces = {})
: m_surfaces(surfaces) {}

/// The state of the material accumulater, this is used
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ using Stepper = Acts::AtlasStepper;

/// Simplified propagator state.
struct MockPropagatorState {
MockPropagatorState(Stepper::State stepperState)
explicit MockPropagatorState(Stepper::State stepperState)
: stepping(std::move(stepperState)) {}

/// Stepper state.
Expand Down
6 changes: 4 additions & 2 deletions Tests/UnitTests/Core/Seeding/SpacePointContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ class SpacePointContainer {
// the memory backend is independetly handled. This is only interfacing it to
// ACTS
SpacePointContainer(CollectionType&& container) = delete;
SpacePointContainer(CollectionType& container) : m_storage(container) {}
SpacePointContainer(CollectionType* container) : m_storage(container) {}
explicit SpacePointContainer(CollectionType& container)
: m_storage(container) {}
explicit SpacePointContainer(CollectionType* container)
: m_storage(container) {}

// No copy constructor or copy operation allowed
SpacePointContainer(const SpacePointContainer<collection_t>&) = delete;
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ namespace Acts {
/// Surface derived class stub
class SurfaceStub : public RegularSurface {
public:
SurfaceStub(const Transform3& htrans = Transform3::Identity())
explicit SurfaceStub(const Transform3& htrans = Transform3::Identity())
: GeometryObject(), RegularSurface(htrans) {}
SurfaceStub(const GeometryContext& gctx, const SurfaceStub& sf,
const Transform3& transf)
: GeometryObject(), RegularSurface(gctx, sf, transf) {}
SurfaceStub(const DetectorElementBase& detelement)
explicit SurfaceStub(const DetectorElementBase& detelement)
: GeometryObject(), RegularSurface(detelement) {}

~SurfaceStub() override = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct Detector {
{Acts::GeometryIdentifier().setVolume(3).setLayer(8), resStrip1},
};

Detector(const Acts::GeometryContext& geoCtx)
explicit Detector(const Acts::GeometryContext& geoCtx)
: store(geoCtx), geometry(store()) {}
};

Expand Down Expand Up @@ -208,7 +208,7 @@ struct Fixture {

std::unique_ptr<const Acts::Logger> logger;

Fixture(double bz)
explicit Fixture(double bz)
: detector(geoCtx),
ckf(makeConstantFieldPropagator(detector.geometry, bz)),
logger(Acts::getDefaultLogger("CkfTest", Acts::Logging::INFO)) {
Expand Down
6 changes: 4 additions & 2 deletions Tests/UnitTests/Core/TrackFitting/GsfTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ auto makeDefaultGsfOptions() {
struct MultiCmpsParsInterface : public BoundTrackParameters {
MultiComponentBoundTrackParameters multi_pars;

MultiCmpsParsInterface(const MultiComponentBoundTrackParameters &p)
explicit MultiCmpsParsInterface(const MultiComponentBoundTrackParameters &p)
: BoundTrackParameters(p.referenceSurface().getSharedPtr(),
p.parameters(), p.covariance(), electron),
multi_pars(p) {}

operator MultiComponentBoundTrackParameters() const { return multi_pars; }
explicit operator MultiComponentBoundTrackParameters() const {
return multi_pars;
}
};

auto makeParameters() {
Expand Down
12 changes: 6 additions & 6 deletions Tests/UnitTests/Core/Utilities/AnyTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(AnyConstructCustom) {
BOOST_AUTO_TEST_CASE(AnyConstructCustomInPlace) {
struct A {
int value;
A(int v) { value = v; }
explicit A(int v) { value = v; }
};

Any a{std::in_place_type<A>, 42};
Expand Down Expand Up @@ -174,15 +174,15 @@ BOOST_AUTO_TEST_CASE(AnyCopy) {

struct D {
bool* destroyed;
D(bool* d) : destroyed{d} {}
explicit D(bool* d) : destroyed{d} {}
~D() { *destroyed = true; }
};

struct D2 {
bool* destroyed{nullptr};
std::array<char, 512> blob{};

D2(bool* d) : destroyed{d} {}
explicit D2(bool* d) : destroyed{d} {}

~D2() { *destroyed = true; }
};
Expand Down Expand Up @@ -337,7 +337,7 @@ struct D3 {
std::size_t* destroyed{nullptr};
std::array<char, 512> blob{};

D3(std::size_t* d) : destroyed{d} {}
explicit D3(std::size_t* d) : destroyed{d} {}

~D3() { (*destroyed)++; }
};
Expand Down Expand Up @@ -372,7 +372,7 @@ template <>
struct Lifecycle<0> {
LifecycleCounters* counters;

Lifecycle(LifecycleCounters* _counters) : counters{_counters} {}
explicit Lifecycle(LifecycleCounters* _counters) : counters{_counters} {}

Lifecycle(Lifecycle&& o) {
counters = o.counters;
Expand Down Expand Up @@ -403,7 +403,7 @@ template <std::size_t PADDING>
struct Lifecycle : public Lifecycle<0> {
std::array<char, PADDING> m_padding{};

Lifecycle(LifecycleCounters* _counters) : Lifecycle<0>(_counters) {}
explicit Lifecycle(LifecycleCounters* _counters) : Lifecycle<0>(_counters) {}
};

template <std::size_t PADDING>
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Utilities/DelegateTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(StatefullLambdas) {
}

struct CheckDestructor {
CheckDestructor(bool* _out) : destructorCalled{_out} {}
explicit CheckDestructor(bool* _out) : destructorCalled{_out} {}

bool* destructorCalled;

Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Core/Utilities/ResultTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(TestErrorCodes) {
}

struct NoCopy {
NoCopy(int i) : num(i) {}
explicit NoCopy(int i) : num(i) {}
NoCopy(const NoCopy&) = delete;
NoCopy& operator=(const NoCopy&) = delete;
NoCopy(NoCopy&&) = default;
Expand All @@ -253,7 +253,7 @@ Result<NoCopy> make_nocopy(int i, bool v = true) {
if (!v) {
return MyError::Failure;
}
return i;
return NoCopy{i};
}

BOOST_AUTO_TEST_CASE(CopyBehaviour) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ std::uniform_int_distribution<std::uint32_t> nTracksDist(3, 10);

// Dummy user-defined InputTrack type
struct InputTrackStub {
InputTrackStub(const BoundTrackParameters& params) : m_parameters(params) {}
explicit InputTrackStub(const BoundTrackParameters& params)
: m_parameters(params) {}

const BoundTrackParameters& parameters() const { return m_parameters; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ std::uniform_int_distribution<std::uint32_t> nTracksDist(5, 15);

// Dummy user-defined InputTrack type
struct InputTrackStub {
InputTrackStub(const BoundTrackParameters& params) : m_parameters(params) {}
explicit InputTrackStub(const BoundTrackParameters& params)
: m_parameters(params) {}

const BoundTrackParameters& parameters() const { return m_parameters; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_random_test) {

// Dummy user-defined InputTrackStub type
struct InputTrackStub {
InputTrackStub(const BoundTrackParameters& params) : m_parameters(params) {}
explicit InputTrackStub(const BoundTrackParameters& params)
: m_parameters(params) {}

const BoundTrackParameters& parameters() const { return m_parameters; }

Expand Down
3 changes: 2 additions & 1 deletion Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) {

// Dummy user-defined InputTrackStub type
struct InputTrackStub {
InputTrackStub(const BoundTrackParameters& params) : m_parameters(params) {}
explicit InputTrackStub(const BoundTrackParameters& params)
: m_parameters(params) {}

const BoundTrackParameters& parameters() const { return m_parameters; }

Expand Down

0 comments on commit fa59d56

Please sign in to comment.