Skip to content

Commit

Permalink
unit test for seed edm
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarni authored and cvarni committed Sep 24, 2024
1 parent 0a1093b commit 7cecdb5
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 1 deletion.
1 change: 0 additions & 1 deletion Core/include/Acts/EventData/Seed.ipp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// -*- C++ -*-
// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Core/EventData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ add_unittest(TrackStatePropMask TrackStatePropMaskTests.cpp)
add_unittest(ParticleHypothesis ParticleHypothesisTests.cpp)
add_unittest(MultiTrajectoryHelpers MultiTrajectoryHelpersTests.cpp)
add_unittest(SubspaceHelpers SubspaceHelpersTests.cpp)
add_unittest(SeedEdm SeedEdmTests.cpp)

add_non_compile_test(MultiTrajectory TrackContainerComplianceTests.cpp)
87 changes: 87 additions & 0 deletions Tests/UnitTests/Core/EventData/SeedEdmTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <boost/test/unit_test.hpp>

#include "Acts/EventData/Seed.hpp"

namespace Acts::Test {

struct SpacePoint {};

BOOST_AUTO_TEST_CASE(seed_edm_default) {
std::array<Acts::Test::SpacePoint, 3> storage{};
storage[0] = SpacePoint();
storage[1] = SpacePoint();
storage[2] = SpacePoint();

Seed<Acts::Test::SpacePoint> seed(storage[0], storage[1], storage[2]);
const std::array<const Acts::Test::SpacePoint*, 3> sps = seed.sp();
BOOST_CHECK_NE(sps[0], nullptr);
BOOST_CHECK_NE(sps[1], nullptr);
BOOST_CHECK_NE(sps[2], nullptr);
BOOST_CHECK_EQUAL(sps[0], &storage[0]);
BOOST_CHECK_EQUAL(sps[1], &storage[1]);
BOOST_CHECK_EQUAL(sps[2], &storage[2]);

seed.setZvertex(-1.2f);
BOOST_CHECK_EQUAL(seed.z(), -1.2f);

seed.setQuality(345.23f);
BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
}

BOOST_AUTO_TEST_CASE(seed_edm_3d) {
std::array<Acts::Test::SpacePoint, 3> storage{};
storage[0] = SpacePoint();
storage[1] = SpacePoint();
storage[2] = SpacePoint();

Seed<Acts::Test::SpacePoint, 3> seed(storage[0], storage[1], storage[2]);
const std::array<const Acts::Test::SpacePoint*, 3> sps = seed.sp();
BOOST_CHECK_NE(sps[0], nullptr);
BOOST_CHECK_NE(sps[1], nullptr);
BOOST_CHECK_NE(sps[2], nullptr);
BOOST_CHECK_EQUAL(sps[0], &storage[0]);
BOOST_CHECK_EQUAL(sps[1], &storage[1]);
BOOST_CHECK_EQUAL(sps[2], &storage[2]);

seed.setZvertex(-1.2f);
BOOST_CHECK_EQUAL(seed.z(), -1.2f);

seed.setQuality(345.23f);
BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
}

BOOST_AUTO_TEST_CASE(seed_edm_4d) {
std::array<Acts::Test::SpacePoint, 4> storage{};
storage[0] = SpacePoint();
storage[1] = SpacePoint();
storage[2] = SpacePoint();
storage[3] = SpacePoint();

Seed<Acts::Test::SpacePoint, 4> seed(storage[0], storage[1], storage[2],
storage[3]);
const std::array<const Acts::Test::SpacePoint*, 4> sps = seed.sp();
BOOST_CHECK_NE(sps[0], nullptr);
BOOST_CHECK_NE(sps[1], nullptr);
BOOST_CHECK_NE(sps[2], nullptr);
BOOST_CHECK_NE(sps[3], nullptr);
BOOST_CHECK_EQUAL(sps[0], &storage[0]);
BOOST_CHECK_EQUAL(sps[1], &storage[1]);
BOOST_CHECK_EQUAL(sps[2], &storage[2]);
BOOST_CHECK_EQUAL(sps[3], &storage[3]);

seed.setZvertex(-1.2f);
BOOST_CHECK_EQUAL(seed.z(), -1.2f);

seed.setQuality(345.23f);
BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
}

} // namespace Acts::Test

0 comments on commit 7cecdb5

Please sign in to comment.