From 049006c8cee45e0ea4a2d42f84724fd49f48a065 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 29 Jul 2020 12:17:46 +0200 Subject: [PATCH] CI job to check for BOOST_TEST macro usage (#351) --- .github/workflows/checks.yml | 8 + CI/check_boost_test_macro.sh | 14 + .../Acts/Tests/CommonHelpers/Assertions.hpp | 24 ++ .../Fatras/FatrasSimulationTests.cpp | 36 +-- .../EventData/FreeTrackParametersTests.cpp | 26 +- .../Core/Geometry/ConeVolumeBoundsTests.cpp | 40 +-- .../Core/Geometry/CuboidVolumeBoundsTests.cpp | 12 +- .../Geometry/CuboidVolumeBuilderTests.cpp | 41 +-- .../CutoutCylinderVolumeBoundsTests.cpp | 2 +- .../Geometry/CylinderVolumeBoundsTests.cpp | 2 +- .../GenericCuboidVolumeBoundsTests.cpp | 2 +- .../Geometry/GeometryHierarchyMapTests.cpp | 44 +-- .../Core/Geometry/GeometryIDTests.cpp | 68 ++--- .../Geometry/SurfaceBinningMatcherTests.cpp | 11 +- .../Geometry/TrapezoidVolumeBoundsTests.cpp | 2 +- Tests/UnitTests/Core/Geometry/VolumeTests.cpp | 22 +- .../AccumulatedVolumeMaterialTests.cpp | 4 +- .../Core/Material/InteractionsTests.cpp | 52 ++-- .../Material/MaterialCompositionTests.cpp | 16 +- .../Core/Material/MaterialPropertiesTests.cpp | 8 +- .../UnitTests/Core/Material/MaterialTests.cpp | 8 +- .../Core/Propagator/AtlasStepperTests.cpp | 228 +++++++------- .../Core/Propagator/CovarianceEngineTests.cpp | 53 ++-- .../Propagator/MaterialCollectionTests.cpp | 5 +- .../Core/Propagator/NavigatorTests.cpp | 64 ++-- .../Core/Propagator/StepperTests.cpp | 279 +++++++++--------- .../Propagator/StraightLineStepperTests.cpp | 252 ++++++++-------- .../VolumeMaterialInteractionTests.cpp | 34 +-- .../SurfaceLocalToGlobalRoundtripTests.cpp | 24 +- .../Core/Utilities/BoundingBoxTest.cpp | 158 +++++----- .../UnitTests/Core/Utilities/LoggerTests.cpp | 12 +- .../Core/Utilities/MultiIndexTests.cpp | 180 +++++------ Tests/UnitTests/Core/VersionTests.cpp | 12 +- .../Vertexing/IterativeVertexFinderTests.cpp | 4 +- .../Fatras/EventData/BarcodeTests.cpp | 50 ++-- Tests/UnitTests/Fatras/EventData/HitTests.cpp | 24 +- .../Fatras/EventData/ParticleTests.cpp | 64 ++-- .../Fatras/Kernel/InteractorTests.cpp | 96 +++--- .../Fatras/Kernel/PhysicsListTests.cpp | 15 +- .../UnitTests/Fatras/Kernel/ProcessTests.cpp | 44 +-- .../Fatras/Physics/EnergyLossTests.cpp | 12 +- .../Fatras/Physics/ScatteringTests.cpp | 4 +- .../Fatras/Selectors/ChargeSelectorsTests.cpp | 24 +- .../Fatras/Selectors/LimitSelectorsTests.cpp | 8 +- .../Fatras/Selectors/PdgSelectorsTests.cpp | 40 +-- .../Fatras/Selectors/SelectorHelpersTests.cpp | 60 ++-- .../Fatras/Utilities/ParticleDataTests.cpp | 36 +-- .../Digitization/PlanarModuleStepperTests.cpp | 2 +- ...GeometryHierarchyMapJsonConverterTests.cpp | 58 ++-- .../Plugins/TGeo/TGeoArb8ConversionTests.cpp | 6 +- .../Plugins/TGeo/TGeoBBoxConversionTests.cpp | 48 +-- .../Plugins/TGeo/TGeoLayerBuilderTests.cpp | 8 +- .../Plugins/TGeo/TGeoParserTests.cpp | 4 +- .../TGeo/TGeoPrimitivesHelperTests.cpp | 8 +- .../Plugins/TGeo/TGeoTrd1ConversionTests.cpp | 6 +- .../Plugins/TGeo/TGeoTrd2ConversionTests.cpp | 12 +- .../Plugins/TGeo/TGeoTubeConversionTests.cpp | 24 +- 57 files changed, 1239 insertions(+), 1161 deletions(-) create mode 100755 CI/check_boost_test_macro.sh create mode 100644 Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 87e0ba6e5bd..720c280e350 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -37,3 +37,11 @@ jobs: - name: Check run: > CI/check_include_guards.py . --fail-global --exclude "*thirdparty/*" + + boost_test_macro: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check + run: > + CI/check_boost_test_macro.sh diff --git a/CI/check_boost_test_macro.sh b/CI/check_boost_test_macro.sh new file mode 100755 index 00000000000..d8f4e25c651 --- /dev/null +++ b/CI/check_boost_test_macro.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +test_string="BOOST_TEST(" +grep $test_string -n -r Tests --include "*.cpp" --include "*.hpp" --include "*.ipp" + +status=$? + +if [[ $status -eq 0 ]]; then + echo "Found occurrences of '$test_string'" + exit 1 +else + echo "Did not find occurrences of '$test_string'" + exit 0 +fi diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp new file mode 100644 index 00000000000..9e9f0fa07c8 --- /dev/null +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp @@ -0,0 +1,24 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2020 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/. + +#pragma once + +#include + +#include + +#define CHECK_NE_COLLECTIONS(col1, col2) \ + do { \ + BOOST_CHECK_EQUAL(col1.size(), col2.size()); \ + std::vector result; \ + for (size_t i = 0; i < col1.size(); i++) { \ + result.push_back(col1[i] == col2[i]); \ + } \ + BOOST_CHECK(not std::all_of(result.begin(), result.end(), \ + [](bool r) { return r; })); \ + } while (0) diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index 657426352ee..2cbfe2c62f8 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -185,35 +185,35 @@ BOOST_DATA_TEST_CASE(FatrasSimulation, dataset, pdg, phi, eta, p, input.push_back(std::move(particle)); } BOOST_TEST_INFO(input.front()); - BOOST_TEST(input.size() == numParticles); + BOOST_CHECK_EQUAL(input.size(), numParticles); // run the simulation auto result = simulator.simulate(geoCtx, magCtx, generator, input, simulatedInitial, simulatedFinal, hits); // should always succeed - BOOST_TEST(result.ok()); + BOOST_CHECK(result.ok()); // ensure simulated particle containers have consistent content - BOOST_TEST(simulatedInitial.size() == simulatedFinal.size()); + BOOST_CHECK_EQUAL(simulatedInitial.size(), simulatedFinal.size()); for (std::size_t i = 0; i < simulatedInitial.size(); ++i) { const auto& initialParticle = simulatedInitial[i]; const auto& finalParticle = simulatedFinal[i]; // particle identify should not change during simulation - BOOST_TEST(initialParticle.particleId() == finalParticle.particleId()); - BOOST_TEST(initialParticle.process() == finalParticle.process()); - BOOST_TEST(initialParticle.pdg() == finalParticle.pdg()); - BOOST_TEST(initialParticle.charge() == finalParticle.charge()); - BOOST_TEST(initialParticle.mass() == finalParticle.mass()); + BOOST_CHECK_EQUAL(initialParticle.particleId(), finalParticle.particleId()); + BOOST_CHECK_EQUAL(initialParticle.process(), finalParticle.process()); + BOOST_CHECK_EQUAL(initialParticle.pdg(), finalParticle.pdg()); + BOOST_CHECK_EQUAL(initialParticle.charge(), finalParticle.charge()); + BOOST_CHECK_EQUAL(initialParticle.mass(), finalParticle.mass()); } // we have no particle cuts and should not loose any particles. // might end up with more due to secondaries - BOOST_TEST(input.size() <= simulatedInitial.size()); - BOOST_TEST(input.size() <= simulatedFinal.size()); + BOOST_CHECK_LE(input.size(), simulatedInitial.size()); + BOOST_CHECK_LE(input.size(), simulatedFinal.size()); // there should be some hits if we started with a charged particle if (ActsFatras::findCharge(pdg) != 0) { - BOOST_TEST(0u < hits.size()); + BOOST_CHECK_LT(0u, hits.size()); } // sort all outputs by particle id to simply further tests @@ -223,18 +223,18 @@ BOOST_DATA_TEST_CASE(FatrasSimulation, dataset, pdg, phi, eta, p, sortByParticleId(hits); // check that all particle ids are unique - BOOST_TEST(areParticleIdsUnique(input)); - BOOST_TEST(areParticleIdsUnique(simulatedInitial)); - BOOST_TEST(areParticleIdsUnique(simulatedFinal)); + BOOST_CHECK(areParticleIdsUnique(input)); + BOOST_CHECK(areParticleIdsUnique(simulatedInitial)); + BOOST_CHECK(areParticleIdsUnique(simulatedFinal)); // hits must necessarily contain particle id duplicates // check that every input particles is simulated for (const auto& particle : input) { - BOOST_TEST(containsParticleId(simulatedInitial, particle)); - BOOST_TEST(containsParticleId(simulatedFinal, particle)); + BOOST_CHECK(containsParticleId(simulatedInitial, particle)); + BOOST_CHECK(containsParticleId(simulatedFinal, particle)); } // check that all hits can be associated to a particle for (const auto& hit : hits) { - BOOST_TEST(containsParticleId(simulatedInitial, hit)); - BOOST_TEST(containsParticleId(simulatedFinal, hit)); + BOOST_CHECK(containsParticleId(simulatedInitial, hit)); + BOOST_CHECK(containsParticleId(simulatedFinal, hit)); } } diff --git a/Tests/UnitTests/Core/EventData/FreeTrackParametersTests.cpp b/Tests/UnitTests/Core/EventData/FreeTrackParametersTests.cpp index 3b563a30094..a362027bf6d 100644 --- a/Tests/UnitTests/Core/EventData/FreeTrackParametersTests.cpp +++ b/Tests/UnitTests/Core/EventData/FreeTrackParametersTests.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(free_initialization) { // Test if the object can be created w/o covariance FreeTrackParameters fpwoCov(cov, params); - BOOST_TEST(!fpwoCov.covariance().has_value()); + BOOST_CHECK(!fpwoCov.covariance().has_value()); CHECK_CLOSE_ABS(fpwoCov.parameters(), params, 1e-6); // Test if the object can be create with covariance @@ -47,30 +47,30 @@ BOOST_AUTO_TEST_CASE(free_initialization) { CHECK_CLOSE_ABS(fp.parameters(), params, 1e-6); // Test == comparison - BOOST_TEST(fp == fp); - BOOST_TEST(fp != fpwoCov); + BOOST_CHECK_EQUAL(fp, fp); + BOOST_CHECK_NE(fp, fpwoCov); FreeTrackParameters fpCopyConstr(fp); - BOOST_TEST(fpCopyConstr == fp); + BOOST_CHECK_EQUAL(fpCopyConstr, fp); covCpy = *cov; FreeTrackParameters fpMoveConstr(FreeTrackParameters(covCpy, params)); - BOOST_TEST(fpMoveConstr == fp); + BOOST_CHECK_EQUAL(fpMoveConstr, fp); // Test copy assignment FreeTrackParameters fpCopyAssignment = fp; - BOOST_TEST(fpCopyAssignment == fp); + BOOST_CHECK_EQUAL(fpCopyAssignment, fp); // Test move assignment covCpy = *cov; FreeTrackParameters fpMoveAssignment = FreeTrackParameters(covCpy, params); - BOOST_TEST(fpMoveAssignment == fp); + BOOST_CHECK_EQUAL(fpMoveAssignment, fp); /// Repeat constructing and assignment with neutral parameters // Test if the object can be created w/o covariance NeutralFreeTrackParameters nfpwoCov(std::nullopt, params); - BOOST_TEST(!nfpwoCov.covariance().has_value()); + BOOST_CHECK(!nfpwoCov.covariance().has_value()); CHECK_CLOSE_ABS(nfpwoCov.parameters(), params, 1e-6); covCpy = *cov; @@ -79,22 +79,22 @@ BOOST_AUTO_TEST_CASE(free_initialization) { CHECK_CLOSE_ABS(nfp.parameters(), params, 1e-6); NeutralFreeTrackParameters nfpCopyConstr(nfp); - BOOST_TEST(nfpCopyConstr == nfp); + BOOST_CHECK_EQUAL(nfpCopyConstr, nfp); covCpy = *cov; NeutralFreeTrackParameters nfpMoveConstr( NeutralFreeTrackParameters(covCpy, params)); - BOOST_TEST(nfpMoveConstr == nfp); + BOOST_CHECK_EQUAL(nfpMoveConstr, nfp); // Test copy assignment NeutralFreeTrackParameters nfpCopyAssignment = nfp; - BOOST_TEST(nfpCopyAssignment == nfp); + BOOST_CHECK_EQUAL(nfpCopyAssignment, nfp); // Test move assignment covCpy = *cov; NeutralFreeTrackParameters nfpMoveAssignment = NeutralFreeTrackParameters(covCpy, params); - BOOST_TEST(nfpMoveAssignment == nfp); + BOOST_CHECK_EQUAL(nfpMoveAssignment, nfp); /// Test getters/setters @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(free_initialization) { CHECK_CLOSE_ABS(fp.position(), pos, 1e-6); CHECK_CLOSE_ABS(fp.momentum(), dir / qop, 1e-6); CHECK_CLOSE_ABS(fp.charge(), +1., 1e-6); - BOOST_TEST(nfp.charge() == 0.); + BOOST_CHECK_EQUAL(nfp.charge(), 0.); CHECK_CLOSE_ABS(fp.time(), t, 1e-6); // Test setters diff --git a/Tests/UnitTests/Core/Geometry/ConeVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/ConeVolumeBoundsTests.cpp index 01a489c5214..c4380e81d6f 100644 --- a/Tests/UnitTests/Core/Geometry/ConeVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/ConeVolumeBoundsTests.cpp @@ -33,52 +33,52 @@ BOOST_AUTO_TEST_CASE(ConeVolumeBoundsTests) { ConeVolumeBounds solidCone(0., 0., 0.45, 50_mm, 50_mm, 0., M_PI); // Test correct parameter return - BOOST_TEST(solidCone.get(ConeVolumeBounds::eInnerAlpha) == 0.); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eInnerOffsetZ) == 0.); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eOuterAlpha) == 0.45); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eOuterOffsetZ) == 50.); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eHalfLengthZ) == 50.); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eAveragePhi) == 0.); - BOOST_TEST(solidCone.get(ConeVolumeBounds::eHalfPhiSector) == M_PI); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eInnerAlpha), 0.); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eInnerOffsetZ), 0.); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eOuterAlpha), 0.45); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eOuterOffsetZ), 50.); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eHalfLengthZ), 50.); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eAveragePhi), 0.); + BOOST_CHECK_EQUAL(solidCone.get(ConeVolumeBounds::eHalfPhiSector), M_PI); // Derived quantities - BOOST_TEST(solidCone.innerTanAlpha() == 0.); - BOOST_TEST(solidCone.innerRmin() == 0.); - BOOST_TEST(solidCone.innerRmax() == 0.); - BOOST_TEST(solidCone.outerTanAlpha() == std::tan(0.45)); + BOOST_CHECK_EQUAL(solidCone.innerTanAlpha(), 0.); + BOOST_CHECK_EQUAL(solidCone.innerRmin(), 0.); + BOOST_CHECK_EQUAL(solidCone.innerRmax(), 0.); + BOOST_CHECK_EQUAL(solidCone.outerTanAlpha(), std::tan(0.45)); double outerRmax = 100_mm * solidCone.outerTanAlpha(); - BOOST_TEST(solidCone.outerRmin() == 0.); - BOOST_TEST(solidCone.outerRmax() == outerRmax); + BOOST_CHECK_EQUAL(solidCone.outerRmin(), 0.); + BOOST_CHECK_EQUAL(solidCone.outerRmax(), outerRmax); auto solidConeSurfaces = solidCone.orientedSurfaces(); - BOOST_TEST(solidConeSurfaces.size() == 2); + BOOST_CHECK_EQUAL(solidConeSurfaces.size(), 2); // Single solid Cone - with cut off ConeVolumeBounds cutOffCone(0., 0., 0.45, 80_mm, 50_mm, 0., M_PI); auto cutOffConeSurfaces = cutOffCone.orientedSurfaces(); - BOOST_TEST(cutOffConeSurfaces.size() == 3); + BOOST_CHECK_EQUAL(cutOffConeSurfaces.size(), 3); // Cone - Cone inlay ConeVolumeBounds cutOffHollowCone(0.35, 70_mm, 0.45, 80_mm, 50_mm, 0., M_PI); auto cutOffHollowConeSurfaces = cutOffHollowCone.orientedSurfaces(); - BOOST_TEST(cutOffHollowConeSurfaces.size() == 4); + BOOST_CHECK_EQUAL(cutOffHollowConeSurfaces.size(), 4); // Sectoral Cone - Cone inlay ConeVolumeBounds cutOffHollowSectoralCone(0.35, 70_mm, 0.45, 80_mm, 50_mm, 0., 0.456); auto cutOffHollowSectoralConeSurfaces = cutOffHollowSectoralCone.orientedSurfaces(); - BOOST_TEST(cutOffHollowSectoralConeSurfaces.size() == 6); + BOOST_CHECK_EQUAL(cutOffHollowSectoralConeSurfaces.size(), 6); // Sectoral Cone - Hollow Cone ConeVolumeBounds cutOffHollowCylCone(10_mm, 0.45, 80_mm, 50_mm, 0., M_PI); auto cutOffHollowCylConeSurfaces = cutOffHollowCylCone.orientedSurfaces(); - BOOST_TEST(cutOffHollowCylConeSurfaces.size() == 4); + BOOST_CHECK_EQUAL(cutOffHollowCylConeSurfaces.size(), 4); // Single Hollow Cylinder - Cone inlay ConeVolumeBounds cutOffHollowConeCyl(120_mm, 0.35, 70_mm, 50_mm, 0., M_PI); auto cutOffHollowConeCylSurfaces = cutOffHollowConeCyl.orientedSurfaces(); - BOOST_TEST(cutOffHollowConeCylSurfaces.size() == 4); + BOOST_CHECK_EQUAL(cutOffHollowConeCylSurfaces.size(), 4); } BOOST_AUTO_TEST_CASE(ConeVolumeBoundsSurfaceOrientation) { @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(ConeVolumeBoundsSurfaceOrientation) { ConeVolumeBounds hcone(10_mm, 0.45, 80_mm, 50_mm, 0., M_PI); auto cvbOrientedSurfaces = hcone.orientedSurfaces(nullptr); - BOOST_TEST(cvbOrientedSurfaces.size(), 4); + BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 4); auto geoCtx = GeometryContext(); Vector3D xaxis(1., 0., 0.); diff --git a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp index ce142f1bb75..d18110e3112 100644 --- a/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CuboidVolumeBoundsTests.cpp @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeException) { BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) { CuboidVolumeBounds box(hx, hy, hz); // Test the type - BOOST_TEST(box.type() == VolumeBounds::eCuboid); + BOOST_CHECK_EQUAL(box.type(), VolumeBounds::eCuboid); // Test the halflength x CHECK_CLOSE_ABS(box.get(CuboidVolumeBounds::eHalfLengthX), hx, s_epsilon); // Test the halflength y @@ -74,8 +74,10 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) { // Test the halflength z CHECK_CLOSE_ABS(box.get(CuboidVolumeBounds::eHalfLengthZ), hz, s_epsilon); // Test the streaming + std::vector actvalues = box.values(); std::vector refvalues = {hx, hy, hz}; - BOOST_TEST(box.values() == refvalues); + BOOST_CHECK_EQUAL_COLLECTIONS(actvalues.begin(), actvalues.end(), + refvalues.begin(), refvalues.end()); // Inside position Vector3D inside({5., 10., 8.}); @@ -84,11 +86,11 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) { {20., 1., -2.}, {1., -30., 2.}, {-1., 2., 100.}}; // Inside position - BOOST_TEST(box.inside(inside, s_onSurfaceTolerance)); + BOOST_CHECK(box.inside(inside, s_onSurfaceTolerance)); // Outside position for (const auto& outside : outsides) { - BOOST_TEST(!box.inside(outside, s_onSurfaceTolerance)); + BOOST_CHECK(!box.inside(outside, s_onSurfaceTolerance)); } } @@ -96,7 +98,7 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBoundarySurfaces) { CuboidVolumeBounds box(5, 8, 7); auto cvbOrientedSurfaces = box.orientedSurfaces(nullptr); - BOOST_TEST(cvbOrientedSurfaces.size(), (size_t)6); + BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 6); auto geoCtx = GeometryContext(); diff --git a/Tests/UnitTests/Core/Geometry/CuboidVolumeBuilderTests.cpp b/Tests/UnitTests/Core/Geometry/CuboidVolumeBuilderTests.cpp index e987cc52f8b..8e9e1382f06 100644 --- a/Tests/UnitTests/Core/Geometry/CuboidVolumeBuilderTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CuboidVolumeBuilderTests.cpp @@ -298,14 +298,15 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBuilderTest_confinedVolumes) { tgb.trackingGeometry(tgContext); // Test that the right volume is selected - BOOST_TEST(detector->lowestTrackingVolume(tgContext, {1. * units::_m, 0., 0.}) - ->volumeName() == vCfg.name); - BOOST_TEST( - detector->lowestTrackingVolume(tgContext, {1.1 * units::_m, 0., 0.}) - ->volumeName() == cvCfg1.name); - BOOST_TEST( - detector->lowestTrackingVolume(tgContext, {0.9 * units::_m, 0., 0.}) - ->volumeName() == cvCfg2.name); + BOOST_CHECK_EQUAL(detector->lowestTrackingVolume(tgContext, {1. * units::_m, +0., 0.}) + ->volumeName(), vCfg.name); + BOOST_CHECK_EQUAL(detector->lowestTrackingVolume(tgContext, {1.1 * units::_m, +0., 0.}) + ->volumeName(), cvCfg1.name); + BOOST_CHECK_EQUAL(detector->lowestTrackingVolume(tgContext, {0.9 * units::_m, +0., 0.}) + ->volumeName(), cvCfg2.name); // Set propagator and navigator PropagatorOptions> propOpts(tgContext, @@ -332,21 +333,21 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBuilderTest_confinedVolumes) { // Check the identified volumes for (unsigned int i = 0; i < stepResult.position.size(); i++) { if (i > 0) { - BOOST_TEST(stepResult.position[i].x() > 0.); + BOOST_CHECK_GT(stepResult.position[i].x(), 0.); } if (stepResult.position[i].x() >= 0.85 * units::_m && stepResult.position[i].x() < 0.95 * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == cvCfg2.name); - BOOST_TEST(stepResult.volume[i]->volumeMaterial() == nullptr); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), cvCfg2.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeMaterial(), nullptr); } else { if (stepResult.position[i].x() >= 1.05 * units::_m && stepResult.position[i].x() < 1.15 * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == cvCfg1.name); - BOOST_TEST(stepResult.volume[i]->volumeMaterial() != nullptr); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), cvCfg1.name); + BOOST_CHECK_NE(stepResult.volume[i]->volumeMaterial(), nullptr); } else { if (stepResult.position[i].x() < 2. * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == vCfg.name); - BOOST_TEST(stepResult.volume[i]->volumeMaterial() == nullptr); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), vCfg.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeMaterial(), nullptr); } } } @@ -455,22 +456,22 @@ propOpts(tgContext, mfContext); for (unsigned int i = 0; i < stepResult.position.size(); i++) { // Check the movement in the right direction if (i > 0) { - BOOST_TEST(stepResult.position[i].x() > 0.); + BOOST_CHECK_GT(stepResult.position[i].x(), 0.); } // Check the identified volumes if (stepResult.position[i].x() >= 0.95 * units::_m && stepResult.position[i].x() < 1.05 * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == cvCfg4.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), cvCfg4.name); } else { if (stepResult.position[i].x() >= 1.85 * units::_m && stepResult.position[i].x() < 1.95 * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == cvCfg3.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), cvCfg3.name); } else { if (stepResult.position[i].x() < 2. * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == vCfg1.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), vCfg1.name); } else { if (stepResult.position[i].x() < 3. * units::_m) { - BOOST_TEST(stepResult.volume[i]->volumeName() == vCfg2.name); + BOOST_CHECK_EQUAL(stepResult.volume[i]->volumeName(), vCfg2.name); } } } diff --git a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp index 345bf8b9fcc..7f4614ede37 100644 --- a/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CutoutCylinderVolumeBoundsTests.cpp @@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(CutoutCylinderVolumeOrientedBoundaries) { CutoutCylinderVolumeBounds ccvb(5, 10, 15, 30, 25); auto ccvbOrientedSurfaces = ccvb.orientedSurfaces(nullptr); - BOOST_TEST(ccvbOrientedSurfaces.size(), 8); + BOOST_CHECK_EQUAL(ccvbOrientedSurfaces.size(), 8); auto geoCtx = GeometryContext(); Vector3D xaxis(1., 0., 0.); diff --git a/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp index 1f0c098933a..07dda8a10f3 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeBoundsTests.cpp @@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(CylinderVolumeOrientedBoundaries) { CylinderVolumeBounds cvb(5, 10, 20); auto cvbOrientedSurfaces = cvb.orientedSurfaces(nullptr); - BOOST_TEST(cvbOrientedSurfaces.size(), 4); + BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 4); auto geoCtx = GeometryContext(); Vector3D xaxis(1., 0., 0.); diff --git a/Tests/UnitTests/Core/Geometry/GenericCuboidVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/GenericCuboidVolumeBoundsTests.cpp index da95883b125..9b8e79acad7 100644 --- a/Tests/UnitTests/Core/Geometry/GenericCuboidVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/GenericCuboidVolumeBoundsTests.cpp @@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(GenericCuboidVolumeBoundarySurfaces) { GenericCuboidVolumeBounds cubo(vertices); auto gcvbOrientedSurfaces = cubo.orientedSurfaces(nullptr); - BOOST_TEST(gcvbOrientedSurfaces.size(), 6); + BOOST_CHECK_EQUAL(gcvbOrientedSurfaces.size(), 6); for (auto& os : gcvbOrientedSurfaces) { auto geoCtx = GeometryContext(); diff --git a/Tests/UnitTests/Core/Geometry/GeometryHierarchyMapTests.cpp b/Tests/UnitTests/Core/Geometry/GeometryHierarchyMapTests.cpp index cb37aa12f06..fd642ae4d2d 100644 --- a/Tests/UnitTests/Core/Geometry/GeometryHierarchyMapTests.cpp +++ b/Tests/UnitTests/Core/Geometry/GeometryHierarchyMapTests.cpp @@ -35,10 +35,10 @@ using Container = Acts::GeometryHierarchyMap; #define CHECK_ENTRY(container, query, compare) \ do { \ auto ret = container.find(query); \ - BOOST_TEST(ret != container.end()); \ + BOOST_CHECK_NE(ret, container.end()); \ if (ret != container.end()) { \ auto idx = std::distance(container.begin(), ret); \ - BOOST_TEST(container.idAt(idx) == compare); \ + BOOST_CHECK_EQUAL(container.idAt(idx), compare); \ } \ } while (false) @@ -49,9 +49,9 @@ BOOST_AUTO_TEST_SUITE(GeometryHierarchyMap) BOOST_AUTO_TEST_CASE(ConstructDefault) { Container c; - BOOST_TEST(c.begin() == c.end()); - BOOST_TEST(c.empty()); - BOOST_TEST(c.size() == 0u); + BOOST_CHECK_EQUAL(c.begin(), c.end()); + BOOST_CHECK(c.empty()); + BOOST_CHECK_EQUAL(c.size(), 0u); } BOOST_AUTO_TEST_CASE(ConstructNonUnique) { @@ -79,9 +79,9 @@ BOOST_AUTO_TEST_CASE(ConstructInitializerList) { {makeId(2), {2.0}}, {makeId(), {23.0}}, }; - BOOST_TEST(std::next(c.begin(), 4) == c.end()); - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 4u); + BOOST_CHECK_EQUAL(std::next(c.begin(), 4), c.end()); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 4u); // only test that all elements are there; failure test are below CHECK_ENTRY(c, makeId(0, 1, 2), makeId(0, 1, 2)); CHECK_ENTRY(c, makeId(2), makeId(2)); @@ -96,15 +96,15 @@ BOOST_AUTO_TEST_CASE(IndexBasedAccess) { {makeId(4, 5, 7), {4.0}}, }); - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 4u); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 4u); // this tests just that the index-based access works // NOTE order is undefined and should not be tested for (auto i = c.size(); 0 < i--;) { // just check that the id is valid - BOOST_TEST(c.idAt(i) != GeometryID()); + BOOST_CHECK_NE(c.idAt(i), GeometryID()); // check that something is actually stored by comparing with the default - BOOST_TEST(c.valueAt(i).value != Thing().value); + BOOST_CHECK_NE(c.valueAt(i).value, Thing().value); } // test that invalid inputs actually fail BOOST_CHECK_THROW(c.idAt(c.size()), std::out_of_range); @@ -125,9 +125,9 @@ BOOST_AUTO_TEST_CASE(Find) { }; // basic checks - BOOST_TEST(std::next(c.begin(), 4u) == c.end()); - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 4u); + BOOST_CHECK_EQUAL(std::next(c.begin(), 4u), c.end()); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 4u); // find existing sensitive CHECK_ENTRY(c, makeId(2, 4, 6), makeId(2, 4, 6)); @@ -148,13 +148,13 @@ BOOST_AUTO_TEST_CASE(Find) { CHECK_ENTRY(c, makeId(12, 16, 20), makeId(12, 16)); // find non-existing sensitive, which has no higher hierarchy set - BOOST_TEST(c.find(makeId(3, 5, 7)) == c.end()); + BOOST_CHECK_EQUAL(c.find(makeId(3, 5, 7)), c.end()); // find non-existing layer, which has no higher hierarchy set - BOOST_TEST(c.find(makeId(3, 5)) == c.end()); + BOOST_CHECK_EQUAL(c.find(makeId(3, 5)), c.end()); // find non-existing volume - BOOST_TEST(c.find(makeId(3)) == c.end()); + BOOST_CHECK_EQUAL(c.find(makeId(3)), c.end()); // find non-existing volume, which has only lower hierarchy elements - BOOST_TEST(c.find(makeId(12)) == c.end()); + BOOST_CHECK_EQUAL(c.find(makeId(12)), c.end()); } BOOST_AUTO_TEST_CASE(FindWithGlobalDefault) { @@ -168,9 +168,9 @@ BOOST_AUTO_TEST_CASE(FindWithGlobalDefault) { }; // basic checks - BOOST_TEST(std::next(c.begin(), 3u) == c.end()); - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 3u); + BOOST_CHECK_EQUAL(std::next(c.begin(), 3u), c.end()); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 3u); // find existing entries CHECK_ENTRY(c, makeId(), makeId()); diff --git a/Tests/UnitTests/Core/Geometry/GeometryIDTests.cpp b/Tests/UnitTests/Core/Geometry/GeometryIDTests.cpp index c29863b86d3..0d895e1fdc0 100644 --- a/Tests/UnitTests/Core/Geometry/GeometryIDTests.cpp +++ b/Tests/UnitTests/Core/Geometry/GeometryIDTests.cpp @@ -15,22 +15,22 @@ namespace Test { BOOST_AUTO_TEST_CASE(GeometryID_construct_default) { GeometryID id; - BOOST_TEST(id.volume() == 0u); - BOOST_TEST(id.boundary() == 0u); - BOOST_TEST(id.layer() == 0u); - BOOST_TEST(id.approach() == 0u); - BOOST_TEST(id.sensitive() == 0u); + BOOST_CHECK_EQUAL(id.volume(), 0u); + BOOST_CHECK_EQUAL(id.boundary(), 0u); + BOOST_CHECK_EQUAL(id.layer(), 0u); + BOOST_CHECK_EQUAL(id.approach(), 0u); + BOOST_CHECK_EQUAL(id.sensitive(), 0u); } BOOST_AUTO_TEST_CASE(GeometryID_construct_encoded) { // not sure if it is a good idea to test for the encoding since it should be // an implementation detail. only the resulting functionality is relevant. GeometryID id = 0xa0b00c00d00affe0u; - BOOST_TEST(id.volume() == 0xa0u); - BOOST_TEST(id.boundary() == 0xb0u); - BOOST_TEST(id.layer() == 0x0c0u); - BOOST_TEST(id.approach() == 0x0du); - BOOST_TEST(id.sensitive() == 0x00affe0u); + BOOST_CHECK_EQUAL(id.volume(), 0xa0u); + BOOST_CHECK_EQUAL(id.boundary(), 0xb0u); + BOOST_CHECK_EQUAL(id.layer(), 0x0c0u); + BOOST_CHECK_EQUAL(id.approach(), 0x0du); + BOOST_CHECK_EQUAL(id.sensitive(), 0x00affe0u); } BOOST_AUTO_TEST_CASE(GeometryID_max_values) { @@ -44,37 +44,37 @@ BOOST_AUTO_TEST_CASE(GeometryID_max_values) { constexpr GeometryID ref = 0xdeadaffe01234567; // values above the maximum are truncated // max+1 has all available bits zeroed - BOOST_TEST(GeometryID(ref).setVolume(volumeMax + 1) == - GeometryID(ref).setVolume(0u)); - BOOST_TEST(GeometryID(ref).setBoundary(boundaryMax + 1) == - GeometryID(ref).setBoundary(0u)); - BOOST_TEST(GeometryID(ref).setLayer(layerMax + 1) == - GeometryID(ref).setLayer(0u)); - BOOST_TEST(GeometryID(ref).setApproach(approachMax + 1) == - GeometryID(ref).setApproach(0u)); - BOOST_TEST(GeometryID(ref).setSensitive(sensitiveMax + 1) == - GeometryID(ref).setSensitive(0u)); + BOOST_CHECK_EQUAL(GeometryID(ref).setVolume(volumeMax + 1), + GeometryID(ref).setVolume(0u)); + BOOST_CHECK_EQUAL(GeometryID(ref).setBoundary(boundaryMax + 1), + GeometryID(ref).setBoundary(0u)); + BOOST_CHECK_EQUAL(GeometryID(ref).setLayer(layerMax + 1), + GeometryID(ref).setLayer(0u)); + BOOST_CHECK_EQUAL(GeometryID(ref).setApproach(approachMax + 1), + GeometryID(ref).setApproach(0u)); + BOOST_CHECK_EQUAL(GeometryID(ref).setSensitive(sensitiveMax + 1), + GeometryID(ref).setSensitive(0u)); } BOOST_AUTO_TEST_CASE(GeometryID_order) { auto vol1 = GeometryID().setVolume(1u).setLayer(14u).setSensitive(5u); auto vol2 = GeometryID().setVolume(2u).setLayer(13u).setSensitive(3u); // order uses volume first even if other components are larger - BOOST_TEST(vol1 < vol2); - BOOST_TEST(GeometryID(vol1).setBoundary(64u) < vol2); - BOOST_TEST(GeometryID(vol1).setLayer(64u) < vol2); - BOOST_TEST(GeometryID(vol1).setApproach(64u) < vol2); - BOOST_TEST(GeometryID(vol1).setSensitive(64u) < vol2); - BOOST_TEST(vol2 < GeometryID(vol1).setVolume(3u)); + BOOST_CHECK_LT(vol1, vol2); + BOOST_CHECK_LT(GeometryID(vol1).setBoundary(64u), vol2); + BOOST_CHECK_LT(GeometryID(vol1).setLayer(64u), vol2); + BOOST_CHECK_LT(GeometryID(vol1).setApproach(64u), vol2); + BOOST_CHECK_LT(GeometryID(vol1).setSensitive(64u), vol2); + BOOST_CHECK_LT(vol2, GeometryID(vol1).setVolume(3u)); // other components are hierachical - BOOST_TEST(GeometryID(vol1).setVolume(1u).setBoundary(2u) < - GeometryID(vol1).setVolume(2u).setBoundary(1u)); - BOOST_TEST(GeometryID(vol1).setBoundary(1u).setLayer(2u) < - GeometryID(vol1).setBoundary(2u).setLayer(1u)); - BOOST_TEST(GeometryID(vol1).setLayer(1u).setApproach(2u) < - GeometryID(vol1).setLayer(2u).setApproach(1u)); - BOOST_TEST(GeometryID(vol1).setApproach(1u).setSensitive(2u) < - GeometryID(vol1).setApproach(2u).setSensitive(1u)); + BOOST_CHECK_LT(GeometryID(vol1).setVolume(1u).setBoundary(2u), + GeometryID(vol1).setVolume(2u).setBoundary(1u)); + BOOST_CHECK_LT(GeometryID(vol1).setBoundary(1u).setLayer(2u), + GeometryID(vol1).setBoundary(2u).setLayer(1u)); + BOOST_CHECK_LT(GeometryID(vol1).setLayer(1u).setApproach(2u), + GeometryID(vol1).setLayer(2u).setApproach(1u)); + BOOST_CHECK_LT(GeometryID(vol1).setApproach(1u).setSensitive(2u), + GeometryID(vol1).setApproach(2u).setSensitive(1u)); } } // namespace Test diff --git a/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp b/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp index d3f2350df1f..4f5e5058935 100644 --- a/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp +++ b/Tests/UnitTests/Core/Geometry/SurfaceBinningMatcherTests.cpp @@ -57,18 +57,19 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) { // Always true for (int ib = 0; ib < binValues; ++ib) { - BOOST_TEST( + BOOST_CHECK( sbm(tgContext, (BinningValue)ib, oneSurface.get(), oneSurface.get())); } // Not matching in R - BOOST_TEST(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get())); + BOOST_CHECK(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get())); // Not matching in phi - BOOST_TEST(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get())); + BOOST_CHECK(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get())); // Good enough matching in R - BOOST_TEST(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get())); + BOOST_CHECK(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get())); // Good enough matching in phi - BOOST_TEST(sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get())); + BOOST_CHECK( + sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get())); } } // namespace Test diff --git a/Tests/UnitTests/Core/Geometry/TrapezoidVolumeBoundsTests.cpp b/Tests/UnitTests/Core/Geometry/TrapezoidVolumeBoundsTests.cpp index 466fd5cf35c..27f37b03860 100644 --- a/Tests/UnitTests/Core/Geometry/TrapezoidVolumeBoundsTests.cpp +++ b/Tests/UnitTests/Core/Geometry/TrapezoidVolumeBoundsTests.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(TrapezoidVolumeBoundarySurfaces) { TrapezoidVolumeBounds tvb(5, 10, 8, 4); auto tvbOrientedSurfaces = tvb.orientedSurfaces(nullptr); - BOOST_TEST(tvbOrientedSurfaces.size(), 6); + BOOST_CHECK_EQUAL(tvbOrientedSurfaces.size(), 6); auto geoCtx = GeometryContext(); diff --git a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp index fc52357b833..3ec719e60f4 100644 --- a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp +++ b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp @@ -48,31 +48,31 @@ BOOST_AUTO_TEST_CASE(VolumeTest) { // Build and test the volume Volume volume(std::make_shared(transform), std::make_shared(bounds)); - BOOST_TEST(volume.transform().matrix() == transform.matrix()); + BOOST_CHECK_EQUAL(volume.transform().matrix(), transform.matrix()); CHECK_CLOSE_ABS(volume.itransform().matrix(), transform.inverse().matrix(), eps); - BOOST_TEST(volume.center() == translation); + BOOST_CHECK_EQUAL(volume.center(), translation); auto vBounds = static_cast(&volume.volumeBounds()); - BOOST_TEST(*vBounds == bounds); + BOOST_CHECK_EQUAL(*vBounds, bounds); // Build and test a shifted volume Transform3D shift(Transform3D::Identity()); Vector3D shiftTranslation{-4_mm, -5_mm, -6_mm}; shift.translation() = shiftTranslation; Volume volumeShift(volume, &shift); - BOOST_TEST(volumeShift.center() == - (volume.transform() * shift).translation()); - BOOST_TEST(volumeShift.transform().rotation() == - volume.transform().rotation()); + BOOST_CHECK_EQUAL(volumeShift.center(), + (volume.transform() * shift).translation()); + BOOST_CHECK_EQUAL(volumeShift.transform().rotation(), + volume.transform().rotation()); // Inside/Outside check - BOOST_TEST(volume.inside(translation)); - BOOST_TEST(!volume.inside({10_mm, 2_mm, 3_mm})); - BOOST_TEST(volume.inside({10_mm, 2_mm, 3_mm}, 2_mm)); + BOOST_CHECK(volume.inside(translation)); + BOOST_CHECK(!volume.inside({10_mm, 2_mm, 3_mm})); + BOOST_CHECK(volume.inside({10_mm, 2_mm, 3_mm}, 2_mm)); // Binning test GeometryContext gctx; - BOOST_TEST(volume.binningPosition(gctx, binX) == volume.center()); + BOOST_CHECK_EQUAL(volume.binningPosition(gctx, binX), volume.center()); } } // namespace Test } // namespace Acts \ No newline at end of file diff --git a/Tests/UnitTests/Core/Material/AccumulatedVolumeMaterialTests.cpp b/Tests/UnitTests/Core/Material/AccumulatedVolumeMaterialTests.cpp index d96e4f110e4..d7254b5010d 100644 --- a/Tests/UnitTests/Core/Material/AccumulatedVolumeMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/AccumulatedVolumeMaterialTests.cpp @@ -21,11 +21,11 @@ BOOST_AUTO_TEST_CASE(vacuum) { AccumulatedVolumeMaterial avm; // averaging over nothing is vacuum - BOOST_TEST(avm.average() == Material()); + BOOST_CHECK_EQUAL(avm.average(), Material()); // averaging over vacuum is still vacuum avm.accumulate(MaterialProperties(1)); - BOOST_TEST(avm.average() == Material()); + BOOST_CHECK_EQUAL(avm.average(), Material()); } BOOST_AUTO_TEST_CASE(single_material) { diff --git a/Tests/UnitTests/Core/Material/InteractionsTests.cpp b/Tests/UnitTests/Core/Material/InteractionsTests.cpp index 71141e67062..427cf7d1f46 100644 --- a/Tests/UnitTests/Core/Material/InteractionsTests.cpp +++ b/Tests/UnitTests/Core/Material/InteractionsTests.cpp @@ -52,18 +52,18 @@ BOOST_DATA_TEST_CASE(energy_loss_consistency, thickness* particle* momentum, x, auto dEMean = computeEnergyLossMean(slab, i, m, qOverP, q); auto dEMode = computeEnergyLossMode(slab, i, m, qOverP, q); - BOOST_TEST(0 < dEBethe); - BOOST_TEST(0 < dELandau); - BOOST_TEST(0 < dELandauSigma); - BOOST_TEST(0 < dELandauSigmaQOverP); - BOOST_TEST(dELandauSigma <= dEBethe); + BOOST_CHECK_LT(0, dEBethe); + BOOST_CHECK_LT(0, dELandau); + BOOST_CHECK_LT(0, dELandauSigma); + BOOST_CHECK_LT(0, dELandauSigmaQOverP); + BOOST_CHECK_LE(dELandauSigma, dEBethe); // radiative terms only kick above some threshold -> can be zero - BOOST_TEST(0 <= dERad); - BOOST_TEST(0 < dEMean); - BOOST_TEST(0 < dEMode); - BOOST_TEST((dEBethe + dERad) <= dEMean); + BOOST_CHECK_LE(0, dERad); + BOOST_CHECK_LT(0, dEMean); + BOOST_CHECK_LT(0, dEMode); + BOOST_CHECK_LE((dEBethe + dERad), dEMean); // TODO verify mode/mean relation for full energy loss - // BOOST_TEST(dEMode <= dEMean); + // BOOST_CHECK_LE(dEMode, dEMean); } // consistency checks for multiple scattering @@ -75,19 +75,19 @@ BOOST_DATA_TEST_CASE(multiple_scattering_consistency, const auto qOver2P = q / (2 * p); auto t0 = computeMultipleScatteringTheta0(slab, i, m, qOverP, q); - BOOST_TEST(0 < t0); + BOOST_CHECK_LT(0, t0); // use the anti-particle -> same scattering auto tanti = computeMultipleScatteringTheta0(slab, -i, m, -qOverP, -q); - BOOST_TEST(0 < tanti); - BOOST_TEST(t0 == tanti); + BOOST_CHECK_LT(0, tanti); + BOOST_CHECK_EQUAL(t0, tanti); // double the material -> more scattering auto t2x = computeMultipleScatteringTheta0(slabDoubled, i, m, qOverP, q); - BOOST_TEST(0 < t2x); - BOOST_TEST(t0 < t2x); + BOOST_CHECK_LT(0, t2x); + BOOST_CHECK_LT(t0, t2x); // double the momentum -> less scattering auto t2p = computeMultipleScatteringTheta0(slab, i, m, qOver2P, q); - BOOST_TEST(0 < t2p); - BOOST_TEST(t2p < t0); + BOOST_CHECK_LT(0, t2p); + BOOST_CHECK_LT(t2p, t0); } // no material -> no interactions @@ -95,14 +95,16 @@ BOOST_DATA_TEST_CASE(vacuum, thickness* particle* momentum, x, i, m, q, p) { const auto vacuum = Acts::MaterialProperties(Acts::Material(), x); const auto qOverP = q / p; - BOOST_TEST(computeEnergyLossBethe(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossLandau(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossLandauSigma(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossLandauSigmaQOverP(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossRadiative(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossMean(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeEnergyLossMode(vacuum, i, m, qOverP, q) == 0); - BOOST_TEST(computeMultipleScatteringTheta0(vacuum, i, m, qOverP, q) == 0); + BOOST_CHECK_EQUAL(computeEnergyLossBethe(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeEnergyLossLandau(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeEnergyLossLandauSigma(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeEnergyLossLandauSigmaQOverP(vacuum, i, m, qOverP, q), + 0); + BOOST_CHECK_EQUAL(computeEnergyLossRadiative(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeEnergyLossMean(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeEnergyLossMode(vacuum, i, m, qOverP, q), 0); + BOOST_CHECK_EQUAL(computeMultipleScatteringTheta0(vacuum, i, m, qOverP, q), + 0); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Material/MaterialCompositionTests.cpp b/Tests/UnitTests/Core/Material/MaterialCompositionTests.cpp index 95f977cf069..acf0c91c182 100644 --- a/Tests/UnitTests/Core/Material/MaterialCompositionTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialCompositionTests.cpp @@ -26,11 +26,11 @@ BOOST_AUTO_TEST_CASE(construct_element_fraction) { float carbonFraction = float(carbonWeight) / 255u; ElementFraction a(carbonZ, carbonFraction); - BOOST_TEST(a.element(), carbonZ); + BOOST_CHECK_EQUAL(a.element(), carbonZ); CHECK_CLOSE_REL(a.fraction(), carbonFraction, eps); ElementFraction b(carbonZ, carbonWeight); - BOOST_TEST(b.element(), carbonZ); + BOOST_CHECK_EQUAL(b.element(), carbonZ); CHECK_CLOSE_REL(b.fraction(), carbonFraction, eps); } @@ -41,8 +41,8 @@ BOOST_AUTO_TEST_CASE(construct_with_fractions) { ElementFraction copper(29u, 0.175f); MaterialComposition compound({silicon, carbon, titanium, copper}); - BOOST_TEST(!!compound); - BOOST_TEST(compound.size() == 4u); + BOOST_CHECK(!!compound); + BOOST_CHECK_EQUAL(compound.size(), 4u); float totalFraction = 0.0f; for (const auto& eFraction : compound) { @@ -54,8 +54,8 @@ BOOST_AUTO_TEST_CASE(construct_with_fractions) { // input order should not matter MaterialComposition shuffled({carbon, silicon, titanium, copper}); // check if the sorting worked - BOOST_TEST(compound.size() == shuffled.size()); - BOOST_TEST(compound == shuffled); + BOOST_CHECK_EQUAL(compound.size(), shuffled.size()); + BOOST_CHECK_EQUAL(compound, shuffled); } BOOST_AUTO_TEST_CASE(construct_with_weights) { @@ -65,8 +65,8 @@ BOOST_AUTO_TEST_CASE(construct_with_weights) { ElementFraction copper(29u, 31u); MaterialComposition compound({silicon, carbon, titanium, copper}); - BOOST_TEST(!!compound); - BOOST_TEST(compound.size() == 4u); + BOOST_CHECK(!!compound); + BOOST_CHECK_EQUAL(compound.size(), 4u); float totalFraction = 0.0f; for (const auto& eFraction : compound) { diff --git a/Tests/UnitTests/Core/Material/MaterialPropertiesTests.cpp b/Tests/UnitTests/Core/Material/MaterialPropertiesTests.cpp index 3c39af8b113..9921bf68a1f 100644 --- a/Tests/UnitTests/Core/Material/MaterialPropertiesTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialPropertiesTests.cpp @@ -30,8 +30,8 @@ BOOST_AUTO_TEST_CASE(construct_simple) { CHECK_CLOSE_REL(fromMaterial.thickness(), 6., eps); CHECK_CLOSE_REL(fromMaterial.thicknessInX0(), 6., eps); CHECK_CLOSE_REL(fromMaterial.thicknessInL0(), 3., eps); - BOOST_TEST(fromArgs.material() == fromMaterial.material()); - BOOST_TEST(fromArgs == fromMaterial); + BOOST_CHECK_EQUAL(fromArgs.material(), fromMaterial.material()); + BOOST_CHECK_EQUAL(fromArgs, fromMaterial); } static const Acts::MaterialProperties a(1., 2., 3., 4., 5., 1.); @@ -72,8 +72,8 @@ BOOST_AUTO_TEST_CASE(scale_thickness) { Acts::MaterialProperties halfScaled = mat; halfScaled.scaleThickness(0.5); - BOOST_TEST(mat != halfMat); - BOOST_TEST(halfMat == halfScaled); + BOOST_CHECK_NE(mat, halfMat); + BOOST_CHECK_EQUAL(halfMat, halfScaled); CHECK_CLOSE_REL(mat.thicknessInX0(), 2 * halfMat.thicknessInX0(), eps); CHECK_CLOSE_REL(mat.thicknessInL0(), 2 * halfMat.thicknessInL0(), eps); CHECK_CLOSE_REL(mat.thickness() * mat.material().massDensity(), diff --git a/Tests/UnitTests/Core/Material/MaterialTests.cpp b/Tests/UnitTests/Core/Material/MaterialTests.cpp index 12668eb2339..7ecd3bc692f 100644 --- a/Tests/UnitTests/Core/Material/MaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialTests.cpp @@ -30,13 +30,13 @@ BOOST_AUTO_TEST_SUITE(Material) BOOST_AUTO_TEST_CASE(ConstructVacuum) { // default constructor builds invalid material a.k.a. vacuum Acts::Material vacuum; - BOOST_TEST(!vacuum); + BOOST_CHECK(!vacuum); } BOOST_AUTO_TEST_CASE(ConstructSomething) { // anything with non-zero Ar is a valid material Acts::Material notVacuum(1, 2, 3, 4, 5); - BOOST_TEST(!!notVacuum); + BOOST_CHECK(!!notVacuum); } BOOST_AUTO_TEST_CASE(Units) { @@ -74,8 +74,8 @@ BOOST_DATA_TEST_CASE(EncodingDecodingRoundtrip, // encode material again Acts::ActsVectorF<5> numbers1 = fromNumbers.classificationNumbers(); - BOOST_TEST(material == fromNumbers); - BOOST_TEST(numbers0 == numbers1); + BOOST_CHECK_EQUAL(material, fromNumbers); + BOOST_CHECK_EQUAL(numbers0, numbers1); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp index a7f1efadd26..ad09f0d3249 100644 --- a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp @@ -6,6 +6,7 @@ // 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 #include #include "Acts/EventData/TrackParameters.hpp" @@ -15,6 +16,7 @@ #include "Acts/Surfaces/DiscSurface.hpp" #include "Acts/Surfaces/PerigeeSurface.hpp" #include "Acts/Surfaces/StrawSurface.hpp" +#include "Acts/Tests/CommonHelpers/Assertions.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Units.hpp" @@ -71,21 +73,21 @@ BOOST_AUTO_TEST_CASE(ConstructState) { CurvilinearParameters(std::nullopt, pos, mom, charge, time), navDir, stepSize, tolerance); - BOOST_TEST(!state.covTransport); - BOOST_TEST(state.covariance == nullptr); - BOOST_TEST(state.pVector[0] == pos.x()); - BOOST_TEST(state.pVector[1] == pos.y()); - BOOST_TEST(state.pVector[2] == pos.z()); - BOOST_TEST(state.pVector[3] == time); + BOOST_CHECK(!state.covTransport); + BOOST_CHECK_EQUAL(state.covariance, nullptr); + BOOST_CHECK_EQUAL(state.pVector[0], pos.x()); + BOOST_CHECK_EQUAL(state.pVector[1], pos.y()); + BOOST_CHECK_EQUAL(state.pVector[2], pos.z()); + BOOST_CHECK_EQUAL(state.pVector[3], time); CHECK_CLOSE_ABS(state.pVector[4], unitDir.x(), eps); CHECK_CLOSE_ABS(state.pVector[5], unitDir.y(), eps); CHECK_CLOSE_ABS(state.pVector[6], unitDir.z(), eps); - BOOST_TEST(state.pVector[7] == charge / absMom); - BOOST_TEST(state.navDir == navDir); - BOOST_TEST(state.pathAccumulated == 0.); - BOOST_TEST(state.stepSize == navDir * stepSize); - BOOST_TEST(state.previousStepSize == 0.); - BOOST_TEST(state.tolerance == tolerance); + BOOST_CHECK_EQUAL(state.pVector[7], charge / absMom); + BOOST_CHECK_EQUAL(state.navDir, navDir); + BOOST_CHECK_EQUAL(state.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(state.stepSize, navDir * stepSize); + BOOST_CHECK_EQUAL(state.previousStepSize, 0.); + BOOST_CHECK_EQUAL(state.tolerance, tolerance); } // test state construction from parameters w/ covariance @@ -94,21 +96,21 @@ BOOST_AUTO_TEST_CASE(ConstructStateWithCovariance) { CurvilinearParameters(cov, pos, mom, charge, time), navDir, stepSize, tolerance); - BOOST_TEST(state.covTransport); - BOOST_TEST(*state.covariance == cov); - BOOST_TEST(state.pVector[0] == pos.x()); - BOOST_TEST(state.pVector[1] == pos.y()); - BOOST_TEST(state.pVector[2] == pos.z()); - BOOST_TEST(state.pVector[3] == time); + BOOST_CHECK(state.covTransport); + BOOST_CHECK_EQUAL(*state.covariance, cov); + BOOST_CHECK_EQUAL(state.pVector[0], pos.x()); + BOOST_CHECK_EQUAL(state.pVector[1], pos.y()); + BOOST_CHECK_EQUAL(state.pVector[2], pos.z()); + BOOST_CHECK_EQUAL(state.pVector[3], time); CHECK_CLOSE_ABS(state.pVector[4], unitDir.x(), eps); CHECK_CLOSE_ABS(state.pVector[5], unitDir.y(), eps); CHECK_CLOSE_ABS(state.pVector[6], unitDir.z(), eps); - BOOST_TEST(state.pVector[7] == charge / absMom); - BOOST_TEST(state.navDir == navDir); - BOOST_TEST(state.pathAccumulated == 0.); - BOOST_TEST(state.stepSize == navDir * stepSize); - BOOST_TEST(state.previousStepSize == 0.); - BOOST_TEST(state.tolerance == tolerance); + BOOST_CHECK_EQUAL(state.pVector[7], charge / absMom); + BOOST_CHECK_EQUAL(state.navDir, navDir); + BOOST_CHECK_EQUAL(state.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(state.stepSize, navDir * stepSize); + BOOST_CHECK_EQUAL(state.previousStepSize, 0.); + BOOST_CHECK_EQUAL(state.tolerance, tolerance); } // test stepper getters for particle state @@ -122,7 +124,7 @@ BOOST_AUTO_TEST_CASE(Getters) { CHECK_CLOSE_ABS(stepper.time(state), time, eps); CHECK_CLOSE_ABS(stepper.direction(state), unitDir, eps); CHECK_CLOSE_ABS(stepper.momentum(state), absMom, eps); - BOOST_TEST(stepper.charge(state) == charge); + BOOST_CHECK_EQUAL(stepper.charge(state), charge); } // test stepper update methods with bound state as input @@ -159,7 +161,7 @@ BOOST_AUTO_TEST_CASE(UpdateFromBound) { CHECK_CLOSE_ABS(stepper.time(state), newTime, eps); CHECK_CLOSE_ABS(stepper.direction(state), newUnitDir, eps); CHECK_CLOSE_ABS(stepper.momentum(state), newAbsMom, eps); - BOOST_TEST(stepper.charge(state) == charge); + BOOST_CHECK_EQUAL(stepper.charge(state), charge); } // test stepper update methods with individual components as input @@ -179,7 +181,7 @@ BOOST_AUTO_TEST_CASE(UpdateFromComponents) { CHECK_CLOSE_ABS(stepper.time(state), newTime, eps); CHECK_CLOSE_ABS(stepper.direction(state), newUnitDir, eps); CHECK_CLOSE_ABS(stepper.momentum(state), newAbsMom, eps); - BOOST_TEST(stepper.charge(state) == charge); + BOOST_CHECK_EQUAL(stepper.charge(state), charge); } // test building a bound state object from the stepper state @@ -196,9 +198,9 @@ BOOST_AUTO_TEST_CASE(BuildBound) { CHECK_CLOSE_ABS(pars.position(), pos, eps); CHECK_CLOSE_ABS(pars.time(), time, eps); CHECK_CLOSE_ABS(pars.momentum(), mom, eps); - BOOST_TEST(pars.charge() == charge); - BOOST_TEST(pars.covariance().has_value()); - BOOST_TEST(*pars.covariance() != cov); + BOOST_CHECK_EQUAL(pars.charge(), charge); + BOOST_CHECK(pars.covariance().has_value()); + BOOST_CHECK_NE(*pars.covariance(), cov); // check Jacobian. should be identity since there was no propagation yet CHECK_CLOSE_ABS(jac, Jacobian(Jacobian::Identity()), eps); // check propagation length @@ -217,9 +219,9 @@ BOOST_AUTO_TEST_CASE(BuildCurvilinear) { CHECK_CLOSE_ABS(pars.position(), pos, eps); CHECK_CLOSE_ABS(pars.time(), time, eps); CHECK_CLOSE_ABS(pars.momentum(), mom, eps); - BOOST_TEST(pars.charge() == charge); - BOOST_TEST(pars.covariance().has_value()); - BOOST_TEST(*pars.covariance() != cov); + BOOST_CHECK_EQUAL(pars.charge(), charge); + BOOST_CHECK(pars.covariance().has_value()); + BOOST_CHECK_NE(*pars.covariance(), cov); // check Jacobian. should be identity since there was no propagation yet CHECK_CLOSE_ABS(jac, Jacobian(Jacobian::Identity()), eps); // check propagation length @@ -236,26 +238,26 @@ BOOST_AUTO_TEST_CASE(Step) { // ensure step does not result in an error auto res = stepper.step(state); - BOOST_TEST(res.ok()); + BOOST_CHECK(res.ok()); // extract the actual step size auto h = res.value(); - BOOST_TEST(state.stepping.stepSize == navDir * stepSize); - BOOST_TEST(state.stepping.stepSize == h); + BOOST_CHECK_EQUAL(state.stepping.stepSize, navDir * stepSize); + BOOST_CHECK_EQUAL(state.stepping.stepSize, h); // check that the position has moved auto deltaPos = (stepper.position(state.stepping) - pos).eval(); - BOOST_TEST(0 < deltaPos.norm()); + BOOST_CHECK_LT(0, deltaPos.norm()); // check that time has changed auto deltaTime = stepper.time(state.stepping) - time; - BOOST_TEST(0 < std::abs(deltaTime)); + BOOST_CHECK_LT(0, std::abs(deltaTime)); // check that the direction was rotated auto projDir = stepper.direction(state.stepping).dot(unitDir); - BOOST_TEST(projDir < 1); + BOOST_CHECK_LT(projDir, 1); // momentum and charge should not change CHECK_CLOSE_ABS(stepper.momentum(state.stepping), absMom, eps); - BOOST_TEST(stepper.charge(state.stepping) == charge); + BOOST_CHECK_EQUAL(stepper.charge(state.stepping), charge); } // test step method with covariance transport @@ -268,29 +270,29 @@ BOOST_AUTO_TEST_CASE(StepWithCovariance) { // ensure step does not result in an error auto res = stepper.step(state); - BOOST_TEST(res.ok()); + BOOST_CHECK(res.ok()); // extract the actual step size auto h = res.value(); - BOOST_TEST(state.stepping.stepSize == navDir * stepSize); - BOOST_TEST(state.stepping.stepSize == h); + BOOST_CHECK_EQUAL(state.stepping.stepSize, navDir * stepSize); + BOOST_CHECK_EQUAL(state.stepping.stepSize, h); // check that the position has moved auto deltaPos = (stepper.position(state.stepping) - pos).eval(); - BOOST_TEST(0 < deltaPos.norm()); + BOOST_CHECK_LT(0, deltaPos.norm()); // check that time has changed auto deltaTime = stepper.time(state.stepping) - time; - BOOST_TEST(0 < std::abs(deltaTime)); + BOOST_CHECK_LT(0, std::abs(deltaTime)); // check that the direction was rotated auto projDir = stepper.direction(state.stepping).dot(unitDir); - BOOST_TEST(projDir < 1); + BOOST_CHECK_LT(projDir, 1); // momentum and charge should not change CHECK_CLOSE_ABS(stepper.momentum(state.stepping), absMom, eps); - BOOST_TEST(stepper.charge(state.stepping) == charge); + BOOST_CHECK_EQUAL(stepper.charge(state.stepping), charge); stepper.covarianceTransport(state.stepping); - BOOST_TEST(state.stepping.cov != cov); + BOOST_CHECK_NE(state.stepping.cov, cov); } // test state reset method @@ -322,63 +324,67 @@ BOOST_AUTO_TEST_CASE(Reset) { stepper.resetState(stateCopy, cp.parameters(), *cp.covariance(), cp.referenceSurface(), ndir, stepSize); // Test all components - BOOST_TEST(stateCopy.covTransport); - BOOST_TEST(*stateCopy.covariance == cov); - BOOST_TEST(stepper.position(stateCopy) == - freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(stepper.direction(stateCopy) == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(stepper.momentum(stateCopy) == - std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(stepper.charge(stateCopy) == stepper.charge(state.stepping)); - BOOST_TEST(stepper.time(stateCopy) == freeParams[eFreeTime]); - BOOST_TEST(stateCopy.navDir == ndir); - BOOST_TEST(stateCopy.pathAccumulated == 0.); - BOOST_TEST(stateCopy.stepSize == ndir * stepSize); - BOOST_TEST(stateCopy.previousStepSize == state.stepping.previousStepSize); - BOOST_TEST(stateCopy.tolerance == state.stepping.tolerance); + BOOST_CHECK(stateCopy.covTransport); + BOOST_CHECK_EQUAL(*stateCopy.covariance, cov); + BOOST_CHECK_EQUAL(stepper.position(stateCopy), + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(stepper.direction(stateCopy), + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(stepper.momentum(stateCopy), + std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(stepper.charge(stateCopy), stepper.charge(state.stepping)); + BOOST_CHECK_EQUAL(stepper.time(stateCopy), freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(stateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(stateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(stateCopy.stepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(stateCopy.previousStepSize, + state.stepping.previousStepSize); + BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset all possible parameters except the step size stateCopy = state.stepping; stepper.resetState(stateCopy, cp.parameters(), *cp.covariance(), cp.referenceSurface(), ndir); // Test all components - BOOST_TEST(stateCopy.covTransport); - BOOST_TEST(*stateCopy.covariance == cov); - BOOST_TEST(stepper.position(stateCopy) == - freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(stepper.direction(stateCopy) == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(stepper.momentum(stateCopy) == - std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(stepper.charge(stateCopy) == stepper.charge(state.stepping)); - BOOST_TEST(stepper.time(stateCopy) == freeParams[eFreeTime]); - BOOST_TEST(stateCopy.navDir == ndir); - BOOST_TEST(stateCopy.pathAccumulated == 0.); - BOOST_TEST(stateCopy.stepSize == ndir * std::numeric_limits::max()); - BOOST_TEST(stateCopy.previousStepSize == state.stepping.previousStepSize); - BOOST_TEST(stateCopy.tolerance == state.stepping.tolerance); + BOOST_CHECK(stateCopy.covTransport); + BOOST_CHECK_EQUAL(*stateCopy.covariance, cov); + BOOST_CHECK_EQUAL(stepper.position(stateCopy), + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(stepper.direction(stateCopy), + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(stepper.momentum(stateCopy), + std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(stepper.charge(stateCopy), stepper.charge(state.stepping)); + BOOST_CHECK_EQUAL(stepper.time(stateCopy), freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(stateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(stateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(stateCopy.stepSize, + ndir * std::numeric_limits::max()); + BOOST_CHECK_EQUAL(stateCopy.previousStepSize, + state.stepping.previousStepSize); + BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset the least amount of parameters stateCopy = state.stepping; stepper.resetState(stateCopy, cp.parameters(), *cp.covariance(), cp.referenceSurface()); // Test all components - BOOST_TEST(stateCopy.covTransport); - BOOST_TEST(*stateCopy.covariance == cov); - BOOST_TEST(stepper.position(stateCopy) == - freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(stepper.direction(stateCopy) == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(stepper.momentum(stateCopy) == - std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(stepper.charge(stateCopy) == stepper.charge(state.stepping)); - BOOST_TEST(stepper.time(stateCopy) == freeParams[eFreeTime]); - BOOST_TEST(stateCopy.navDir == forward); - BOOST_TEST(stateCopy.pathAccumulated == 0.); - BOOST_TEST(stateCopy.stepSize == std::numeric_limits::max()); - BOOST_TEST(stateCopy.previousStepSize == state.stepping.previousStepSize); - BOOST_TEST(stateCopy.tolerance == state.stepping.tolerance); + BOOST_CHECK(stateCopy.covTransport); + BOOST_CHECK_EQUAL(*stateCopy.covariance, cov); + BOOST_CHECK_EQUAL(stepper.position(stateCopy), + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(stepper.direction(stateCopy), + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(stepper.momentum(stateCopy), + std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(stepper.charge(stateCopy), stepper.charge(state.stepping)); + BOOST_CHECK_EQUAL(stepper.time(stateCopy), freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(stateCopy.navDir, forward); + BOOST_CHECK_EQUAL(stateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(stateCopy.stepSize, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(stateCopy.previousStepSize, + state.stepping.previousStepSize); + BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset using different surface shapes // 1) Disc surface @@ -397,8 +403,9 @@ BOOST_AUTO_TEST_CASE(Reset) { Stepper::State stateDisc = state.stepping; stepper.resetState(stateDisc, boundDisc.parameters(), *boundDisc.covariance(), boundDisc.referenceSurface()); - BOOST_TEST(stateDisc.pVector != stateCopy.pVector); - BOOST_TEST(stateDisc.pVector != state.stepping.pVector); + + CHECK_NE_COLLECTIONS(stateDisc.pVector, stateCopy.pVector); + CHECK_NE_COLLECTIONS(stateDisc.pVector, state.stepping.pVector); // 2) Perigee surface // Setting some parameters @@ -416,9 +423,9 @@ BOOST_AUTO_TEST_CASE(Reset) { stepper.resetState(statePerigee, boundPerigee.parameters(), *boundPerigee.covariance(), boundPerigee.referenceSurface()); - BOOST_TEST(statePerigee.pVector != stateCopy.pVector); - BOOST_TEST(statePerigee.pVector != state.stepping.pVector); - BOOST_TEST(statePerigee.pVector != stateDisc.pVector); + CHECK_NE_COLLECTIONS(statePerigee.pVector, stateCopy.pVector); + CHECK_NE_COLLECTIONS(statePerigee.pVector, state.stepping.pVector); + CHECK_NE_COLLECTIONS(statePerigee.pVector, stateDisc.pVector); // 3) Straw surface // Setting some parameters @@ -435,10 +442,12 @@ BOOST_AUTO_TEST_CASE(Reset) { Stepper::State stateStraw = state.stepping; stepper.resetState(stateStraw, boundStraw.parameters(), *boundStraw.covariance(), boundStraw.referenceSurface()); - BOOST_TEST(stateStraw.pVector != stateCopy.pVector); - BOOST_TEST(stateStraw.pVector != state.stepping.pVector); - BOOST_TEST(stateStraw.pVector != stateDisc.pVector); - BOOST_TEST(stateStraw.pVector == statePerigee.pVector); + CHECK_NE_COLLECTIONS(stateStraw.pVector, stateCopy.pVector); + CHECK_NE_COLLECTIONS(stateStraw.pVector, state.stepping.pVector); + CHECK_NE_COLLECTIONS(stateStraw.pVector, stateDisc.pVector); + BOOST_CHECK_EQUAL_COLLECTIONS( + stateStraw.pVector.begin(), stateStraw.pVector.end(), + statePerigee.pVector.begin(), statePerigee.pVector.end()); } BOOST_AUTO_TEST_CASE(StepSize) { @@ -448,14 +457,14 @@ BOOST_AUTO_TEST_CASE(StepSize) { navDir, stepSize, tolerance); // TODO figure out why this fails and what it should be - // BOOST_TEST(stepper.overstepLimit(state) == tolerance); + // BOOST_CHECK_EQUAL(stepper.overstepLimit(state), tolerance); stepper.setStepSize(state, 5_cm); - BOOST_TEST(state.previousStepSize == navDir * stepSize); - BOOST_TEST(state.stepSize == 5_cm); + BOOST_CHECK_EQUAL(state.previousStepSize, navDir * stepSize); + BOOST_CHECK_EQUAL(state.stepSize, 5_cm); stepper.releaseStepSize(state); - BOOST_TEST(state.stepSize == navDir * stepSize); + BOOST_CHECK_EQUAL(state.stepSize, navDir * stepSize); } // test step size modification with target surfaces @@ -470,7 +479,8 @@ BOOST_AUTO_TEST_CASE(StepSizeSurface) { pos + navDir * distance * unitDir, unitDir); stepper.updateSurfaceStatus(state, *target, BoundaryCheck(false)); - BOOST_TEST(state.stepSize.value(ConstrainedStep::actor) == navDir * distance); + BOOST_CHECK_EQUAL(state.stepSize.value(ConstrainedStep::actor), + navDir * distance); // test the step size modification in the context of a surface stepper.updateStepSize( @@ -478,7 +488,7 @@ BOOST_AUTO_TEST_CASE(StepSizeSurface) { target->intersect(state.geoContext, stepper.position(state), state.navDir * stepper.direction(state), false), false); - BOOST_TEST(state.stepSize == distance); + BOOST_CHECK_EQUAL(state.stepSize, distance); // start with a different step size state.stepSize = navDir * stepSize; @@ -487,7 +497,7 @@ BOOST_AUTO_TEST_CASE(StepSizeSurface) { target->intersect(state.geoContext, stepper.position(state), state.navDir * stepper.direction(state), false), true); - BOOST_TEST(state.stepSize == distance); + BOOST_CHECK_EQUAL(state.stepSize, distance); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Propagator/CovarianceEngineTests.cpp b/Tests/UnitTests/Core/Propagator/CovarianceEngineTests.cpp index 19ee04ada01..1e880b822fb 100644 --- a/Tests/UnitTests/Core/Propagator/CovarianceEngineTests.cpp +++ b/Tests/UnitTests/Core/Propagator/CovarianceEngineTests.cpp @@ -49,13 +49,13 @@ BOOST_AUTO_TEST_CASE(covariance_engine_test) { derivatives, jacobianLocalToGlobal, direction); // Tests to see that the right components are (un-)changed - BOOST_TEST(covariance != Covariance::Identity()); - BOOST_TEST(jacobian != 2. * Jacobian::Identity()); - BOOST_TEST(transportJacobian == FreeMatrix::Identity()); - BOOST_TEST(derivatives == FreeVector::Zero()); - BOOST_TEST(jacobianLocalToGlobal != 4. * BoundToFreeMatrix::Identity()); - BOOST_TEST(direction == - Vector3D(sqrt(5. / 22.), 3. * sqrt(2. / 55.), 7. / sqrt(110.))); + BOOST_CHECK_NE(covariance, Covariance::Identity()); + BOOST_CHECK_NE(jacobian, 2. * Jacobian::Identity()); + BOOST_CHECK_EQUAL(transportJacobian, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(derivatives, FreeVector::Zero()); + BOOST_CHECK_NE(jacobianLocalToGlobal, 4. * BoundToFreeMatrix::Identity()); + BOOST_CHECK_EQUAL(direction, Vector3D(sqrt(5. / 22.), 3. * sqrt(2. / 55.), + 7. / sqrt(110.))); // Reset covariance = Covariance::Identity(); @@ -70,19 +70,19 @@ BOOST_AUTO_TEST_CASE(covariance_engine_test) { transportJacobian, derivatives, jacobianLocalToGlobal, parameters, *surface); - BOOST_TEST(covariance != Covariance::Identity()); - BOOST_TEST(jacobian != 2. * Jacobian::Identity()); - BOOST_TEST(transportJacobian == FreeMatrix::Identity()); - BOOST_TEST(derivatives == FreeVector::Zero()); - BOOST_TEST(jacobianLocalToGlobal != 4. * BoundToFreeMatrix::Identity()); - BOOST_TEST(parameters == startParameters); + BOOST_CHECK_NE(covariance, Covariance::Identity()); + BOOST_CHECK_NE(jacobian, 2. * Jacobian::Identity()); + BOOST_CHECK_EQUAL(transportJacobian, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(derivatives, FreeVector::Zero()); + BOOST_CHECK_NE(jacobianLocalToGlobal, 4. * BoundToFreeMatrix::Identity()); + BOOST_CHECK_EQUAL(parameters, startParameters); // Produce a curvilinear state without covariance matrix auto curvResult = detail::curvilinearState( covariance, jacobian, transportJacobian, derivatives, jacobianLocalToGlobal, parameters, false, 1337.); - BOOST_TEST(!std::get<0>(curvResult).covariance().has_value()); - BOOST_TEST(std::get<2>(curvResult) == 1337.); + BOOST_CHECK(!std::get<0>(curvResult).covariance().has_value()); + BOOST_CHECK_EQUAL(std::get<2>(curvResult), 1337.); // Reset covariance = Covariance::Identity(); @@ -95,17 +95,18 @@ BOOST_AUTO_TEST_CASE(covariance_engine_test) { curvResult = detail::curvilinearState(covariance, jacobian, transportJacobian, derivatives, jacobianLocalToGlobal, parameters, true, 1337.); - BOOST_TEST(std::get<0>(curvResult).covariance().has_value()); - BOOST_TEST(*(std::get<0>(curvResult).covariance()) != Covariance::Identity()); - BOOST_TEST(std::get<1>(curvResult) != 2. * Jacobian::Identity()); - BOOST_TEST(std::get<2>(curvResult) == 1337.); + BOOST_CHECK(std::get<0>(curvResult).covariance().has_value()); + BOOST_CHECK_NE(*(std::get<0>(curvResult).covariance()), + Covariance::Identity()); + BOOST_CHECK_NE(std::get<1>(curvResult), 2. * Jacobian::Identity()); + BOOST_CHECK_EQUAL(std::get<2>(curvResult), 1337.); // Produce a bound state without covariance matrix auto boundResult = detail::boundState( tgContext, covariance, jacobian, transportJacobian, derivatives, jacobianLocalToGlobal, parameters, false, 1337., *surface); - BOOST_TEST(!std::get<0>(boundResult).covariance().has_value()); - BOOST_TEST(std::get<2>(boundResult) == 1337.); + BOOST_CHECK(!std::get<0>(boundResult).covariance().has_value()); + BOOST_CHECK_EQUAL(std::get<2>(boundResult), 1337.); // Reset covariance = Covariance::Identity(); @@ -118,11 +119,11 @@ BOOST_AUTO_TEST_CASE(covariance_engine_test) { boundResult = detail::boundState( tgContext, covariance, jacobian, transportJacobian, derivatives, jacobianLocalToGlobal, parameters, true, 1337., *surface); - BOOST_TEST(std::get<0>(boundResult).covariance().has_value()); - BOOST_TEST(*(std::get<0>(boundResult).covariance()) != - Covariance::Identity()); - BOOST_TEST(std::get<1>(boundResult) != 2. * Jacobian::Identity()); - BOOST_TEST(std::get<2>(boundResult) == 1337.); + BOOST_CHECK(std::get<0>(boundResult).covariance().has_value()); + BOOST_CHECK_NE(*(std::get<0>(boundResult).covariance()), + Covariance::Identity()); + BOOST_CHECK_NE(std::get<1>(boundResult), 2. * Jacobian::Identity()); + BOOST_CHECK_EQUAL(std::get<2>(boundResult), 1337.); } } // namespace Test } // namespace Acts \ No newline at end of file diff --git a/Tests/UnitTests/Core/Propagator/MaterialCollectionTests.cpp b/Tests/UnitTests/Core/Propagator/MaterialCollectionTests.cpp index 031f0addba0..68ce448493d 100644 --- a/Tests/UnitTests/Core/Propagator/MaterialCollectionTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MaterialCollectionTests.cpp @@ -425,8 +425,9 @@ void runTest(const propagator_t& prop, double pT, double phi, double theta, // forward material test const auto& covfwdResult = prop.propagate(start, fwdOptions).value(); - BOOST_TEST(cov.determinant() <= - covfwdResult.endParameters->covariance().value().determinant()); + BOOST_CHECK_LE( + cov.determinant(), + covfwdResult.endParameters->covariance().value().determinant()); } // This test case checks that no segmentation fault appears diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index 8a33793a11c..b1f9106f640 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -300,18 +300,18 @@ BOOST_AUTO_TEST_CASE(Navigator_status_methods) { // // Run without anything present navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr)); // Run with geometry but without resolving navigator.trackingGeometry = tGeometry; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr)); // Run with geometry and resolving but broken navigation for various reasons navigator.resolveSensitive = true; @@ -321,28 +321,28 @@ BOOST_AUTO_TEST_CASE(Navigator_status_methods) { // a) Because target is reached state.navigation.targetReached = true; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr)); // b) Beacause of no target surface state.navigation.targetReached = false; state.navigation.targetSurface = nullptr; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr)); // c) Because the target surface is reached const Surface* startSurf = tGeometry->getBeamline(); state.stepping.pos = startSurf->center(state.geoContext); const Surface* targetSurf = startSurf; state.navigation.targetSurface = targetSurf; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, nullptr, nullptr, - nullptr, nullptr, targetSurf, nullptr, - nullptr, nullptr, targetSurf)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, nullptr, nullptr, + nullptr, nullptr, targetSurf, nullptr, + nullptr, nullptr, targetSurf)); // // (2) Test the initialisation @@ -356,28 +356,28 @@ BOOST_AUTO_TEST_CASE(Navigator_status_methods) { const Layer* startLay = startVol->associatedLayer( state.geoContext, stepper.position(state.stepping)); navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, worldVol, startVol, - startLay, nullptr, nullptr, startVol, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, worldVol, startVol, + startLay, nullptr, nullptr, startVol, + nullptr, nullptr, nullptr)); // b) Initialise having a start surface state.navigation = Navigator::State(); state.navigation.startSurface = startSurf; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, worldVol, startVol, - startLay, startSurf, startSurf, - startVol, nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, worldVol, startVol, + startLay, startSurf, startSurf, + startVol, nullptr, nullptr, nullptr)); // c) Initialise having a start volume state.navigation = Navigator::State(); state.navigation.startVolume = startVol; navigator.status(state, stepper); - BOOST_TEST(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); - BOOST_TEST(testNavigatorStatePointers(state.navigation, worldVol, startVol, - startLay, nullptr, nullptr, startVol, - nullptr, nullptr, nullptr)); + BOOST_CHECK(testNavigatorStateVectors(state.navigation, 0u, 0u, 0u, 0u)); + BOOST_CHECK(testNavigatorStatePointers(state.navigation, worldVol, startVol, + startLay, nullptr, nullptr, startVol, + nullptr, nullptr, nullptr)); } BOOST_AUTO_TEST_CASE(Navigator_target_methods) { diff --git a/Tests/UnitTests/Core/Propagator/StepperTests.cpp b/Tests/UnitTests/Core/Propagator/StepperTests.cpp index 9ef0b2110a8..88d441621ab 100644 --- a/Tests/UnitTests/Core/Propagator/StepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StepperTests.cpp @@ -143,36 +143,36 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { stepSize, tolerance); // Test the result & compare with the input/test for reasonable members - BOOST_TEST(esState.jacToGlobal == BoundToFreeMatrix::Zero()); - BOOST_TEST(esState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esState.derivative == FreeVector::Zero()); - BOOST_TEST(!esState.covTransport); - BOOST_TEST(esState.cov == Covariance::Zero()); - BOOST_TEST(esState.pos == pos); - BOOST_TEST(esState.dir == mom.normalized()); - BOOST_TEST(esState.p == mom.norm()); - BOOST_TEST(esState.q == charge); - BOOST_TEST(esState.t == time); - BOOST_TEST(esState.navDir == ndir); - BOOST_TEST(esState.pathAccumulated == 0.); - BOOST_TEST(esState.stepSize == ndir * stepSize); - BOOST_TEST(esState.previousStepSize == 0.); - BOOST_TEST(esState.tolerance == tolerance); + BOOST_CHECK_EQUAL(esState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(esState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esState.derivative, FreeVector::Zero()); + BOOST_CHECK(!esState.covTransport); + BOOST_CHECK_EQUAL(esState.cov, Covariance::Zero()); + BOOST_CHECK_EQUAL(esState.pos, pos); + BOOST_CHECK_EQUAL(esState.dir, mom.normalized()); + BOOST_CHECK_EQUAL(esState.p, mom.norm()); + BOOST_CHECK_EQUAL(esState.q, charge); + BOOST_CHECK_EQUAL(esState.t, time); + BOOST_CHECK_EQUAL(esState.navDir, ndir); + BOOST_CHECK_EQUAL(esState.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(esState.stepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(esState.previousStepSize, 0.); + BOOST_CHECK_EQUAL(esState.tolerance, tolerance); // Test without charge and covariance matrix NeutralCurvilinearTrackParameters ncp(std::nullopt, pos, mom, time); esState = EigenStepper::State(tgContext, mfContext, ncp, ndir, stepSize, tolerance); - BOOST_TEST(esState.q == 0.); + BOOST_CHECK_EQUAL(esState.q, 0.); // Test with covariance matrix Covariance cov = 8. * Covariance::Identity(); ncp = NeutralCurvilinearTrackParameters(cov, pos, mom, time); esState = EigenStepper::State(tgContext, mfContext, ncp, ndir, stepSize, tolerance); - BOOST_TEST(esState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esState.covTransport); - BOOST_TEST(esState.cov == cov); + BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK(esState.covTransport); + BOOST_CHECK_EQUAL(esState.cov, cov); } /// These tests are aiming to test the functions of the EigenStepper @@ -198,24 +198,24 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { EigenStepper es(bField); // Test the getters - BOOST_TEST(es.position(esState) == esState.pos); - BOOST_TEST(es.direction(esState) == esState.dir); - BOOST_TEST(es.momentum(esState) == esState.p); - BOOST_TEST(es.charge(esState) == esState.q); - BOOST_TEST(es.time(esState) == esState.t); - //~ BOOST_TEST(es.overstepLimit(esState) == tolerance); - BOOST_TEST(es.getField(esState, pos) == bField.getField(pos)); + BOOST_CHECK_EQUAL(es.position(esState), esState.pos); + BOOST_CHECK_EQUAL(es.direction(esState), esState.dir); + BOOST_CHECK_EQUAL(es.momentum(esState), esState.p); + BOOST_CHECK_EQUAL(es.charge(esState), esState.q); + BOOST_CHECK_EQUAL(es.time(esState), esState.t); + //~ BOOST_CHECK_EQUAL(es.overstepLimit(esState), tolerance); + BOOST_CHECK_EQUAL(es.getField(esState, pos), bField.getField(pos)); // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); es.setStepSize(esState, 1337.); - BOOST_TEST(esState.previousStepSize == ndir * stepSize); - BOOST_TEST(esState.stepSize == 1337.); + BOOST_CHECK_EQUAL(esState.previousStepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(esState.stepSize, 1337.); es.releaseStepSize(esState); - BOOST_TEST(esState.stepSize == -123.); - BOOST_TEST(es.outputStepSize(esState) == originalStepSize); + BOOST_CHECK_EQUAL(esState.stepSize, -123.); + BOOST_CHECK_EQUAL(es.outputStepSize(esState), originalStepSize); // Test the curvilinear state construction auto curvState = es.curvilinearState(esState); @@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { CHECK_CLOSE_ABS(curvPars.momentum(), cp.momentum(), 1e-6); CHECK_CLOSE_ABS(curvPars.charge(), cp.charge(), 1e-6); CHECK_CLOSE_ABS(curvPars.time(), cp.time(), 1e-6); - BOOST_TEST(curvPars.covariance().has_value()); - BOOST_TEST(*curvPars.covariance() != cov); + BOOST_CHECK(curvPars.covariance().has_value()); + BOOST_CHECK_NE(*curvPars.covariance(), cov); CHECK_CLOSE_COVARIANCE(std::get<1>(curvState), BoundMatrix(BoundMatrix::Identity()), 1e-6); CHECK_CLOSE_ABS(std::get<2>(curvState), 0., 1e-6); @@ -235,19 +235,19 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { Vector3D newMom(3., 9., 27.); double newTime(321.); es.update(esState, newPos, newMom.normalized(), newMom.norm(), newTime); - BOOST_TEST(esState.pos == newPos); - BOOST_TEST(esState.dir == newMom.normalized()); - BOOST_TEST(esState.p == newMom.norm()); - BOOST_TEST(esState.q == charge); - BOOST_TEST(esState.t == newTime); + BOOST_CHECK_EQUAL(esState.pos, newPos); + BOOST_CHECK_EQUAL(esState.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(esState.p, newMom.norm()); + BOOST_CHECK_EQUAL(esState.q, charge); + BOOST_CHECK_EQUAL(esState.t, newTime); // The covariance transport esState.cov = cov; es.covarianceTransport(esState); - BOOST_TEST(esState.cov != cov); - BOOST_TEST(esState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esState.derivative == FreeVector::Zero()); + BOOST_CHECK_NE(esState.cov, cov); + BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(esState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esState.derivative, FreeVector::Zero()); // Perform a step without and with covariance transport esState.cov = cov; @@ -255,25 +255,25 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { ps.stepping.covTransport = false; double h = es.step(ps).value(); - BOOST_TEST(ps.stepping.stepSize == h); + BOOST_CHECK_EQUAL(ps.stepping.stepSize, h); CHECK_CLOSE_COVARIANCE(ps.stepping.cov, cov, 1e-6); - BOOST_TEST(ps.stepping.pos.norm() != newPos.norm()); - BOOST_TEST(ps.stepping.dir != newMom.normalized()); - BOOST_TEST(ps.stepping.q == charge); - BOOST_TEST(ps.stepping.t < newTime); - BOOST_TEST(ps.stepping.derivative == FreeVector::Zero()); - BOOST_TEST(ps.stepping.jacTransport == FreeMatrix::Identity()); + BOOST_CHECK_NE(ps.stepping.pos.norm(), newPos.norm()); + BOOST_CHECK_NE(ps.stepping.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(ps.stepping.q, charge); + BOOST_CHECK_LT(ps.stepping.t, newTime); + BOOST_CHECK_EQUAL(ps.stepping.derivative, FreeVector::Zero()); + BOOST_CHECK_EQUAL(ps.stepping.jacTransport, FreeMatrix::Identity()); ps.stepping.covTransport = true; double h2 = es.step(ps).value(); - BOOST_TEST(h2 == h); + BOOST_CHECK_EQUAL(h2, h); CHECK_CLOSE_COVARIANCE(ps.stepping.cov, cov, 1e-6); - BOOST_TEST(ps.stepping.pos.norm() != newPos.norm()); - BOOST_TEST(ps.stepping.dir != newMom.normalized()); - BOOST_TEST(ps.stepping.q == charge); - BOOST_TEST(ps.stepping.t < newTime); - BOOST_TEST(ps.stepping.derivative != FreeVector::Zero()); - BOOST_TEST(ps.stepping.jacTransport != FreeMatrix::Identity()); + BOOST_CHECK_NE(ps.stepping.pos.norm(), newPos.norm()); + BOOST_CHECK_NE(ps.stepping.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(ps.stepping.q, charge); + BOOST_CHECK_LT(ps.stepping.t, newTime); + BOOST_CHECK_NE(ps.stepping.derivative, FreeVector::Zero()); + BOOST_CHECK_NE(ps.stepping.jacTransport, FreeMatrix::Identity()); /// Test the state reset // Construct the parameters @@ -294,69 +294,70 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { es.resetState(esStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface(), ndir, stepSize2); // Test all components - BOOST_TEST(esStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(esStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(esStateCopy.covTransport); - BOOST_TEST(esStateCopy.cov == cov2); - BOOST_TEST(esStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(esStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(esStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(esStateCopy.q == ps.stepping.q); - BOOST_TEST(esStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(esStateCopy.navDir == ndir); - BOOST_TEST(esStateCopy.pathAccumulated == 0.); - BOOST_TEST(esStateCopy.stepSize == ndir * stepSize2); - BOOST_TEST(esStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(esStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(esStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(esStateCopy.covTransport); + BOOST_CHECK_EQUAL(esStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(esStateCopy.pos, freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(esStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(esStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(esStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(esStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(esStateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(esStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(esStateCopy.stepSize, ndir * stepSize2); + BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); // Reset all possible parameters except the step size esStateCopy = ps.stepping; es.resetState(esStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface(), ndir); // Test all components - BOOST_TEST(esStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(esStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(esStateCopy.covTransport); - BOOST_TEST(esStateCopy.cov == cov2); - BOOST_TEST(esStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(esStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(esStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(esStateCopy.q == ps.stepping.q); - BOOST_TEST(esStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(esStateCopy.navDir == ndir); - BOOST_TEST(esStateCopy.pathAccumulated == 0.); - BOOST_TEST(esStateCopy.stepSize == ndir * std::numeric_limits::max()); - BOOST_TEST(esStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(esStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(esStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(esStateCopy.covTransport); + BOOST_CHECK_EQUAL(esStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(esStateCopy.pos, freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(esStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(esStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(esStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(esStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(esStateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(esStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(esStateCopy.stepSize, + ndir * std::numeric_limits::max()); + BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); // Reset the least amount of parameters esStateCopy = ps.stepping; es.resetState(esStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface()); // Test all components - BOOST_TEST(esStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(esStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(esStateCopy.covTransport); - BOOST_TEST(esStateCopy.cov == cov2); - BOOST_TEST(esStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(esStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(esStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(esStateCopy.q == ps.stepping.q); - BOOST_TEST(esStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(esStateCopy.navDir == forward); - BOOST_TEST(esStateCopy.pathAccumulated == 0.); - BOOST_TEST(esStateCopy.stepSize == std::numeric_limits::max()); - BOOST_TEST(esStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(esStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(esStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(esStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(esStateCopy.covTransport); + BOOST_CHECK_EQUAL(esStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(esStateCopy.pos, freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(esStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(esStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(esStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(esStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(esStateCopy.navDir, forward); + BOOST_CHECK_EQUAL(esStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(esStateCopy.stepSize, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); /// Repeat with surface related methods auto plane = Surface::makeShared(pos, mom.normalized()); @@ -368,7 +369,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { auto targetSurface = Surface::makeShared( pos + ndir * 2. * mom.normalized(), mom.normalized()); es.updateSurfaceStatus(esState, *targetSurface, BoundaryCheck(false)); - BOOST_TEST(esState.stepSize.value(ConstrainedStep::actor), ndir * 2.); + BOOST_CHECK_EQUAL(esState.stepSize.value(ConstrainedStep::actor), ndir * 2.); // Test the step size modification in the context of a surface es.updateStepSize( @@ -376,14 +377,14 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { targetSurface->intersect(esState.geoContext, esState.pos, esState.navDir * esState.dir, false), false); - BOOST_TEST(esState.stepSize == 2.); + BOOST_CHECK_EQUAL(esState.stepSize, 2.); esState.stepSize = ndir * stepSize; es.updateStepSize( esState, targetSurface->intersect(esState.geoContext, esState.pos, esState.navDir * esState.dir, false), true); - BOOST_TEST(esState.stepSize == 2.); + BOOST_CHECK_EQUAL(esState.stepSize, 2.); // Test the bound state construction auto boundState = es.boundState(esState, *plane); @@ -392,8 +393,8 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { CHECK_CLOSE_ABS(boundPars.momentum(), bp.momentum(), 1e-6); CHECK_CLOSE_ABS(boundPars.charge(), bp.charge(), 1e-6); CHECK_CLOSE_ABS(boundPars.time(), bp.time(), 1e-6); - BOOST_TEST(boundPars.covariance().has_value()); - BOOST_TEST(*boundPars.covariance() != cov); + BOOST_CHECK(boundPars.covariance().has_value()); + BOOST_CHECK_NE(*boundPars.covariance(), cov); CHECK_CLOSE_COVARIANCE(std::get<1>(boundState), BoundMatrix(BoundMatrix::Identity()), 1e-6); CHECK_CLOSE_ABS(std::get<2>(boundState), 0., 1e-6); @@ -412,19 +413,19 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { freeParams[eFreeQOverP] = bpTarget.charge() / bpTarget.momentum().norm(); es.update(esState, freeParams, *bpTarget.covariance()); - BOOST_TEST(esState.pos == 2. * pos); + BOOST_CHECK_EQUAL(esState.pos, 2. * pos); CHECK_CLOSE_ABS(esState.dir, mom.normalized(), 1e-6); - BOOST_TEST(esState.p == 2. * mom.norm()); - BOOST_TEST(esState.q == 1. * charge); - BOOST_TEST(esState.t == 2. * time); + BOOST_CHECK_EQUAL(esState.p, 2. * mom.norm()); + BOOST_CHECK_EQUAL(esState.q, 1. * charge); + BOOST_CHECK_EQUAL(esState.t, 2. * time); CHECK_CLOSE_COVARIANCE(esState.cov, Covariance(2. * cov), 1e-6); // Transport the covariance in the context of a surface es.covarianceTransport(esState, *plane); - BOOST_TEST(esState.cov != cov); - BOOST_TEST(esState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(esState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(esState.derivative == FreeVector::Zero()); + BOOST_CHECK_NE(esState.cov, cov); + BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(esState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(esState.derivative, FreeVector::Zero()); // Test a case where no step size adjustment is required ps.options.tolerance = 2. * 4.4258e+09; @@ -442,15 +443,15 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { nps.options.tolerance = 1e-21; nps.options.stepSizeCutOff = 1e20; auto res = nes.step(nps); - BOOST_TEST(!res.ok()); - BOOST_TEST(res.error() == EigenStepperError::StepSizeStalled); + BOOST_CHECK(!res.ok()); + BOOST_CHECK_EQUAL(res.error(), EigenStepperError::StepSizeStalled); // Test that the number of trials exceeds nps.options.stepSizeCutOff = 0.; nps.options.maxRungeKuttaStepTrials = 0.; res = nes.step(nps); - BOOST_TEST(!res.ok()); - BOOST_TEST(res.error() == EigenStepperError::StepSizeAdjustmentFailed); + BOOST_CHECK(!res.ok()); + BOOST_CHECK_EQUAL(res.error(), EigenStepperError::StepSizeAdjustmentFailed); } /// @brief This function tests the EigenStepper with the DefaultExtension and @@ -565,11 +566,11 @@ BOOST_AUTO_TEST_CASE(step_extension_vacuum_test) { // Check that the right extension was chosen // If chosen correctly, the number of elements should be identical - BOOST_TEST(stepResult.position.size() == stepResultDef.position.size()); + BOOST_CHECK_EQUAL(stepResult.position.size(), stepResultDef.position.size()); for (unsigned int i = 0; i < stepResult.position.size(); i++) { CHECK_CLOSE_ABS(stepResult.position[i], stepResultDef.position[i], 1_um); } - BOOST_TEST(stepResult.momentum.size() == stepResultDef.momentum.size()); + BOOST_CHECK_EQUAL(stepResult.momentum.size(), stepResultDef.momentum.size()); for (unsigned int i = 0; i < stepResult.momentum.size(); i++) { CHECK_CLOSE_ABS(stepResult.momentum[i], stepResultDef.momentum[i], 1_keV); } @@ -689,11 +690,13 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { // Check that the right extension was chosen // If chosen correctly, the number of elements should be identical - BOOST_TEST(stepResult.position.size() == stepResultDense.position.size()); + BOOST_CHECK_EQUAL(stepResult.position.size(), + stepResultDense.position.size()); for (unsigned int i = 0; i < stepResult.position.size(); i++) { CHECK_CLOSE_ABS(stepResult.position[i], stepResultDense.position[i], 1_um); } - BOOST_TEST(stepResult.momentum.size() == stepResultDense.momentum.size()); + BOOST_CHECK_EQUAL(stepResult.momentum.size(), + stepResultDense.momentum.size()); for (unsigned int i = 0; i < stepResult.momentum.size(); i++) { CHECK_CLOSE_ABS(stepResult.momentum[i], stepResultDense.momentum[i], 1_keV); } @@ -897,18 +900,12 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { CHECK_CLOSE_ABS(endParams.first, endParamsControl.first, 1_um); CHECK_CLOSE_ABS(endParams.second, endParamsControl.second, 1_um); - BOOST_TEST(endParams.first.x() == endParamsControl.first.x(), - tt::tolerance(1e-5)); - BOOST_TEST(endParams.first.y() == endParamsControl.first.y(), - tt::tolerance(1e-5)); - BOOST_TEST(endParams.first.z() == endParamsControl.first.z(), - tt::tolerance(1e-5)); - BOOST_TEST(endParams.second.x() == endParamsControl.second.x(), - tt::tolerance(1e-5)); - BOOST_TEST(endParams.second.y() == endParamsControl.second.y(), - tt::tolerance(1e-5)); - BOOST_TEST(endParams.second.z() == endParamsControl.second.z(), - tt::tolerance(1e-5)); + CHECK_CLOSE_ABS(endParams.first.x(), endParamsControl.first.x(), 1e-5); + CHECK_CLOSE_ABS(endParams.first.y(), endParamsControl.first.y(), 1e-5); + CHECK_CLOSE_ABS(endParams.first.z(), endParamsControl.first.z(), 1e-5); + CHECK_CLOSE_ABS(endParams.second.x(), endParamsControl.second.x(), 1e-5); + CHECK_CLOSE_ABS(endParams.second.y(), endParamsControl.second.y(), 1e-5); + CHECK_CLOSE_ABS(endParams.second.z(), endParamsControl.second.z(), 1e-5); // Build launcher through material // Set initial parameters for the particle track by using the result of the @@ -1097,7 +1094,7 @@ BOOST_AUTO_TEST_CASE(step_extension_trackercalomdt_test) { stepResult.position[i].x() <= 2.4_m) || (stepResult.position[i].x() > 2.6_m && stepResult.position[i].x() <= 2.8_m)) { - BOOST_TEST(stepResult.momentum[i].x() <= lastMomentum); + BOOST_CHECK_LE(stepResult.momentum[i].x(), lastMomentum); lastMomentum = stepResult.momentum[i].x(); } else // Test the absence of momentum loss @@ -1109,7 +1106,7 @@ BOOST_AUTO_TEST_CASE(step_extension_trackercalomdt_test) { stepResult.position[i].x() <= 2.6_m) || (stepResult.position[i].x() > 2.8_m && stepResult.position[i].x() <= 3._m)) { - BOOST_TEST(stepResult.momentum[i].x() == lastMomentum); + BOOST_CHECK_EQUAL(stepResult.momentum[i].x(), lastMomentum); } } } diff --git a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp index 83a9ddf98b7..6502a45742c 100644 --- a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp @@ -54,36 +54,36 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_state_test) { tolerance); // Test the result & compare with the input/test for reasonable members - BOOST_TEST(slsState.jacToGlobal == BoundToFreeMatrix::Zero()); - BOOST_TEST(slsState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsState.derivative == FreeVector::Zero()); - BOOST_TEST(!slsState.covTransport); - BOOST_TEST(slsState.cov == Covariance::Zero()); - BOOST_TEST(slsState.pos == pos); - BOOST_TEST(slsState.dir == mom.normalized()); - BOOST_TEST(slsState.p == mom.norm()); - BOOST_TEST(slsState.q == charge); - BOOST_TEST(slsState.t == time); - BOOST_TEST(slsState.navDir == ndir); - BOOST_TEST(slsState.pathAccumulated == 0.); - BOOST_TEST(slsState.stepSize == ndir * stepSize); - BOOST_TEST(slsState.previousStepSize == 0.); - BOOST_TEST(slsState.tolerance == tolerance); + BOOST_CHECK_EQUAL(slsState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(slsState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsState.derivative, FreeVector::Zero()); + BOOST_CHECK(!slsState.covTransport); + BOOST_CHECK_EQUAL(slsState.cov, Covariance::Zero()); + BOOST_CHECK_EQUAL(slsState.pos, pos); + BOOST_CHECK_EQUAL(slsState.dir, mom.normalized()); + BOOST_CHECK_EQUAL(slsState.p, mom.norm()); + BOOST_CHECK_EQUAL(slsState.q, charge); + BOOST_CHECK_EQUAL(slsState.t, time); + BOOST_CHECK_EQUAL(slsState.navDir, ndir); + BOOST_CHECK_EQUAL(slsState.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(slsState.stepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(slsState.previousStepSize, 0.); + BOOST_CHECK_EQUAL(slsState.tolerance, tolerance); // Test without charge and covariance matrix NeutralCurvilinearTrackParameters ncp(std::nullopt, pos, mom, time); slsState = StraightLineStepper::State(tgContext, mfContext, ncp, ndir, stepSize, tolerance); - BOOST_TEST(slsState.q == 0.); + BOOST_CHECK_EQUAL(slsState.q, 0.); // Test with covariance matrix Covariance cov = 8. * Covariance::Identity(); ncp = NeutralCurvilinearTrackParameters(cov, pos, mom, time); slsState = StraightLineStepper::State(tgContext, mfContext, ncp, ndir, stepSize, tolerance); - BOOST_TEST(slsState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsState.covTransport); - BOOST_TEST(slsState.cov == cov); + BOOST_CHECK_NE(slsState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK(slsState.covTransport); + BOOST_CHECK_EQUAL(slsState.cov, cov); } /// These tests are aiming to test the functions of the StraightLineStepper @@ -110,24 +110,24 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { StraightLineStepper sls; // Test the getters - BOOST_TEST(sls.position(slsState) == slsState.pos); - BOOST_TEST(sls.direction(slsState) == slsState.dir); - BOOST_TEST(sls.momentum(slsState) == slsState.p); - BOOST_TEST(sls.charge(slsState) == slsState.q); - BOOST_TEST(sls.time(slsState) == slsState.t); + BOOST_CHECK_EQUAL(sls.position(slsState), slsState.pos); + BOOST_CHECK_EQUAL(sls.direction(slsState), slsState.dir); + BOOST_CHECK_EQUAL(sls.momentum(slsState), slsState.p); + BOOST_CHECK_EQUAL(sls.charge(slsState), slsState.q); + BOOST_CHECK_EQUAL(sls.time(slsState), slsState.t); - //~ BOOST_TEST(sls.overstepLimit(slsState) == tolerance); + //~ BOOST_CHECK_EQUAL(sls.overstepLimit(slsState), tolerance); // Step size modifies const std::string originalStepSize = slsState.stepSize.toString(); sls.setStepSize(slsState, 1337.); - BOOST_TEST(slsState.previousStepSize == ndir * stepSize); - BOOST_TEST(slsState.stepSize == 1337.); + BOOST_CHECK_EQUAL(slsState.previousStepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(slsState.stepSize, 1337.); sls.releaseStepSize(slsState); - BOOST_TEST(slsState.stepSize == -123.); - BOOST_TEST(sls.outputStepSize(slsState) == originalStepSize); + BOOST_CHECK_EQUAL(slsState.stepSize, -123.); + BOOST_CHECK_EQUAL(sls.outputStepSize(slsState), originalStepSize); // Test the curvilinear state construction auto curvState = sls.curvilinearState(slsState); @@ -136,8 +136,8 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { CHECK_CLOSE_ABS(curvPars.momentum(), cp.momentum(), 1e-6); CHECK_CLOSE_ABS(curvPars.charge(), cp.charge(), 1e-6); CHECK_CLOSE_ABS(curvPars.time(), cp.time(), 1e-6); - BOOST_TEST(curvPars.covariance().has_value()); - BOOST_TEST(*curvPars.covariance() != cov); + BOOST_CHECK(curvPars.covariance().has_value()); + BOOST_CHECK_NE(*curvPars.covariance(), cov); CHECK_CLOSE_COVARIANCE(std::get<1>(curvState), BoundMatrix(BoundMatrix::Identity()), 1e-6); CHECK_CLOSE_ABS(std::get<2>(curvState), 0., 1e-6); @@ -147,19 +147,19 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { Vector3D newMom(3., 9., 27.); double newTime(321.); sls.update(slsState, newPos, newMom.normalized(), newMom.norm(), newTime); - BOOST_TEST(slsState.pos == newPos); - BOOST_TEST(slsState.dir == newMom.normalized()); - BOOST_TEST(slsState.p == newMom.norm()); - BOOST_TEST(slsState.q == charge); - BOOST_TEST(slsState.t == newTime); + BOOST_CHECK_EQUAL(slsState.pos, newPos); + BOOST_CHECK_EQUAL(slsState.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(slsState.p, newMom.norm()); + BOOST_CHECK_EQUAL(slsState.q, charge); + BOOST_CHECK_EQUAL(slsState.t, newTime); // The covariance transport slsState.cov = cov; sls.covarianceTransport(slsState); - BOOST_TEST(slsState.cov != cov); - BOOST_TEST(slsState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsState.derivative == FreeVector::Zero()); + BOOST_CHECK_NE(slsState.cov, cov); + BOOST_CHECK_NE(slsState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(slsState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsState.derivative, FreeVector::Zero()); // Perform a step without and with covariance transport slsState.cov = cov; @@ -167,29 +167,29 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { ps.stepping.covTransport = false; double h = sls.step(ps).value(); - BOOST_TEST(ps.stepping.stepSize == ndir * stepSize); - BOOST_TEST(ps.stepping.stepSize == h); + BOOST_CHECK_EQUAL(ps.stepping.stepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(ps.stepping.stepSize, h); CHECK_CLOSE_COVARIANCE(ps.stepping.cov, cov, 1e-6); - BOOST_TEST(ps.stepping.pos.norm() > newPos.norm()); - BOOST_TEST(ps.stepping.dir == newMom.normalized()); - BOOST_TEST(ps.stepping.p == newMom.norm()); - BOOST_TEST(ps.stepping.q == charge); - BOOST_TEST(ps.stepping.t < newTime); - BOOST_TEST(ps.stepping.derivative == FreeVector::Zero()); - BOOST_TEST(ps.stepping.jacTransport == FreeMatrix::Identity()); + BOOST_CHECK_GT(ps.stepping.pos.norm(), newPos.norm()); + BOOST_CHECK_EQUAL(ps.stepping.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(ps.stepping.p, newMom.norm()); + BOOST_CHECK_EQUAL(ps.stepping.q, charge); + BOOST_CHECK_LT(ps.stepping.t, newTime); + BOOST_CHECK_EQUAL(ps.stepping.derivative, FreeVector::Zero()); + BOOST_CHECK_EQUAL(ps.stepping.jacTransport, FreeMatrix::Identity()); ps.stepping.covTransport = true; double h2 = sls.step(ps).value(); - BOOST_TEST(ps.stepping.stepSize == ndir * stepSize); - BOOST_TEST(h2 == h); + BOOST_CHECK_EQUAL(ps.stepping.stepSize, ndir * stepSize); + BOOST_CHECK_EQUAL(h2, h); CHECK_CLOSE_COVARIANCE(ps.stepping.cov, cov, 1e-6); - BOOST_TEST(ps.stepping.pos.norm() > newPos.norm()); - BOOST_TEST(ps.stepping.dir == newMom.normalized()); - BOOST_TEST(ps.stepping.p == newMom.norm()); - BOOST_TEST(ps.stepping.q == charge); - BOOST_TEST(ps.stepping.t < newTime); - BOOST_TEST(ps.stepping.derivative != FreeVector::Zero()); - BOOST_TEST(ps.stepping.jacTransport != FreeMatrix::Identity()); + BOOST_CHECK_GT(ps.stepping.pos.norm(), newPos.norm()); + BOOST_CHECK_EQUAL(ps.stepping.dir, newMom.normalized()); + BOOST_CHECK_EQUAL(ps.stepping.p, newMom.norm()); + BOOST_CHECK_EQUAL(ps.stepping.q, charge); + BOOST_CHECK_LT(ps.stepping.t, newTime); + BOOST_CHECK_NE(ps.stepping.derivative, FreeVector::Zero()); + BOOST_CHECK_NE(ps.stepping.jacTransport, FreeMatrix::Identity()); /// Test the state reset // Construct the parameters @@ -210,70 +210,76 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { sls.resetState(slsStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface(), ndir, stepSize2); // Test all components - BOOST_TEST(slsStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(slsStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(slsStateCopy.covTransport); - BOOST_TEST(slsStateCopy.cov == cov2); - BOOST_TEST(slsStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(slsStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(slsStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(slsStateCopy.q == ps.stepping.q); - BOOST_TEST(slsStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(slsStateCopy.navDir == ndir); - BOOST_TEST(slsStateCopy.pathAccumulated == 0.); - BOOST_TEST(slsStateCopy.stepSize == ndir * stepSize2); - BOOST_TEST(slsStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(slsStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(slsStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(slsStateCopy.covTransport); + BOOST_CHECK_EQUAL(slsStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(slsStateCopy.pos, + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(slsStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(slsStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(slsStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(slsStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(slsStateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(slsStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(slsStateCopy.stepSize, ndir * stepSize2); + BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, + ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); // Reset all possible parameters except the step size slsStateCopy = ps.stepping; sls.resetState(slsStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface(), ndir); // Test all components - BOOST_TEST(slsStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(slsStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(slsStateCopy.covTransport); - BOOST_TEST(slsStateCopy.cov == cov2); - BOOST_TEST(slsStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(slsStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(slsStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(slsStateCopy.q == ps.stepping.q); - BOOST_TEST(slsStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(slsStateCopy.navDir == ndir); - BOOST_TEST(slsStateCopy.pathAccumulated == 0.); - BOOST_TEST(slsStateCopy.stepSize == - ndir * std::numeric_limits::max()); - BOOST_TEST(slsStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(slsStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(slsStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(slsStateCopy.covTransport); + BOOST_CHECK_EQUAL(slsStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(slsStateCopy.pos, + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(slsStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(slsStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(slsStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(slsStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(slsStateCopy.navDir, ndir); + BOOST_CHECK_EQUAL(slsStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(slsStateCopy.stepSize, + ndir * std::numeric_limits::max()); + BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, + ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); // Reset the least amount of parameters slsStateCopy = ps.stepping; sls.resetState(slsStateCopy, cp2.parameters(), *cp2.covariance(), cp2.referenceSurface()); // Test all components - BOOST_TEST(slsStateCopy.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsStateCopy.jacToGlobal != ps.stepping.jacToGlobal); - BOOST_TEST(slsStateCopy.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsStateCopy.derivative == FreeVector::Zero()); - BOOST_TEST(slsStateCopy.covTransport); - BOOST_TEST(slsStateCopy.cov == cov2); - BOOST_TEST(slsStateCopy.pos == freeParams.template segment<3>(eFreePos0)); - BOOST_TEST(slsStateCopy.dir == - freeParams.template segment<3>(eFreeDir0).normalized()); - BOOST_TEST(slsStateCopy.p == std::abs(1. / freeParams[eFreeQOverP])); - BOOST_TEST(slsStateCopy.q == ps.stepping.q); - BOOST_TEST(slsStateCopy.t == freeParams[eFreeTime]); - BOOST_TEST(slsStateCopy.navDir == forward); - BOOST_TEST(slsStateCopy.pathAccumulated == 0.); - BOOST_TEST(slsStateCopy.stepSize == std::numeric_limits::max()); - BOOST_TEST(slsStateCopy.previousStepSize == ps.stepping.previousStepSize); - BOOST_TEST(slsStateCopy.tolerance == ps.stepping.tolerance); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_NE(slsStateCopy.jacToGlobal, ps.stepping.jacToGlobal); + BOOST_CHECK_EQUAL(slsStateCopy.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsStateCopy.derivative, FreeVector::Zero()); + BOOST_CHECK(slsStateCopy.covTransport); + BOOST_CHECK_EQUAL(slsStateCopy.cov, cov2); + BOOST_CHECK_EQUAL(slsStateCopy.pos, + freeParams.template segment<3>(eFreePos0)); + BOOST_CHECK_EQUAL(slsStateCopy.dir, + freeParams.template segment<3>(eFreeDir0).normalized()); + BOOST_CHECK_EQUAL(slsStateCopy.p, std::abs(1. / freeParams[eFreeQOverP])); + BOOST_CHECK_EQUAL(slsStateCopy.q, ps.stepping.q); + BOOST_CHECK_EQUAL(slsStateCopy.t, freeParams[eFreeTime]); + BOOST_CHECK_EQUAL(slsStateCopy.navDir, forward); + BOOST_CHECK_EQUAL(slsStateCopy.pathAccumulated, 0.); + BOOST_CHECK_EQUAL(slsStateCopy.stepSize, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, + ps.stepping.previousStepSize); + BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); /// Repeat with surface related methods auto plane = Surface::makeShared(pos, mom.normalized()); @@ -285,7 +291,7 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { auto targetSurface = Surface::makeShared( pos + ndir * 2. * mom.normalized(), mom.normalized()); sls.updateSurfaceStatus(slsState, *targetSurface, BoundaryCheck(false)); - BOOST_TEST(slsState.stepSize.value(ConstrainedStep::actor), ndir * 2.); + BOOST_CHECK_EQUAL(slsState.stepSize.value(ConstrainedStep::actor), ndir * 2.); // Test the step size modification in the context of a surface sls.updateStepSize( @@ -293,14 +299,14 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { targetSurface->intersect(slsState.geoContext, slsState.pos, slsState.navDir * slsState.dir, false), false); - BOOST_TEST(slsState.stepSize == 2.); + BOOST_CHECK_EQUAL(slsState.stepSize, 2.); slsState.stepSize = ndir * stepSize; sls.updateStepSize( slsState, targetSurface->intersect(slsState.geoContext, slsState.pos, slsState.navDir * slsState.dir, false), true); - BOOST_TEST(slsState.stepSize == 2.); + BOOST_CHECK_EQUAL(slsState.stepSize, 2.); // Test the bound state construction auto boundState = sls.boundState(slsState, *plane); @@ -309,8 +315,8 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { CHECK_CLOSE_ABS(boundPars.momentum(), bp.momentum(), 1e-6); CHECK_CLOSE_ABS(boundPars.charge(), bp.charge(), 1e-6); CHECK_CLOSE_ABS(boundPars.time(), bp.time(), 1e-6); - BOOST_TEST(boundPars.covariance().has_value()); - BOOST_TEST(*boundPars.covariance() != cov); + BOOST_CHECK(boundPars.covariance().has_value()); + BOOST_CHECK_NE(*boundPars.covariance(), cov); CHECK_CLOSE_COVARIANCE(std::get<1>(boundState), BoundMatrix(BoundMatrix::Identity()), 1e-6); CHECK_CLOSE_ABS(std::get<2>(boundState), 0., 1e-6); @@ -329,19 +335,19 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { freeParams[eFreeQOverP] = bpTarget.charge() / bpTarget.momentum().norm(); sls.update(slsState, freeParams, *bpTarget.covariance()); - BOOST_TEST(slsState.pos == 2. * pos); + BOOST_CHECK_EQUAL(slsState.pos, 2. * pos); CHECK_CLOSE_ABS(slsState.dir, mom.normalized(), 1e-6); - BOOST_TEST(slsState.p == 2. * mom.norm()); - BOOST_TEST(slsState.q == 1. * charge); - BOOST_TEST(slsState.t == 2. * time); + BOOST_CHECK_EQUAL(slsState.p, 2. * mom.norm()); + BOOST_CHECK_EQUAL(slsState.q, 1. * charge); + BOOST_CHECK_EQUAL(slsState.t, 2. * time); CHECK_CLOSE_COVARIANCE(slsState.cov, Covariance(2. * cov), 1e-6); // Transport the covariance in the context of a surface sls.covarianceTransport(slsState, *plane); - BOOST_TEST(slsState.cov != cov); - BOOST_TEST(slsState.jacToGlobal != BoundToFreeMatrix::Zero()); - BOOST_TEST(slsState.jacTransport == FreeMatrix::Identity()); - BOOST_TEST(slsState.derivative == FreeVector::Zero()); + BOOST_CHECK_NE(slsState.cov, cov); + BOOST_CHECK_NE(slsState.jacToGlobal, BoundToFreeMatrix::Zero()); + BOOST_CHECK_EQUAL(slsState.jacTransport, FreeMatrix::Identity()); + BOOST_CHECK_EQUAL(slsState.derivative, FreeVector::Zero()); } } // namespace Test } // namespace Acts \ No newline at end of file diff --git a/Tests/UnitTests/Core/Propagator/VolumeMaterialInteractionTests.cpp b/Tests/UnitTests/Core/Propagator/VolumeMaterialInteractionTests.cpp index 07a4b10d438..64a8e2e07c9 100644 --- a/Tests/UnitTests/Core/Propagator/VolumeMaterialInteractionTests.cpp +++ b/Tests/UnitTests/Core/Propagator/VolumeMaterialInteractionTests.cpp @@ -84,31 +84,31 @@ BOOST_AUTO_TEST_CASE(volume_material_interaction_test) { // Build the VolumeMaterialInteraction & test assignments detail::VolumeMaterialInteraction volMatInt(volume, state, stepper); - BOOST_TEST(volMatInt.volume == volume); - BOOST_TEST(volMatInt.pos == state.stepping.pos); - BOOST_TEST(volMatInt.time == state.stepping.t); - BOOST_TEST(volMatInt.dir == state.stepping.dir); - BOOST_TEST(volMatInt.momentum == state.stepping.p); - BOOST_TEST(volMatInt.q == state.stepping.q); + BOOST_CHECK_EQUAL(volMatInt.volume, volume); + BOOST_CHECK_EQUAL(volMatInt.pos, state.stepping.pos); + BOOST_CHECK_EQUAL(volMatInt.time, state.stepping.t); + BOOST_CHECK_EQUAL(volMatInt.dir, state.stepping.dir); + BOOST_CHECK_EQUAL(volMatInt.momentum, state.stepping.p); + BOOST_CHECK_EQUAL(volMatInt.q, state.stepping.q); CHECK_CLOSE_ABS(volMatInt.qOverP, state.stepping.q / state.stepping.p, 1e-6); - BOOST_TEST(volMatInt.mass == state.options.mass); - BOOST_TEST(volMatInt.pdg == state.options.absPdgCode); - BOOST_TEST(volMatInt.performCovarianceTransport == - state.stepping.covTransport); - BOOST_TEST(volMatInt.nav == state.stepping.navDir); + BOOST_CHECK_EQUAL(volMatInt.mass, state.options.mass); + BOOST_CHECK_EQUAL(volMatInt.pdg, state.options.absPdgCode); + BOOST_CHECK_EQUAL(volMatInt.performCovarianceTransport, + state.stepping.covTransport); + BOOST_CHECK_EQUAL(volMatInt.nav, state.stepping.navDir); // Evaluate the material bool result = volMatInt.evaluateMaterialProperties(state); - BOOST_TEST(result); - BOOST_TEST(volMatInt.slab.material() == mat); - BOOST_TEST(volMatInt.slab.thickness() == 1.); - BOOST_TEST(volMatInt.pathCorrection == 0.); + BOOST_CHECK(result); + BOOST_CHECK_EQUAL(volMatInt.slab.material(), mat); + BOOST_CHECK_EQUAL(volMatInt.slab.thickness(), 1.); + BOOST_CHECK_EQUAL(volMatInt.pathCorrection, 0.); // Evaluate the material without a tracking volume state.navigation.currentVolume = nullptr; result = volMatInt.evaluateMaterialProperties(state); - BOOST_TEST(!result); - BOOST_TEST(volMatInt.pathCorrection == 0.); + BOOST_CHECK(!result); + BOOST_CHECK_EQUAL(volMatInt.pathCorrection, 0.); } } // namespace Test } // namespace Acts \ No newline at end of file diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp index 95158a2aa60..a6e591b22cc 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp @@ -41,20 +41,24 @@ void runTest(const Surface& surface, double l0, double l1, double phi, Vector3D sentinel = Vector3D::Random(); Vector3D pos = sentinel; surface.localToGlobal(geoCtx, Vector2D(l0, l1), dir, pos); - BOOST_TEST(pos != sentinel, "Position was not changed"); - BOOST_TEST(std::isfinite(pos[0]), - "Position " << pos.transpose() << " contains non-finite entries"); - BOOST_TEST(std::isfinite(pos[1]), - "Position " << pos.transpose() << " contains non-finite entries"); - BOOST_TEST(std::isfinite(pos[2]), - "Position " << pos.transpose() << " contains non-finite entries"); - BOOST_TEST(surface.isOnSurface(geoCtx, pos, dir), - "Position " << pos.transpose() << " is not on the surface"); + BOOST_CHECK_MESSAGE(pos != sentinel, "Position was not changed"); + BOOST_CHECK_MESSAGE( + std::isfinite(pos[0]), + "Position " << pos.transpose() << " contains non-finite entries"); + BOOST_CHECK_MESSAGE( + std::isfinite(pos[1]), + "Position " << pos.transpose() << " contains non-finite entries"); + BOOST_CHECK_MESSAGE( + std::isfinite(pos[2]), + "Position " << pos.transpose() << " contains non-finite entries"); + BOOST_CHECK_MESSAGE( + surface.isOnSurface(geoCtx, pos, dir), + "Position " << pos.transpose() << " is not on the surface"); // convert global-to-local Vector2D loc = Vector2D::Zero(); bool validTransform = surface.globalToLocal(geoCtx, pos, dir, loc); - BOOST_TEST(validTransform); + BOOST_CHECK(validTransform); CHECK_CLOSE_OR_SMALL(loc[ePos0], l0, eps, eps); CHECK_CLOSE_OR_SMALL(loc[ePos1], l1, eps, eps); } diff --git a/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp b/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp index dc0aaec40f0..b47c5502510 100644 --- a/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp +++ b/Tests/UnitTests/Core/Utilities/BoundingBoxTest.cpp @@ -73,45 +73,45 @@ BOOST_AUTO_TEST_CASE(intersect_points) { VertexType p; p = {0.5, 0.5, 0.5}; - BOOST_TEST(bb.intersect(p)); + BOOST_CHECK(bb.intersect(p)); p = {0.25, 0.25, 0.25}; - BOOST_TEST(bb.intersect(p)); + BOOST_CHECK(bb.intersect(p)); p = {0.75, 0.75, 0.75}; - BOOST_TEST(bb.intersect(p)); + BOOST_CHECK(bb.intersect(p)); // lower bound is inclusive p = {0, 0, 0}; - BOOST_TEST(bb.intersect(p)); + BOOST_CHECK(bb.intersect(p)); // upper bound is exclusive p = {1.0, 1.0, 1.0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); // some outsides p = {2, 0, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {0, 2, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {0, 0, 2}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {2, 2, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {2, 0, 2}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {2, 2, 2}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {-1, 0, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {0, -1, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {0, 0, -1}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {-1, -1, 0}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {-1, 0, -1}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); p = {-1, -1, -1}; - BOOST_TEST(!bb.intersect(p)); + BOOST_CHECK(!bb.intersect(p)); } BOOST_AUTO_TEST_CASE(intersect_rays) { @@ -124,115 +124,115 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { // ray in positive x direction Ray ray({-2, 0}, {1, 0}); - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 2}, {1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{-2, -2}, {1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // upper bound is exclusive ray = {{-2, 1}, {1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // lower bound is inclusive ray = {{-2, -1}, {1, 0}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); // ray faces away from box ray = {{2, 0}, {1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // ray in negative x direction ray = {{2, 0}, {-1, 0}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{2, 2}, {-1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{2, -2}, {-1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // upper bound is exclusive ray = {{2, 1}, {-1, 0}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // lower bound is inclusive ray = {{2, -1}, {-1, 0}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); // ray in positive y direction ray = {{0, -2}, {0, 1}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{2, -2}, {0, 1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{-2, -2}, {0, 1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // upper bound is exclusive ray = {{1, -2}, {0, 1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // lower bound is not inclusive, // due to Eigen's NaN handling. ray = {{-1, -2}, {0, 1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // other direction ray = {{0, -2}, {0, -1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // ray in positive y direction ray = {{0, 2}, {0, -1}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{2, 2}, {0, -1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{-2, 2}, {0, -1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // upper bound is exclusive ray = {{1, 2}, {0, -1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // lower bound is not inclusive, // due to Eigen's NaN handling. ray = {{-1, 2}, {0, -1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // other direction ray = {{0, 2}, {0, 1}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // some off axis rays ray = {{-2, 0}, {0.5, 0.25}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 0}, {0.5, 0.4}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 0}, {0.5, 0.6}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{-2, 0}, {0.5, 0.1}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 0}, {0.5, -0.4}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{-2, 0}, {0.5, -0.6}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); ray = {{-2, 0}, {0.1, 0.5}}; - BOOST_TEST(!bb.intersect(ray)); + BOOST_CHECK(!bb.intersect(ray)); // starting point inside ray = {{ @@ -240,25 +240,25 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { 0, }, {-1, 0}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{ 0, 0, }, {1, 0}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{ 0, 0, }, {0, -1}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); ray = {{ 0, 0, }, {0, 1}}; - BOOST_TEST(bb.intersect(ray)); + BOOST_CHECK(bb.intersect(ray)); } BOOST_TEST_CONTEXT("3D visualize") { @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { // lets make sure it also works in 3d ObjectBBox bb3(&o, {-1, -1, -1}, {1, 1, 1}); Ray ray3({0, 0, -2}, {0, 0, 1}); - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); PlyVisualization ply; @@ -284,89 +284,89 @@ BOOST_AUTO_TEST_CASE(intersect_rays) { // lets make sure it also works in 3d ObjectBBox bb3(&o, {-1, -1, -1}, {1, 1, 1}); Ray ray3({0, 0, -2}, {0, 0, 1}); - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); // facing away from box ray3 = {{0, 0, -2}, {0, 0, -1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {{0, 2, -2}, {0, 0, 1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {{0, -2, -2}, {0, 0, 1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); // right on slab ray3 = {{0, 1, -2}, {0, 0, 1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); // right on slab ray3 = {{0, -1, -2}, {0, 0, 1}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); // right on slab ray3 = {{-1, 0, -2}, {0, 0, 1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); // right on slab ray3 = {{1, 0, -2}, {0, 0, 1}}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {{-0.95, 0, -2}, {0, 0, 1}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); // some off-axis rays ObjectBBox::VertexType p(0, 0, -2); ray3 = {p, VertexType3(1, 1, 1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(-1, 1, 1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(-1, -1, 1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(1, -1, 1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(1.1, 0, -1) - p}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {p, VertexType3(-1.1, 0, -1) - p}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {p, VertexType3(0, 1.1, -1) - p}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {p, VertexType3(0, -1.1, -1) - p}; - BOOST_TEST(!bb3.intersect(ray3)); + BOOST_CHECK(!bb3.intersect(ray3)); ray3 = {p, VertexType3(0.9, 0, -1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(-0.9, 0, -1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(0, 0.9, -1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {p, VertexType3(0, -0.9, -1) - p}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {1, 0, 0}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {0, 1, 0}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {0, 0, 1}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {-1, 0, 0}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {0, -1, 0}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); ray3 = {{0, 0, 0}, {0, 0, -1}}; - BOOST_TEST(bb3.intersect(ray3)); + BOOST_CHECK(bb3.intersect(ray3)); } } diff --git a/Tests/UnitTests/Core/Utilities/LoggerTests.cpp b/Tests/UnitTests/Core/Utilities/LoggerTests.cpp index d3f526a6d37..eccae30a4c6 100644 --- a/Tests/UnitTests/Core/Utilities/LoggerTests.cpp +++ b/Tests/UnitTests/Core/Utilities/LoggerTests.cpp @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(FATAL_test) { std::ifstream infile("fatal_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(ERROR_test) { std::ifstream infile("error_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(WARNING_test) { std::ifstream infile("warning_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(INFO_test) { std::ifstream infile("info_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } @@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(DEBUG_test) { std::ifstream infile("debug_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } @@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE(VERBOSE_test) { std::ifstream infile("verbose_log.txt", std::ios::in); size_t i = 0; for (std::string line; std::getline(infile, line); ++i) { - BOOST_TEST(line == lines.at(i), detail::failure_msg(line, lines.at(i))); + BOOST_CHECK_EQUAL(line, lines.at(i)); } } } // namespace Test diff --git a/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp b/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp index 27d5dc0b862..4e4073ab034 100644 --- a/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp +++ b/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp @@ -25,32 +25,31 @@ using Indices = boost::mpl::list; BOOST_AUTO_TEST_CASE_TEMPLATE(triviality, T, Indices) { // verify that the MultiIndex is a trivial type // this seems to be compiler-dependent; disable for now - // BOOST_TEST(std::is_trivial_v); - BOOST_TEST(std::is_standard_layout_v); - BOOST_TEST(std::is_trivially_default_constructible_v); - BOOST_TEST(std::is_trivially_copy_constructible_v); - BOOST_TEST(std::is_trivially_move_constructible_v); - BOOST_TEST((std::is_trivially_assignable_v)); - BOOST_TEST((std::is_trivially_copy_assignable_v)); - BOOST_TEST((std::is_trivially_move_assignable_v)); + BOOST_CHECK(std::is_standard_layout_v); + BOOST_CHECK(std::is_trivially_default_constructible_v); + BOOST_CHECK(std::is_trivially_copy_constructible_v); + BOOST_CHECK(std::is_trivially_move_constructible_v); + BOOST_CHECK((std::is_trivially_assignable_v)); + BOOST_CHECK((std::is_trivially_copy_assignable_v)); + BOOST_CHECK((std::is_trivially_move_assignable_v)); } BOOST_AUTO_TEST_CASE(index32_construct) { // construct from encoded value { Index32 idx(0xabcd2400u); - BOOST_TEST(idx.value() == 0xabcd2400u); - BOOST_TEST(idx.level(0) == 0xabcdu); - BOOST_TEST(idx.level(1) == 0x24u); - BOOST_TEST(idx.level(2) == 0x00u); + BOOST_CHECK_EQUAL(idx.value(), 0xabcd2400u); + BOOST_CHECK_EQUAL(idx.level(0), 0xabcdu); + BOOST_CHECK_EQUAL(idx.level(1), 0x24u); + BOOST_CHECK_EQUAL(idx.level(2), 0x00u); } // assign from encoded value { Index32 idx = 0xabcd2400u; - BOOST_TEST(idx.value() == 0xabcd2400u); - BOOST_TEST(idx.level(0) == 0xabcdu); - BOOST_TEST(idx.level(1) == 0x24u); - BOOST_TEST(idx.level(2) == 0x00u); + BOOST_CHECK_EQUAL(idx.value(), 0xabcd2400u); + BOOST_CHECK_EQUAL(idx.level(0), 0xabcdu); + BOOST_CHECK_EQUAL(idx.level(1), 0x24u); + BOOST_CHECK_EQUAL(idx.level(2), 0x00u); } } @@ -58,16 +57,16 @@ BOOST_AUTO_TEST_CASE(index32_set) { Index32 idx = Index32::Zeros(); // set a specific level within limits idx.set(0, 24u); - BOOST_TEST(idx.value() == 0x00180000u); - BOOST_TEST(idx.level(0) == 24u); - BOOST_TEST(idx.level(1) == 0u); - BOOST_TEST(idx.level(2) == 0u); + BOOST_CHECK_EQUAL(idx.value(), 0x00180000u); + BOOST_CHECK_EQUAL(idx.level(0), 24u); + BOOST_CHECK_EQUAL(idx.level(1), 0u); + BOOST_CHECK_EQUAL(idx.level(2), 0u); // set a specific level outside the valid range, should be truncated idx.set(2, 0xfff); - BOOST_TEST(idx.value() == 0x001800ffu); - BOOST_TEST(idx.level(0) == 24u); - BOOST_TEST(idx.level(1) == 0u); - BOOST_TEST(idx.level(2) == 255u); + BOOST_CHECK_EQUAL(idx.value(), 0x001800ffu); + BOOST_CHECK_EQUAL(idx.level(0), 24u); + BOOST_CHECK_EQUAL(idx.level(1), 0u); + BOOST_CHECK_EQUAL(idx.level(2), 255u); } BOOST_AUTO_TEST_CASE(index32_set_overflow) { @@ -80,8 +79,8 @@ BOOST_AUTO_TEST_CASE(index32_set_overflow) { // check that values above max are truncated std::size_t lvl = 0; for (auto maxValue : maxValues) { - BOOST_TEST(Index32::Zeros().set(lvl, maxValue + 1) == - Index32::Zeros().set(lvl, 0u)); + BOOST_CHECK_EQUAL(Index32::Zeros().set(lvl, maxValue + 1), + Index32::Zeros().set(lvl, 0u)); lvl += 1; } } @@ -97,8 +96,8 @@ BOOST_AUTO_TEST_CASE(index64_set_overflow) { // check that values above max are truncated std::size_t lvl = 0; for (auto maxValue : maxValues) { - BOOST_TEST(Index64::Zeros().set(lvl, maxValue + 1) == - Index64::Zeros().set(lvl, 0u)); + BOOST_CHECK_EQUAL(Index64::Zeros().set(lvl, maxValue + 1), + Index64::Zeros().set(lvl, 0u)); lvl += 1; } } @@ -106,84 +105,85 @@ BOOST_AUTO_TEST_CASE(index64_set_overflow) { BOOST_AUTO_TEST_CASE(index32_encode) { // all three levels set auto idx3 = Index32::Encode(13u, 14u, 15u); - BOOST_TEST(idx3.level(0) == 13u); - BOOST_TEST(idx3.level(1) == 14u); - BOOST_TEST(idx3.level(2) == 15u); + BOOST_CHECK_EQUAL(idx3.level(0), 13u); + BOOST_CHECK_EQUAL(idx3.level(1), 14u); + BOOST_CHECK_EQUAL(idx3.level(2), 15u); // first two levels set auto idx2 = Index32::Encode(13u, 14u); - BOOST_TEST(idx2.level(0) == 13u); - BOOST_TEST(idx2.level(1) == 14u); - BOOST_TEST(idx2.level(2) == 0u); + BOOST_CHECK_EQUAL(idx2.level(0), 13u); + BOOST_CHECK_EQUAL(idx2.level(1), 14u); + BOOST_CHECK_EQUAL(idx2.level(2), 0u); // only the first level set auto idx1 = Index32::Encode(13u); - BOOST_TEST(idx1.level(0) == 13u); - BOOST_TEST(idx1.level(1) == 0u); - BOOST_TEST(idx1.level(2) == 0u); + BOOST_CHECK_EQUAL(idx1.level(0), 13u); + BOOST_CHECK_EQUAL(idx1.level(1), 0u); + BOOST_CHECK_EQUAL(idx1.level(2), 0u); // nothing set auto idx0 = Index32::Encode(); - BOOST_TEST(idx0 == Index32::Zeros()); - BOOST_TEST(idx0.value() == 0u); - BOOST_TEST(idx0.level(0) == 0u); - BOOST_TEST(idx0.level(1) == 0u); - BOOST_TEST(idx0.level(2) == 0u); + BOOST_CHECK_EQUAL(idx0, Index32::Zeros()); + BOOST_CHECK_EQUAL(idx0.value(), 0u); + BOOST_CHECK_EQUAL(idx0.level(0), 0u); + BOOST_CHECK_EQUAL(idx0.level(1), 0u); + BOOST_CHECK_EQUAL(idx0.level(2), 0u); } BOOST_AUTO_TEST_CASE(index64_encode) { // all four levels set auto idx4 = Index64::Encode(23u, 14u, 15u, 17u); - BOOST_TEST(idx4.level(0) == 23u); - BOOST_TEST(idx4.level(1) == 14u); - BOOST_TEST(idx4.level(2) == 15u); - BOOST_TEST(idx4.level(3) == 17u); + BOOST_CHECK_EQUAL(idx4.level(0), 23u); + BOOST_CHECK_EQUAL(idx4.level(1), 14u); + BOOST_CHECK_EQUAL(idx4.level(2), 15u); + BOOST_CHECK_EQUAL(idx4.level(3), 17u); // first three levels set auto idx3 = Index64::Encode(23u, 14u, 15u); - BOOST_TEST(idx3.level(0) == 23u); - BOOST_TEST(idx3.level(1) == 14u); - BOOST_TEST(idx3.level(2) == 15u); - BOOST_TEST(idx3.level(3) == 0u); + BOOST_CHECK_EQUAL(idx3.level(0), 23u); + BOOST_CHECK_EQUAL(idx3.level(1), 14u); + BOOST_CHECK_EQUAL(idx3.level(2), 15u); + BOOST_CHECK_EQUAL(idx3.level(3), 0u); // first two levels set auto idx2 = Index64::Encode(23u, 14u); - BOOST_TEST(idx2.level(0) == 23u); - BOOST_TEST(idx2.level(1) == 14u); - BOOST_TEST(idx2.level(2) == 0u); - BOOST_TEST(idx2.level(3) == 0u); + BOOST_CHECK_EQUAL(idx2.level(0), 23u); + BOOST_CHECK_EQUAL(idx2.level(1), 14u); + BOOST_CHECK_EQUAL(idx2.level(2), 0u); + BOOST_CHECK_EQUAL(idx2.level(3), 0u); // only the first level set auto idx1 = Index64::Encode(23u); - BOOST_TEST(idx1.level(0) == 23u); - BOOST_TEST(idx1.level(1) == 0u); - BOOST_TEST(idx1.level(2) == 0u); - BOOST_TEST(idx1.level(3) == 0u); + BOOST_CHECK_EQUAL(idx1.level(0), 23u); + BOOST_CHECK_EQUAL(idx1.level(1), 0u); + BOOST_CHECK_EQUAL(idx1.level(2), 0u); + BOOST_CHECK_EQUAL(idx1.level(3), 0u); // nothing set auto idx0 = Index64::Encode(); - BOOST_TEST(idx0 == Index64::Zeros()); - BOOST_TEST(idx0.value() == 0u); - BOOST_TEST(idx0.level(0) == 0u); - BOOST_TEST(idx0.level(1) == 0u); - BOOST_TEST(idx0.level(2) == 0u); - BOOST_TEST(idx0.level(3) == 0u); + BOOST_CHECK_EQUAL(idx0, Index64::Zeros()); + BOOST_CHECK_EQUAL(idx0.value(), 0u); + BOOST_CHECK_EQUAL(idx0.level(0), 0u); + BOOST_CHECK_EQUAL(idx0.level(1), 0u); + BOOST_CHECK_EQUAL(idx0.level(2), 0u); + BOOST_CHECK_EQUAL(idx0.level(3), 0u); } BOOST_AUTO_TEST_CASE(uint32_sibling) { auto idx = Index32::Encode(1u, 12u, 123u); - BOOST_TEST(idx.makeNextSibling(0) == Index32::Encode(2u)); - BOOST_TEST(idx.makeNextSibling(1) == Index32::Encode(1u, 13u)); - BOOST_TEST(idx.makeNextSibling(2) == Index32::Encode(1u, 12u, 124u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(0), Index32::Encode(2u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(1), Index32::Encode(1u, 13u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(2), Index32::Encode(1u, 12u, 124u)); } BOOST_AUTO_TEST_CASE(uint64_sibling) { auto idx = Index64::Encode(1u, 12u, 123u, 1234u); - BOOST_TEST(idx.makeNextSibling(0) == Index64::Encode(2u)); - BOOST_TEST(idx.makeNextSibling(1) == Index64::Encode(1u, 13u)); - BOOST_TEST(idx.makeNextSibling(2) == Index64::Encode(1u, 12u, 124u)); - BOOST_TEST(idx.makeNextSibling(3) == Index64::Encode(1u, 12u, 123u, 1235u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(0), Index64::Encode(2u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(1), Index64::Encode(1u, 13u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(2), Index64::Encode(1u, 12u, 124u)); + BOOST_CHECK_EQUAL(idx.makeNextSibling(3), + Index64::Encode(1u, 12u, 123u, 1235u)); } BOOST_AUTO_TEST_CASE(uint32_descendant) { auto idx = Index32::Encode(1u, 12u, 123u); - BOOST_TEST(idx.makeLastDescendant(0) == Index32::Encode(1u, 255u, 255u)); - BOOST_TEST(idx.makeLastDescendant(1) == Index32::Encode(1u, 12u, 255u)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(0), Index32::Encode(1u, 255u, 255u)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(1), Index32::Encode(1u, 12u, 255u)); // last index has no descendant and stays the same - BOOST_TEST(idx.makeLastDescendant(2) == Index32::Encode(1u, 12u, 123u)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(2), Index32::Encode(1u, 12u, 123u)); } BOOST_AUTO_TEST_CASE(uint64_descendant) { @@ -192,13 +192,15 @@ BOOST_AUTO_TEST_CASE(uint64_descendant) { auto max1 = (1u << 17) - 1u; auto max2 = (1u << 21) - 1u; auto max3 = (1u << 13) - 1u; - BOOST_TEST(idx.makeLastDescendant(0) == - Index64::Encode(1u, max1, max2, max3)); - BOOST_TEST(idx.makeLastDescendant(1) == Index64::Encode(1u, 12u, max2, max3)); - BOOST_TEST(idx.makeLastDescendant(2) == Index64::Encode(1u, 12u, 123u, max3)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(0), + Index64::Encode(1u, max1, max2, max3)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(1), + Index64::Encode(1u, 12u, max2, max3)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(2), + Index64::Encode(1u, 12u, 123u, max3)); // last index has no descendant and stays the same - BOOST_TEST(idx.makeLastDescendant(3) == - Index64::Encode(1u, 12u, 123u, 1234u)); + BOOST_CHECK_EQUAL(idx.makeLastDescendant(3), + Index64::Encode(1u, 12u, 123u, 1234u)); } BOOST_AUTO_TEST_CASE(index32_as_key) { @@ -208,13 +210,13 @@ BOOST_AUTO_TEST_CASE(index32_as_key) { set.emplace(Index32::Encode(1u, 3u, 4u)); set.emplace(Index32::Encode(2u)); - BOOST_TEST(not set.count(Index32(0u))); - BOOST_TEST(not set.count(Index32(UINT32_MAX))); - BOOST_TEST(set.size() == 3); + BOOST_CHECK(not set.count(Index32(0u))); + BOOST_CHECK(not set.count(Index32(UINT32_MAX))); + BOOST_CHECK_EQUAL(set.size(), 3); // automatically converts encoded value to MultiIndex - BOOST_TEST(set.count(0x00010204u)); - BOOST_TEST(set.count(0x00010304u)); - BOOST_TEST(set.count(Index32::Encode(2u))); + BOOST_CHECK(set.count(0x00010204u)); + BOOST_CHECK(set.count(0x00010304u)); + BOOST_CHECK(set.count(Index32::Encode(2u))); } BOOST_AUTO_TEST_CASE(index64_as_key) { @@ -226,7 +228,7 @@ BOOST_AUTO_TEST_CASE(index64_as_key) { set.emplace(Index64::Encode(2u, 0u, 0u, 0u)); set.emplace(Index64::Encode(2u, 1u)); - BOOST_TEST(not set.count(Index64(0u))); - BOOST_TEST(not set.count(Index64(UINT64_MAX))); - BOOST_TEST(set.size() == 3); + BOOST_CHECK(not set.count(Index64(0u))); + BOOST_CHECK(not set.count(Index64(UINT64_MAX))); + BOOST_CHECK_EQUAL(set.size(), 3); } diff --git a/Tests/UnitTests/Core/VersionTests.cpp b/Tests/UnitTests/Core/VersionTests.cpp index 40495b6eb06..d1e7c2261d0 100644 --- a/Tests/UnitTests/Core/VersionTests.cpp +++ b/Tests/UnitTests/Core/VersionTests.cpp @@ -18,16 +18,16 @@ BOOST_AUTO_TEST_CASE(Version) { // the only way to get a zero version would be zero for all components - BOOST_TEST(0u < Acts::Version); + BOOST_CHECK_LT(0u, Acts::Version); // these tests are not really useful as the version components can be any // value. they are there so we touch all variables and ensure that they are // accessible. - BOOST_TEST(0u <= Acts::VersionMajor); - BOOST_TEST(0u <= Acts::VersionMinor); - BOOST_TEST(0u <= Acts::VersionPatch); + BOOST_CHECK_LE(0u, Acts::VersionMajor); + BOOST_CHECK_LE(0u, Acts::VersionMinor); + BOOST_CHECK_LE(0u, Acts::VersionPatch); } BOOST_AUTO_TEST_CASE(CommitHash) { - BOOST_TEST(not std::string_view(Acts::CommitHash).empty()); - BOOST_TEST(not std::string_view(Acts::CommitHashShort).empty()); + BOOST_CHECK(not std::string_view(Acts::CommitHash).empty()); + BOOST_CHECK(not std::string_view(Acts::CommitHashShort).empty()); } diff --git a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp index 408df6f4d95..9f1d05dc8bc 100644 --- a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp @@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { } // check if found vertices have compatible z values - BOOST_TEST(allVerticesFound); + BOOST_CHECK(allVerticesFound); } } @@ -515,7 +515,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { } // check if found vertices have compatible z values - BOOST_TEST(allVerticesFound); + BOOST_CHECK(allVerticesFound); } } diff --git a/Tests/UnitTests/Fatras/EventData/BarcodeTests.cpp b/Tests/UnitTests/Fatras/EventData/BarcodeTests.cpp index 10c5f272d53..b79be50a894 100644 --- a/Tests/UnitTests/Fatras/EventData/BarcodeTests.cpp +++ b/Tests/UnitTests/Fatras/EventData/BarcodeTests.cpp @@ -17,39 +17,39 @@ BOOST_AUTO_TEST_SUITE(FatrasBarcode) BOOST_AUTO_TEST_CASE(MakeDescendant) { // initial barcode with primary particle auto p3 = Barcode().setVertexPrimary(1).setVertexSecondary(2).setParticle(3); - BOOST_TEST(p3.vertexPrimary() == 1u); - BOOST_TEST(p3.vertexSecondary() == 2u); - BOOST_TEST(p3.particle() == 3u); - BOOST_TEST(p3.generation() == 0u); - BOOST_TEST(p3.subParticle() == 0u); + BOOST_CHECK_EQUAL(p3.vertexPrimary(), 1u); + BOOST_CHECK_EQUAL(p3.vertexSecondary(), 2u); + BOOST_CHECK_EQUAL(p3.particle(), 3u); + BOOST_CHECK_EQUAL(p3.generation(), 0u); + BOOST_CHECK_EQUAL(p3.subParticle(), 0u); // generate two first-generation descendants auto p30 = p3.makeDescendant(0); auto p31 = p3.makeDescendant(1); - BOOST_TEST(p30.vertexPrimary() == 1u); - BOOST_TEST(p30.vertexSecondary() == 2u); - BOOST_TEST(p30.particle() == 3u); - BOOST_TEST(p30.generation() == 1u); - BOOST_TEST(p30.subParticle() == 0u); - BOOST_TEST(p31.vertexPrimary() == 1u); - BOOST_TEST(p31.vertexSecondary() == 2u); - BOOST_TEST(p31.particle() == 3u); - BOOST_TEST(p31.generation() == 1u); - BOOST_TEST(p31.subParticle() == 1u); + BOOST_CHECK_EQUAL(p30.vertexPrimary(), 1u); + BOOST_CHECK_EQUAL(p30.vertexSecondary(), 2u); + BOOST_CHECK_EQUAL(p30.particle(), 3u); + BOOST_CHECK_EQUAL(p30.generation(), 1u); + BOOST_CHECK_EQUAL(p30.subParticle(), 0u); + BOOST_CHECK_EQUAL(p31.vertexPrimary(), 1u); + BOOST_CHECK_EQUAL(p31.vertexSecondary(), 2u); + BOOST_CHECK_EQUAL(p31.particle(), 3u); + BOOST_CHECK_EQUAL(p31.generation(), 1u); + BOOST_CHECK_EQUAL(p31.subParticle(), 1u); // generate two (overlapping) second-generation descendants. auto p300 = p30.makeDescendant(0); auto p310 = p31.makeDescendant(0); - BOOST_TEST(p300.vertexPrimary() == 1u); - BOOST_TEST(p300.vertexSecondary() == 2u); - BOOST_TEST(p300.particle() == 3u); - BOOST_TEST(p300.generation() == 2u); - BOOST_TEST(p300.subParticle() == 0u); - BOOST_TEST(p310.vertexPrimary() == 1u); - BOOST_TEST(p310.vertexSecondary() == 2u); - BOOST_TEST(p310.particle() == 3u); - BOOST_TEST(p310.generation() == 2u); - BOOST_TEST(p310.subParticle() == 0u); + BOOST_CHECK_EQUAL(p300.vertexPrimary(), 1u); + BOOST_CHECK_EQUAL(p300.vertexSecondary(), 2u); + BOOST_CHECK_EQUAL(p300.particle(), 3u); + BOOST_CHECK_EQUAL(p300.generation(), 2u); + BOOST_CHECK_EQUAL(p300.subParticle(), 0u); + BOOST_CHECK_EQUAL(p310.vertexPrimary(), 1u); + BOOST_CHECK_EQUAL(p310.vertexSecondary(), 2u); + BOOST_CHECK_EQUAL(p310.particle(), 3u); + BOOST_CHECK_EQUAL(p310.generation(), 2u); + BOOST_CHECK_EQUAL(p310.subParticle(), 0u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/EventData/HitTests.cpp b/Tests/UnitTests/Fatras/EventData/HitTests.cpp index 38b19b1f8ea..ff983a72b2e 100644 --- a/Tests/UnitTests/Fatras/EventData/HitTests.cpp +++ b/Tests/UnitTests/Fatras/EventData/HitTests.cpp @@ -30,9 +30,9 @@ BOOST_AUTO_TEST_CASE(WithoutInteraction) { auto m4 = Hit::Vector4(1, 1, 1, 4); auto h = Hit(gid, pid, p4, m4, m4, 12u); - BOOST_TEST(h.geometryId() == gid); - BOOST_TEST(h.particleId() == pid); - BOOST_TEST(h.index() == 12u); + BOOST_CHECK_EQUAL(h.geometryId(), gid); + BOOST_CHECK_EQUAL(h.particleId(), pid); + BOOST_CHECK_EQUAL(h.index(), 12u); CHECK_CLOSE_REL(h.position4(), p4, eps); CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); @@ -54,9 +54,9 @@ BOOST_AUTO_TEST_CASE(WithEnergyLoss) { auto m41 = Hit::Vector4(1.5, 0, 0, 1.5); auto h = Hit(gid, pid, p4, m40, m41, 13u); - BOOST_TEST(h.geometryId() == gid); - BOOST_TEST(h.particleId() == pid); - BOOST_TEST(h.index() == 13u); + BOOST_CHECK_EQUAL(h.geometryId(), gid); + BOOST_CHECK_EQUAL(h.particleId(), pid); + BOOST_CHECK_EQUAL(h.index(), 13u); CHECK_CLOSE_REL(h.position4(), p4, eps); CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); @@ -77,9 +77,9 @@ BOOST_AUTO_TEST_CASE(WithScattering) { auto m41 = Hit::Vector4(0, -2, 2, 5); auto h = Hit(gid, pid, p4, m40, m41, 42u); - BOOST_TEST(h.geometryId() == gid); - BOOST_TEST(h.particleId() == pid); - BOOST_TEST(h.index() == 42u); + BOOST_CHECK_EQUAL(h.geometryId(), gid); + BOOST_CHECK_EQUAL(h.particleId(), pid); + BOOST_CHECK_EQUAL(h.index(), 42u); CHECK_CLOSE_REL(h.position4(), p4, eps); CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); @@ -101,9 +101,9 @@ BOOST_AUTO_TEST_CASE(WithEverything) { auto m41 = Hit::Vector4(2, 1, 2, 4); auto h = Hit(gid, pid, p4, m40, m41, 1u); - BOOST_TEST(h.geometryId() == gid); - BOOST_TEST(h.particleId() == pid); - BOOST_TEST(h.index() == 1u); + BOOST_CHECK_EQUAL(h.geometryId(), gid); + BOOST_CHECK_EQUAL(h.particleId(), pid); + BOOST_CHECK_EQUAL(h.index(), 1u); CHECK_CLOSE_REL(h.position4(), p4, eps); CHECK_CLOSE_REL(h.position(), Hit::Vector3(1, 2, 3), eps); CHECK_CLOSE_REL(h.time(), 4, eps); diff --git a/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp b/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp index cef27c3cc6c..5e02ed5f142 100644 --- a/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp +++ b/Tests/UnitTests/Fatras/EventData/ParticleTests.cpp @@ -29,22 +29,22 @@ BOOST_AUTO_TEST_CASE(Construct) { const auto pid = Barcode().setVertexPrimary(1).setParticle(42); const auto particle = Particle(pid, PdgParticle::eProton, 1_GeV, 1_e); - BOOST_TEST(particle.particleId() == pid); - BOOST_TEST(particle.pdg() == PdgParticle::eProton); + BOOST_CHECK_EQUAL(particle.particleId(), pid); + BOOST_CHECK_EQUAL(particle.pdg(), PdgParticle::eProton); // particle is at rest at the origin - BOOST_TEST(particle.position4() == Particle::Vector4::Zero()); - BOOST_TEST(particle.position() == Particle::Vector3::Zero()); - BOOST_TEST(particle.time() == Particle::Scalar(0)); - BOOST_TEST(particle.position4().x() == particle.position().x()); - BOOST_TEST(particle.position4().y() == particle.position().y()); - BOOST_TEST(particle.position4().z() == particle.position().z()); - BOOST_TEST(particle.position4().w() == particle.time()); + BOOST_CHECK_EQUAL(particle.position4(), Particle::Vector4::Zero()); + BOOST_CHECK_EQUAL(particle.position(), Particle::Vector3::Zero()); + BOOST_CHECK_EQUAL(particle.time(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.position4().x(), particle.position().x()); + BOOST_CHECK_EQUAL(particle.position4().y(), particle.position().y()); + BOOST_CHECK_EQUAL(particle.position4().z(), particle.position().z()); + BOOST_CHECK_EQUAL(particle.position4().w(), particle.time()); // particle direction is undefined, but must be normalized CHECK_CLOSE_REL(particle.unitDirection().norm(), 1, eps); - BOOST_TEST(particle.transverseMomentum() == Particle::Scalar(0)); - BOOST_TEST(particle.absMomentum() == Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.absMomentum(), Particle::Scalar(0)); // particle is created at rest and thus not alive - BOOST_TEST(not particle); + BOOST_CHECK(not particle); } BOOST_AUTO_TEST_CASE(CorrectEnergy) { @@ -53,40 +53,40 @@ BOOST_AUTO_TEST_CASE(CorrectEnergy) { .setDirection(Particle::Vector3::UnitX()) .setAbsMomentum(2_GeV); - BOOST_TEST(particle.mass() == 1_GeV); + BOOST_CHECK_EQUAL(particle.mass(), 1_GeV); // check that the particle has some input energy - BOOST_TEST(particle.momentum4().x() == 2_GeV); - BOOST_TEST(particle.momentum4().y() == 0_GeV); - BOOST_TEST(particle.momentum4().z() == 0_GeV); - BOOST_TEST(particle.momentum4().w() == std::hypot(1_GeV, 2_GeV)); - BOOST_TEST(particle.transverseMomentum() == 2_GeV); - BOOST_TEST(particle.absMomentum() == 2_GeV); - BOOST_TEST(particle.energy() == std::hypot(1_GeV, 2_GeV)); + BOOST_CHECK_EQUAL(particle.momentum4().x(), 2_GeV); + BOOST_CHECK_EQUAL(particle.momentum4().y(), 0_GeV); + BOOST_CHECK_EQUAL(particle.momentum4().z(), 0_GeV); + BOOST_CHECK_EQUAL(particle.momentum4().w(), std::hypot(1_GeV, 2_GeV)); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), 2_GeV); + BOOST_CHECK_EQUAL(particle.absMomentum(), 2_GeV); + BOOST_CHECK_EQUAL(particle.energy(), std::hypot(1_GeV, 2_GeV)); // particle direction must be normalized CHECK_CLOSE_REL(particle.unitDirection().norm(), 1, eps); // loose some energy particle.correctEnergy(-100_MeV); - BOOST_TEST(particle.transverseMomentum() < 2_GeV); - BOOST_TEST(particle.absMomentum() < 2_GeV); - BOOST_TEST(particle.energy() == - Particle::Scalar(std::hypot(1_GeV, 2_GeV) - 100_MeV)); + BOOST_CHECK_LT(particle.transverseMomentum(), 2_GeV); + BOOST_CHECK_LT(particle.absMomentum(), 2_GeV); + BOOST_CHECK_EQUAL(particle.energy(), + Particle::Scalar(std::hypot(1_GeV, 2_GeV) - 100_MeV)); CHECK_CLOSE_REL(particle.unitDirection().norm(), 1, eps); // particle is still alive - BOOST_TEST(particle); + BOOST_CHECK(particle); // loose a lot of energy particle.correctEnergy(-3_GeV); - BOOST_TEST(particle.transverseMomentum() == Particle::Scalar(0)); - BOOST_TEST(particle.absMomentum() == Particle::Scalar(0)); - BOOST_TEST(particle.energy() == particle.mass()); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.absMomentum(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.energy(), particle.mass()); CHECK_CLOSE_REL(particle.unitDirection().norm(), 1, eps); // lossing even more energy does nothing particle.correctEnergy(-10_GeV); - BOOST_TEST(particle.transverseMomentum() == Particle::Scalar(0)); - BOOST_TEST(particle.absMomentum() == Particle::Scalar(0)); - BOOST_TEST(particle.energy() == particle.mass()); + BOOST_CHECK_EQUAL(particle.transverseMomentum(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.absMomentum(), Particle::Scalar(0)); + BOOST_CHECK_EQUAL(particle.energy(), particle.mass()); CHECK_CLOSE_REL(particle.unitDirection().norm(), 1, eps); // particle is not alive anymore - BOOST_TEST(not particle); + BOOST_CHECK(not particle); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Kernel/InteractorTests.cpp b/Tests/UnitTests/Fatras/Kernel/InteractorTests.cpp index 76aff467b48..79a92fa2db1 100644 --- a/Tests/UnitTests/Fatras/Kernel/InteractorTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/InteractorTests.cpp @@ -130,24 +130,25 @@ BOOST_AUTO_TEST_CASE(HitsOnEmptySurface) { // call interactor: surface selection -> one hit, no material -> no secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 0u); - BOOST_TEST(f.result.hits.size() == 1u); - BOOST_TEST(f.result.hits[0].index() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 0u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 1u); + BOOST_CHECK_EQUAL(f.result.hits[0].index(), 0u); // call interactor again: one more hit, still no secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 0u); - BOOST_TEST(f.result.hits.size() == 2u); - BOOST_TEST(f.result.hits[0].index() == 0u); - BOOST_TEST(f.result.hits[1].index() == 1u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 0u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 2u); + BOOST_CHECK_EQUAL(f.result.hits[0].index(), 0u); + BOOST_CHECK_EQUAL(f.result.hits[1].index(), 1u); // particle identity should be the same as the initial input - BOOST_TEST(f.result.particle.particleId() == - f.interactor.particle.particleId()); - BOOST_TEST(f.result.particle.process() == f.interactor.particle.process()); - BOOST_TEST(f.result.particle.pdg() == f.interactor.particle.pdg()); - BOOST_TEST(f.result.particle.charge() == f.interactor.particle.charge()); - BOOST_TEST(f.result.particle.mass() == f.interactor.particle.mass()); + BOOST_CHECK_EQUAL(f.result.particle.particleId(), + f.interactor.particle.particleId()); + BOOST_CHECK_EQUAL(f.result.particle.process(), + f.interactor.particle.process()); + BOOST_CHECK_EQUAL(f.result.particle.pdg(), f.interactor.particle.pdg()); + BOOST_CHECK_EQUAL(f.result.particle.charge(), f.interactor.particle.charge()); + BOOST_CHECK_EQUAL(f.result.particle.mass(), f.interactor.particle.mass()); // particle energy has not changed since there were no interactions CHECK_CLOSE_REL(f.result.particle.energy(), f.interactor.particle.energy(), eps); @@ -158,24 +159,25 @@ BOOST_AUTO_TEST_CASE(HitsOnMaterialSurface) { // call interactor: surface selection -> one hit, material -> one secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 1u); - BOOST_TEST(f.result.hits.size() == 1u); - BOOST_TEST(f.result.hits[0].index() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 1u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 1u); + BOOST_CHECK_EQUAL(f.result.hits[0].index(), 0u); // call interactor again: one more hit, one more secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 2u); - BOOST_TEST(f.result.hits.size() == 2u); - BOOST_TEST(f.result.hits[0].index() == 0u); - BOOST_TEST(f.result.hits[1].index() == 1u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 2u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 2u); + BOOST_CHECK_EQUAL(f.result.hits[0].index(), 0u); + BOOST_CHECK_EQUAL(f.result.hits[1].index(), 1u); // particle identity should be the same as the initial input - BOOST_TEST(f.result.particle.particleId() == - f.interactor.particle.particleId()); - BOOST_TEST(f.result.particle.process() == f.interactor.particle.process()); - BOOST_TEST(f.result.particle.pdg() == f.interactor.particle.pdg()); - BOOST_TEST(f.result.particle.charge() == f.interactor.particle.charge()); - BOOST_TEST(f.result.particle.mass() == f.interactor.particle.mass()); + BOOST_CHECK_EQUAL(f.result.particle.particleId(), + f.interactor.particle.particleId()); + BOOST_CHECK_EQUAL(f.result.particle.process(), + f.interactor.particle.process()); + BOOST_CHECK_EQUAL(f.result.particle.pdg(), f.interactor.particle.pdg()); + BOOST_CHECK_EQUAL(f.result.particle.charge(), f.interactor.particle.charge()); + BOOST_CHECK_EQUAL(f.result.particle.mass(), f.interactor.particle.mass()); // particle energy has changed due to interactions CHECK_CLOSE_REL((f.result.particle.energy() + 1), f.interactor.particle.energy(), eps); @@ -186,21 +188,22 @@ BOOST_AUTO_TEST_CASE(NoHitsEmptySurface) { // call interactor: no surface sel. -> no hit, no material -> no secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 0u); - BOOST_TEST(f.result.hits.size() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 0u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 0u); // call interactor again: no hit, still no secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 0u); - BOOST_TEST(f.result.hits.size() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 0u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 0u); // particle identity should be the same as the initial input - BOOST_TEST(f.result.particle.particleId() == - f.interactor.particle.particleId()); - BOOST_TEST(f.result.particle.process() == f.interactor.particle.process()); - BOOST_TEST(f.result.particle.pdg() == f.interactor.particle.pdg()); - BOOST_TEST(f.result.particle.charge() == f.interactor.particle.charge()); - BOOST_TEST(f.result.particle.mass() == f.interactor.particle.mass()); + BOOST_CHECK_EQUAL(f.result.particle.particleId(), + f.interactor.particle.particleId()); + BOOST_CHECK_EQUAL(f.result.particle.process(), + f.interactor.particle.process()); + BOOST_CHECK_EQUAL(f.result.particle.pdg(), f.interactor.particle.pdg()); + BOOST_CHECK_EQUAL(f.result.particle.charge(), f.interactor.particle.charge()); + BOOST_CHECK_EQUAL(f.result.particle.mass(), f.interactor.particle.mass()); // particle energy has not changed since there were no interactions CHECK_CLOSE_REL(f.result.particle.energy(), f.interactor.particle.energy(), eps); @@ -211,21 +214,22 @@ BOOST_AUTO_TEST_CASE(NoHitsMaterialSurface) { // call interactor: no surface sel. -> no hit, material -> one secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 1u); - BOOST_TEST(f.result.hits.size() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 1u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 0u); // call interactor again: still no hit, one more secondary f.interactor(f.state, f.stepper, f.result); - BOOST_TEST(f.result.generatedParticles.size() == 2u); - BOOST_TEST(f.result.hits.size() == 0u); + BOOST_CHECK_EQUAL(f.result.generatedParticles.size(), 2u); + BOOST_CHECK_EQUAL(f.result.hits.size(), 0u); // particle identity should be the same as the initial input - BOOST_TEST(f.result.particle.particleId() == - f.interactor.particle.particleId()); - BOOST_TEST(f.result.particle.process() == f.interactor.particle.process()); - BOOST_TEST(f.result.particle.pdg() == f.interactor.particle.pdg()); - BOOST_TEST(f.result.particle.charge() == f.interactor.particle.charge()); - BOOST_TEST(f.result.particle.mass() == f.interactor.particle.mass()); + BOOST_CHECK_EQUAL(f.result.particle.particleId(), + f.interactor.particle.particleId()); + BOOST_CHECK_EQUAL(f.result.particle.process(), + f.interactor.particle.process()); + BOOST_CHECK_EQUAL(f.result.particle.pdg(), f.interactor.particle.pdg()); + BOOST_CHECK_EQUAL(f.result.particle.charge(), f.interactor.particle.charge()); + BOOST_CHECK_EQUAL(f.result.particle.mass(), f.interactor.particle.mass()); // particle energy has changed due to interactions CHECK_CLOSE_REL((f.result.particle.energy() + 1), f.interactor.particle.energy(), eps); diff --git a/Tests/UnitTests/Fatras/Kernel/PhysicsListTests.cpp b/Tests/UnitTests/Fatras/Kernel/PhysicsListTests.cpp index 5a192ca4f1b..68af8b3610e 100644 --- a/Tests/UnitTests/Fatras/Kernel/PhysicsListTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/PhysicsListTests.cpp @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(Empty) { std::vector outgoing; // w/o processes the list should never abort - BOOST_TEST( + BOOST_CHECK( not emptyList(fix.generator, fix.slab, fix.inputParticle, outgoing)); } @@ -68,10 +68,10 @@ BOOST_AUTO_TEST_CASE(SingleSterile) { // set some process parameters sterileList.get().some_parameter = 2; - BOOST_TEST(sterileList.get().some_parameter == 2); + BOOST_CHECK_EQUAL(sterileList.get().some_parameter, 2); // sterile process should never abort - BOOST_TEST( + BOOST_CHECK( not sterileList(fix.generator, fix.slab, fix.inputParticle, outgoing)); } @@ -81,10 +81,10 @@ BOOST_AUTO_TEST_CASE(SingleFatal) { std::vector outgoing; // fatal process must always abort - BOOST_TEST(fatalList(fix.generator, fix.slab, fix.inputParticle, outgoing)); + BOOST_CHECK(fatalList(fix.generator, fix.slab, fix.inputParticle, outgoing)); // unless we disable it fatalList.disable(); - BOOST_TEST( + BOOST_CHECK( not fatalList(fix.generator, fix.slab, fix.inputParticle, outgoing)); } @@ -94,10 +94,11 @@ BOOST_AUTO_TEST_CASE(SterileFatal) { std::vector outgoing; // the contained fatal process must always abort - BOOST_TEST(physicsList(fix.generator, fix.slab, fix.inputParticle, outgoing)); + BOOST_CHECK( + physicsList(fix.generator, fix.slab, fix.inputParticle, outgoing)); // with the fatal process disabled, it should go through again physicsList.disable(); - BOOST_TEST( + BOOST_CHECK( not physicsList(fix.generator, fix.slab, fix.inputParticle, outgoing)); } diff --git a/Tests/UnitTests/Fatras/Kernel/ProcessTests.cpp b/Tests/UnitTests/Fatras/Kernel/ProcessTests.cpp index 6231f89eca7..e850acd1d12 100644 --- a/Tests/UnitTests/Fatras/Kernel/ProcessTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/ProcessTests.cpp @@ -62,8 +62,8 @@ BOOST_AUTO_TEST_CASE(NoSelectors) { Process process; // process should not abort - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 4u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 4u); } BOOST_AUTO_TEST_CASE(WithInputSelector) { @@ -73,17 +73,17 @@ BOOST_AUTO_TEST_CASE(WithInputSelector) { // above threshold should not abort f.parent.setAbsMomentum(20_GeV); - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 4u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 4u); // on threshold should still not abort f.parent.setAbsMomentum(10_GeV); - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 8u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 8u); // below threshold should abort and not run the process at all f.parent.setAbsMomentum(2_GeV); - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); // process did not run -> no new children - BOOST_TEST(f.children.size() == 8u); + BOOST_CHECK_EQUAL(f.children.size(), 8u); } BOOST_AUTO_TEST_CASE(WithOutputSelector) { @@ -93,17 +93,17 @@ BOOST_AUTO_TEST_CASE(WithOutputSelector) { // above threshold should not abort f.parent.setAbsMomentum(20_GeV); - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 4u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 4u); // on threshold should still not abort f.parent.setAbsMomentum(10_GeV); - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 8u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 8u); // below threshold should abort but only after running the process f.parent.setAbsMomentum(2_GeV); - BOOST_TEST(process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK(process(f.generator, f.slab, f.parent, f.children)); // process did still run -> new children - BOOST_TEST(f.children.size() == 12u); + BOOST_CHECK_EQUAL(f.children.size(), 12u); } BOOST_AUTO_TEST_CASE(WithChildSelector) { @@ -114,20 +114,20 @@ BOOST_AUTO_TEST_CASE(WithChildSelector) { // all process should not abort regardless of child selection // select no daughters process.selectChildParticle.minP = 5_GeV; - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 0u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 0u); // select highest daughter process.selectChildParticle.minP = 3.5_GeV; - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 1u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 1u); // select all but the lowest daughter process.selectChildParticle.minP = 1.5_GeV; - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 4u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 4u); // select all daughters process.selectChildParticle.minP = 0.5_GeV; - BOOST_TEST(not process(f.generator, f.slab, f.parent, f.children)); - BOOST_TEST(f.children.size() == 8u); + BOOST_CHECK(not process(f.generator, f.slab, f.parent, f.children)); + BOOST_CHECK_EQUAL(f.children.size(), 8u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Physics/EnergyLossTests.cpp b/Tests/UnitTests/Fatras/Physics/EnergyLossTests.cpp index 0ce8ccb1eb7..890cd117df2 100644 --- a/Tests/UnitTests/Fatras/Physics/EnergyLossTests.cpp +++ b/Tests/UnitTests/Fatras/Physics/EnergyLossTests.cpp @@ -32,10 +32,10 @@ BOOST_DATA_TEST_CASE(BetheBloch, Dataset::parameters, pdg, phi, lambda, p, ActsFatras::BetheBloch process; const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after); // energy loss changes momentum and energy - BOOST_TEST(after.absMomentum() < before.absMomentum()); - BOOST_TEST(after.energy() < before.energy()); + BOOST_CHECK_LT(after.absMomentum(), before.absMomentum()); + BOOST_CHECK_LT(after.energy(), before.energy()); // energy loss creates no new particles - BOOST_TEST(outgoing.empty()); + BOOST_CHECK(outgoing.empty()); } BOOST_DATA_TEST_CASE(BetheHeitler, Dataset::parameters, pdg, phi, lambda, p, @@ -47,10 +47,10 @@ BOOST_DATA_TEST_CASE(BetheHeitler, Dataset::parameters, pdg, phi, lambda, p, ActsFatras::BetheHeitler process; const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after); // energy loss changes momentum and energy - BOOST_TEST(after.absMomentum() < before.absMomentum()); - BOOST_TEST(after.energy() < before.energy()); + BOOST_CHECK_LT(after.absMomentum(), before.absMomentum()); + BOOST_CHECK_LT(after.energy(), before.energy()); // energy loss creates no new particles - BOOST_TEST(outgoing.empty()); + BOOST_CHECK(outgoing.empty()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Physics/ScatteringTests.cpp b/Tests/UnitTests/Fatras/Physics/ScatteringTests.cpp index 4ed7bd1932c..8624dab722b 100644 --- a/Tests/UnitTests/Fatras/Physics/ScatteringTests.cpp +++ b/Tests/UnitTests/Fatras/Physics/ScatteringTests.cpp @@ -37,9 +37,9 @@ void test(const Scattering& scattering, uint32_t seed, CHECK_CLOSE_REL(after.absMomentum(), before.absMomentum(), eps); CHECK_CLOSE_REL(after.energy(), before.energy(), eps); // scattering has changed the direction - BOOST_TEST(before.unitDirection().dot(after.unitDirection()) < 1); + BOOST_CHECK_LT(before.unitDirection().dot(after.unitDirection()), 1); // scattering creates no new particles - BOOST_TEST(outgoing.empty()); + BOOST_CHECK(outgoing.empty()); } } // namespace diff --git a/Tests/UnitTests/Fatras/Selectors/ChargeSelectorsTests.cpp b/Tests/UnitTests/Fatras/Selectors/ChargeSelectorsTests.cpp index 5acae417eec..86ca4f175fd 100644 --- a/Tests/UnitTests/Fatras/Selectors/ChargeSelectorsTests.cpp +++ b/Tests/UnitTests/Fatras/Selectors/ChargeSelectorsTests.cpp @@ -18,26 +18,26 @@ BOOST_AUTO_TEST_SUITE(FatrasChargeSelectors) BOOST_AUTO_TEST_CASE(NegativeParticle) { const auto& particle = Dataset::centralElectron; - BOOST_TEST(not NeutralSelector()(particle)); - BOOST_TEST(ChargedSelector()(particle)); - BOOST_TEST(not PositiveSelector()(particle)); - BOOST_TEST(NegativeSelector()(particle)); + BOOST_CHECK(not NeutralSelector()(particle)); + BOOST_CHECK(ChargedSelector()(particle)); + BOOST_CHECK(not PositiveSelector()(particle)); + BOOST_CHECK(NegativeSelector()(particle)); } BOOST_AUTO_TEST_CASE(NeutralParticle) { const auto& particle = Dataset::centralNeutron; - BOOST_TEST(NeutralSelector()(particle)); - BOOST_TEST(not ChargedSelector()(particle)); - BOOST_TEST(not PositiveSelector()(particle)); - BOOST_TEST(not NegativeSelector()(particle)); + BOOST_CHECK(NeutralSelector()(particle)); + BOOST_CHECK(not ChargedSelector()(particle)); + BOOST_CHECK(not PositiveSelector()(particle)); + BOOST_CHECK(not NegativeSelector()(particle)); } BOOST_AUTO_TEST_CASE(PositiveParticle) { const auto& particle = Dataset::centralPositron; - BOOST_TEST(not NeutralSelector()(particle)); - BOOST_TEST(ChargedSelector()(particle)); - BOOST_TEST(PositiveSelector()(particle)); - BOOST_TEST(not NegativeSelector()(particle)); + BOOST_CHECK(not NeutralSelector()(particle)); + BOOST_CHECK(ChargedSelector()(particle)); + BOOST_CHECK(PositiveSelector()(particle)); + BOOST_CHECK(not NegativeSelector()(particle)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Selectors/LimitSelectorsTests.cpp b/Tests/UnitTests/Fatras/Selectors/LimitSelectorsTests.cpp index 5110581d787..c76929cc4f8 100644 --- a/Tests/UnitTests/Fatras/Selectors/LimitSelectorsTests.cpp +++ b/Tests/UnitTests/Fatras/Selectors/LimitSelectorsTests.cpp @@ -34,18 +34,18 @@ BOOST_AUTO_TEST_CASE(PathLimitX0) { ActsFatras::PathLimitX0 select; auto particle = makeParticleCloseToLimit(); // particle is still within limits for thin block - BOOST_TEST(not select(particle, Acts::Test::makePercentSlab())); + BOOST_CHECK(not select(particle, Acts::Test::makePercentSlab())); // particle would pass limits for thick block - BOOST_TEST(select(particle, Acts::Test::makeUnitSlab())); + BOOST_CHECK(select(particle, Acts::Test::makeUnitSlab())); } BOOST_AUTO_TEST_CASE(PathLimitL0) { ActsFatras::PathLimitL0 select; auto particle = makeParticleCloseToLimit(); // particle is still within limits for thin block - BOOST_TEST(not select(particle, Acts::Test::makePercentSlab())); + BOOST_CHECK(not select(particle, Acts::Test::makePercentSlab())); // particle would pass limits for thick block - BOOST_TEST(select(particle, Acts::Test::makeUnitSlab())); + BOOST_CHECK(select(particle, Acts::Test::makeUnitSlab())); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Selectors/PdgSelectorsTests.cpp b/Tests/UnitTests/Fatras/Selectors/PdgSelectorsTests.cpp index c05702a3229..17db3bd586e 100644 --- a/Tests/UnitTests/Fatras/Selectors/PdgSelectorsTests.cpp +++ b/Tests/UnitTests/Fatras/Selectors/PdgSelectorsTests.cpp @@ -25,38 +25,38 @@ BOOST_AUTO_TEST_SUITE(FatrasKinematicCasts) BOOST_AUTO_TEST_CASE(PdgSelector) { ActsFatras::PdgSelector selectElectron; - BOOST_TEST(selectElectron(electron)); - BOOST_TEST(not selectElectron(positron)); - BOOST_TEST(not selectElectron(muon)); - BOOST_TEST(not selectElectron(antimuon)); - BOOST_TEST(not selectElectron(pion)); + BOOST_CHECK(selectElectron(electron)); + BOOST_CHECK(not selectElectron(positron)); + BOOST_CHECK(not selectElectron(muon)); + BOOST_CHECK(not selectElectron(antimuon)); + BOOST_CHECK(not selectElectron(pion)); } BOOST_AUTO_TEST_CASE(AbsPdgSelector) { ActsFatras::AbsPdgSelector selectElectronLike; - BOOST_TEST(selectElectronLike(electron)); - BOOST_TEST(selectElectronLike(positron)); - BOOST_TEST(not selectElectronLike(muon)); - BOOST_TEST(not selectElectronLike(antimuon)); - BOOST_TEST(not selectElectronLike(pion)); + BOOST_CHECK(selectElectronLike(electron)); + BOOST_CHECK(selectElectronLike(positron)); + BOOST_CHECK(not selectElectronLike(muon)); + BOOST_CHECK(not selectElectronLike(antimuon)); + BOOST_CHECK(not selectElectronLike(pion)); } BOOST_AUTO_TEST_CASE(PdgExcluder) { ActsFatras::PdgExcluder excludeMuon; - BOOST_TEST(excludeMuon(electron)); - BOOST_TEST(excludeMuon(positron)); - BOOST_TEST(not excludeMuon(muon)); - BOOST_TEST(excludeMuon(antimuon)); - BOOST_TEST(excludeMuon(pion)); + BOOST_CHECK(excludeMuon(electron)); + BOOST_CHECK(excludeMuon(positron)); + BOOST_CHECK(not excludeMuon(muon)); + BOOST_CHECK(excludeMuon(antimuon)); + BOOST_CHECK(excludeMuon(pion)); } BOOST_AUTO_TEST_CASE(AbsPdgExcluder) { ActsFatras::AbsPdgExcluder excludeMuonLike; - BOOST_TEST(excludeMuonLike(electron)); - BOOST_TEST(excludeMuonLike(positron)); - BOOST_TEST(not excludeMuonLike(muon)); - BOOST_TEST(not excludeMuonLike(antimuon)); - BOOST_TEST(excludeMuonLike(pion)); + BOOST_CHECK(excludeMuonLike(electron)); + BOOST_CHECK(excludeMuonLike(positron)); + BOOST_CHECK(not excludeMuonLike(muon)); + BOOST_CHECK(not excludeMuonLike(antimuon)); + BOOST_CHECK(excludeMuonLike(pion)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Selectors/SelectorHelpersTests.cpp b/Tests/UnitTests/Fatras/Selectors/SelectorHelpersTests.cpp index fc287d716b4..93955b9da39 100644 --- a/Tests/UnitTests/Fatras/Selectors/SelectorHelpersTests.cpp +++ b/Tests/UnitTests/Fatras/Selectors/SelectorHelpersTests.cpp @@ -58,50 +58,50 @@ BOOST_AUTO_TEST_SUITE(FatrasSelectorHelpers) BOOST_AUTO_TEST_CASE(Min) { // require a minimum eta value of 0.5 ActsFatras::Min minEta{0.5}; - BOOST_TEST(not minEta(backward)); - BOOST_TEST(not minEta(central)); - BOOST_TEST(minEta(forward)); + BOOST_CHECK(not minEta(backward)); + BOOST_CHECK(not minEta(central)); + BOOST_CHECK(minEta(forward)); // require a mininum absolute eta value of 0.5 ActsFatras::Min minAbsEta{0.5}; - BOOST_TEST(minAbsEta(backward)); - BOOST_TEST(not minAbsEta(central)); - BOOST_TEST(minAbsEta(forward)); + BOOST_CHECK(minAbsEta(backward)); + BOOST_CHECK(not minAbsEta(central)); + BOOST_CHECK(minAbsEta(forward)); } BOOST_AUTO_TEST_CASE(Max) { // require a maximum eta value of 0.5 ActsFatras::Max maxEta{0.5}; - BOOST_TEST(maxEta(backward)); - BOOST_TEST(maxEta(central)); - BOOST_TEST(not maxEta(forward)); + BOOST_CHECK(maxEta(backward)); + BOOST_CHECK(maxEta(central)); + BOOST_CHECK(not maxEta(forward)); // require a maximum absolute eta value of 0.5 ActsFatras::Max maxAbsEta{0.5}; - BOOST_TEST(not maxAbsEta(backward)); - BOOST_TEST(maxAbsEta(central)); - BOOST_TEST(not maxAbsEta(forward)); + BOOST_CHECK(not maxAbsEta(backward)); + BOOST_CHECK(maxAbsEta(central)); + BOOST_CHECK(not maxAbsEta(forward)); } BOOST_AUTO_TEST_CASE(Range) { ActsFatras::Range rangeEta{-6.0, -0.5}; - BOOST_TEST(rangeEta(backward)); - BOOST_TEST(not rangeEta(central)); - BOOST_TEST(not rangeEta(forward)); + BOOST_CHECK(rangeEta(backward)); + BOOST_CHECK(not rangeEta(central)); + BOOST_CHECK(not rangeEta(forward)); ActsFatras::Range rangeAbsEta{0.5, 6.0}; - BOOST_TEST(rangeAbsEta(backward)); - BOOST_TEST(not rangeAbsEta(central)); - BOOST_TEST(rangeAbsEta(forward)); + BOOST_CHECK(rangeAbsEta(backward)); + BOOST_CHECK(not rangeAbsEta(central)); + BOOST_CHECK(rangeAbsEta(forward)); } BOOST_AUTO_TEST_CASE(And1) { CombineFixture f; ActsFatras::CombineAnd select; select.get() = f.selectObjectFeature; - BOOST_TEST(select(f.obj)); - BOOST_TEST(not select(f.objWrongFeature)); - BOOST_TEST(select(f.objWrongName)); + BOOST_CHECK(select(f.obj)); + BOOST_CHECK(not select(f.objWrongFeature)); + BOOST_CHECK(select(f.objWrongName)); } BOOST_AUTO_TEST_CASE(And2) { @@ -109,18 +109,18 @@ BOOST_AUTO_TEST_CASE(And2) { ActsFatras::CombineAnd select; select.get() = f.selectObjectFeature; select.get() = f.selectObjectName; - BOOST_TEST(select(f.obj)); - BOOST_TEST(not select(f.objWrongFeature)); - BOOST_TEST(not select(f.objWrongName)); + BOOST_CHECK(select(f.obj)); + BOOST_CHECK(not select(f.objWrongFeature)); + BOOST_CHECK(not select(f.objWrongName)); } BOOST_AUTO_TEST_CASE(Or1) { CombineFixture f; ActsFatras::CombineOr select; select.get() = f.selectObjectFeature; - BOOST_TEST(select(f.obj)); - BOOST_TEST(not select(f.objWrongFeature)); - BOOST_TEST(select(f.objWrongName)); + BOOST_CHECK(select(f.obj)); + BOOST_CHECK(not select(f.objWrongFeature)); + BOOST_CHECK(select(f.objWrongName)); } BOOST_AUTO_TEST_CASE(Or2) { @@ -128,9 +128,9 @@ BOOST_AUTO_TEST_CASE(Or2) { ActsFatras::CombineOr select; select.get() = f.selectObjectFeature; select.get() = f.selectObjectName; - BOOST_TEST(select(f.obj)); - BOOST_TEST(select(f.objWrongFeature)); - BOOST_TEST(select(f.objWrongName)); + BOOST_CHECK(select(f.obj)); + BOOST_CHECK(select(f.objWrongFeature)); + BOOST_CHECK(select(f.objWrongName)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Fatras/Utilities/ParticleDataTests.cpp b/Tests/UnitTests/Fatras/Utilities/ParticleDataTests.cpp index 59811ea947f..5baaed55c6d 100644 --- a/Tests/UnitTests/Fatras/Utilities/ParticleDataTests.cpp +++ b/Tests/UnitTests/Fatras/Utilities/ParticleDataTests.cpp @@ -24,39 +24,39 @@ static constexpr float eps = 0.001f; BOOST_AUTO_TEST_SUITE(FatrasParticleData) BOOST_AUTO_TEST_CASE(InvalidInput) { - BOOST_TEST(std::isnan(findCharge(PdgParticle::eInvalid))); - BOOST_TEST(findMass(PdgParticle::eInvalid) == 0.0f); - BOOST_TEST(findName(PdgParticle::eInvalid).empty()); + BOOST_CHECK(std::isnan(findCharge(PdgParticle::eInvalid))); + BOOST_CHECK_EQUAL(findMass(PdgParticle::eInvalid), 0.0f); + BOOST_CHECK(findName(PdgParticle::eInvalid).empty()); } BOOST_AUTO_TEST_CASE(Electron) { - BOOST_TEST(findCharge(PdgParticle::eAntiElectron) == 1_e); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::eAntiElectron), 1_e); CHECK_CLOSE_REL(findMass(PdgParticle::eAntiElectron), 511_keV, eps); - BOOST_TEST(findName(PdgParticle::eAntiElectron) == "e+"); - BOOST_TEST(findCharge(PdgParticle::eElectron) == -1_e); + BOOST_CHECK_EQUAL(findName(PdgParticle::eAntiElectron), "e+"); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::eElectron), -1_e); CHECK_CLOSE_REL(findMass(PdgParticle::eElectron), 511_keV, eps); - BOOST_TEST(findName(PdgParticle::eElectron) == "e-"); - BOOST_TEST(findCharge(PdgParticle::ePositron) == 1_e); + BOOST_CHECK_EQUAL(findName(PdgParticle::eElectron), "e-"); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePositron), 1_e); CHECK_CLOSE_REL(findMass(PdgParticle::ePositron), 511_keV, eps); - BOOST_TEST(findName(PdgParticle::ePositron) == "e+"); + BOOST_CHECK_EQUAL(findName(PdgParticle::ePositron), "e+"); } BOOST_AUTO_TEST_CASE(Gamma) { - BOOST_TEST(findCharge(PdgParticle::eGamma) == 0); - BOOST_TEST(findMass(PdgParticle::eGamma) == 0); - BOOST_TEST(findName(PdgParticle::eGamma) == "gamma"); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::eGamma), 0); + BOOST_CHECK_EQUAL(findMass(PdgParticle::eGamma), 0); + BOOST_CHECK_EQUAL(findName(PdgParticle::eGamma), "gamma"); } BOOST_AUTO_TEST_CASE(Pion) { - BOOST_TEST(findCharge(PdgParticle::ePionMinus) == -1_e); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionMinus), -1_e); CHECK_CLOSE_REL(findMass(PdgParticle::ePionMinus), 139.57_MeV, eps); - BOOST_TEST(findName(PdgParticle::ePionMinus) == "pi-"); - BOOST_TEST(findCharge(PdgParticle::ePionPlus) == 1_e); + BOOST_CHECK_EQUAL(findName(PdgParticle::ePionMinus), "pi-"); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionPlus), 1_e); CHECK_CLOSE_REL(findMass(PdgParticle::ePionPlus), 139.57_MeV, eps); - BOOST_TEST(findName(PdgParticle::ePionPlus) == "pi+"); - BOOST_TEST(findCharge(PdgParticle::ePionZero) == 0); + BOOST_CHECK_EQUAL(findName(PdgParticle::ePionPlus), "pi+"); + BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionZero), 0); CHECK_CLOSE_REL(findMass(PdgParticle::ePionZero), 134.98_MeV, eps); - BOOST_TEST(findName(PdgParticle::ePionZero) == "pi0"); + BOOST_CHECK_EQUAL(findName(PdgParticle::ePionZero), "pi0"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Plugins/Digitization/PlanarModuleStepperTests.cpp b/Tests/UnitTests/Plugins/Digitization/PlanarModuleStepperTests.cpp index 2593b6602ed..c88037cf402 100644 --- a/Tests/UnitTests/Plugins/Digitization/PlanarModuleStepperTests.cpp +++ b/Tests/UnitTests/Plugins/Digitization/PlanarModuleStepperTests.cpp @@ -84,7 +84,7 @@ BOOST_DATA_TEST_CASE( for (auto& dm : testModules) { // retrieve the digitiztion steps auto cSteps = pmStepper.cellSteps(tgContext, dm, entry, exit); - BOOST_TEST(cSteps.size() != 0); + BOOST_CHECK_NE(cSteps.size(), 0); // Test if the longitudinal distance between first and last step // is equal/close to the thickness of the module diff --git a/Tests/UnitTests/Plugins/Json/GeometryHierarchyMapJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/GeometryHierarchyMapJsonConverterTests.cpp index 90c88f89368..3c50b0ba194 100644 --- a/Tests/UnitTests/Plugins/Json/GeometryHierarchyMapJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/GeometryHierarchyMapJsonConverterTests.cpp @@ -72,20 +72,20 @@ BOOST_AUTO_TEST_CASE(ToJson) { }; json j = Converter("thing").toJson(c); - BOOST_TEST(j.is_object()); + BOOST_CHECK(j.is_object()); // check header auto header = j.find("acts-geometry-hierarchy-map"); - BOOST_TEST(header != j.end()); - BOOST_TEST(header->is_object()); - BOOST_TEST(header->at("format-version").is_number_integer()); - BOOST_TEST(header->at("format-version").get() == 0); - BOOST_TEST(header->at("value-identifier").is_string()); - BOOST_TEST(header->at("value-identifier").get() == "thing"); + BOOST_CHECK_NE(header, j.end()); + BOOST_CHECK(header->is_object()); + BOOST_CHECK(header->at("format-version").is_number_integer()); + BOOST_CHECK_EQUAL(header->at("format-version").get(), 0); + BOOST_CHECK(header->at("value-identifier").is_string()); + BOOST_CHECK_EQUAL(header->at("value-identifier").get(), "thing"); // check entries auto entries = j.find("entries"); - BOOST_TEST(entries != j.end()); - BOOST_TEST(entries->is_array()); - BOOST_TEST(entries->size() == 3u); + BOOST_CHECK_NE(entries, j.end()); + BOOST_CHECK(entries->is_array()); + BOOST_CHECK_EQUAL(entries->size(), 3u); } BOOST_AUTO_TEST_CASE(FromJson) { @@ -116,19 +116,19 @@ BOOST_AUTO_TEST_CASE(FromJson) { }; Container c = Converter("thing").fromJson(j); - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 2); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 2); { auto it = c.find(makeId(2, 3)); - BOOST_TEST(it != c.end()); - BOOST_TEST(it->x == 4.0); - BOOST_TEST(it->y == 4); + BOOST_CHECK_NE(it, c.end()); + BOOST_CHECK_EQUAL(it->x, 4.0); + BOOST_CHECK_EQUAL(it->y, 4); } { auto it = c.find(makeId(5, 6, 7)); - BOOST_TEST(it != c.end()); - BOOST_TEST(it->x == 3.0); - BOOST_TEST(it->y == 3); + BOOST_CHECK_NE(it, c.end()); + BOOST_CHECK_EQUAL(it->x, 3.0); + BOOST_CHECK_EQUAL(it->y, 3); } } @@ -193,10 +193,10 @@ BOOST_AUTO_TEST_CASE(Roundtrip) { auto j = Converter("the-identifier").toJson(c0); auto c1 = Converter("the-identifier").fromJson(j); - BOOST_TEST(c0.size() == c1.size()); + BOOST_CHECK_EQUAL(c0.size(), c1.size()); for (auto i = std::min(c0.size(), c1.size()); 0 < i--;) { - BOOST_TEST(c0.idAt(i) == c1.idAt(i)); - BOOST_TEST(c0.valueAt(i) == c1.valueAt(i)); + BOOST_CHECK_EQUAL(c0.idAt(i), c1.idAt(i)); + BOOST_CHECK_EQUAL(c0.valueAt(i), c1.valueAt(i)); } } @@ -204,19 +204,19 @@ BOOST_AUTO_TEST_CASE(FromFile) { // read json data from file auto path = Acts::Test::getDataPath("geometry-hierarchy-map.json"); auto file = std::ifstream(path, std::ifstream::in | std::ifstream::binary); - BOOST_TEST(file.good()); + BOOST_CHECK(file.good()); json j; file >> j; - BOOST_TEST(file.good()); + BOOST_CHECK(file.good()); // convert json to container Container c = Converter("thing").fromJson(j); // check container content - BOOST_TEST(not c.empty()); - BOOST_TEST(c.size() == 4); - BOOST_TEST(c.find(makeId()) != c.end()); - BOOST_TEST(c.find(makeId(1, 2)) != c.end()); - BOOST_TEST(c.find(makeId(3)) != c.end()); - BOOST_TEST(c.find(makeId(3, 4)) != c.end()); + BOOST_CHECK(not c.empty()); + BOOST_CHECK_EQUAL(c.size(), 4); + BOOST_CHECK_NE(c.find(makeId()), c.end()); + BOOST_CHECK_NE(c.find(makeId(1, 2)), c.end()); + BOOST_CHECK_NE(c.find(makeId(3)), c.end()); + BOOST_CHECK_NE(c.find(makeId(3, 4)), c.end()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoArb8ConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoArb8ConversionTests.cpp index dad21a6e37c..4f1b3be8e2d 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoArb8ConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoArb8ConversionTests.cpp @@ -71,12 +71,12 @@ BOOST_AUTO_TEST_CASE(TGeoArb8_to_PlaneSurface) { for (const auto &axes : allowedAxes) { auto plane = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(plane != nullptr); - BOOST_TEST(plane->type() == Surface::Plane); + BOOST_CHECK_NE(plane, nullptr); + BOOST_CHECK_EQUAL(plane->type(), Surface::Plane); auto bounds = dynamic_cast *>(&(plane->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); // Check if the surface is the (negative) identity auto transform = plane->transform(tgContext); diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoBBoxConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoBBoxConversionTests.cpp index 64522b2077b..a8366c0d4bf 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoBBoxConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoBBoxConversionTests.cpp @@ -64,12 +64,12 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Upper case --------------------------------- auto plane_XYZ = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, "XY*", 1); - BOOST_TEST(plane_XYZ != nullptr); - BOOST_TEST(plane_XYZ->type() == Surface::Plane); + BOOST_CHECK_NE(plane_XYZ, nullptr); + BOOST_CHECK_EQUAL(plane_XYZ->type(), Surface::Plane); auto bounds_XYZ = dynamic_cast(&(plane_XYZ->bounds())); - BOOST_TEST(bounds_XYZ != nullptr); + BOOST_CHECK_NE(bounds_XYZ, nullptr); double maxX = bounds_XYZ->get(RectangleBounds::eMaxX); double minX = bounds_XYZ->get(RectangleBounds::eMinX); double maxY = bounds_XYZ->get(RectangleBounds::eMaxY); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Check if the surface is the (negative) identity auto transform_XYZ = plane_XYZ->transform(tgContext); auto rotation_XYZ = transform_XYZ.rotation(); - BOOST_TEST(transform_XYZ.isApprox(Transform3D::Identity())); + BOOST_CHECK(transform_XYZ.isApprox(Transform3D::Identity())); const Vector3D offset_XYZ{-5.5 * x, 0., 0.}; GeometryView::drawSurface(objVis, *plane_XYZ, tgContext, @@ -98,18 +98,18 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Lower case --------------------------------- auto plane_xyz = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, "xy*", 1); - BOOST_TEST(plane_xyz != nullptr); - BOOST_TEST(plane_xyz->type() == Surface::Plane); + BOOST_CHECK_NE(plane_xyz, nullptr); + BOOST_CHECK_EQUAL(plane_xyz->type(), Surface::Plane); auto bounds_xyz = dynamic_cast(&(plane_XYZ->bounds())); - BOOST_TEST(bounds_xyz != nullptr); - BOOST_TEST(bounds_xyz == bounds_XYZ); + BOOST_CHECK_NE(bounds_xyz, nullptr); + BOOST_CHECK_EQUAL(bounds_xyz, bounds_XYZ); auto transform_xyz = plane_xyz->transform(tgContext); auto rotation_xyz = transform_xyz.rotation(); - BOOST_TEST(rotation_xyz.col(0).isApprox(-1 * rotation_XYZ.col(0))); - BOOST_TEST(rotation_xyz.col(1).isApprox(-1 * rotation_XYZ.col(1))); - BOOST_TEST(rotation_xyz.col(2).isApprox(rotation_XYZ.col(2))); + BOOST_CHECK(rotation_xyz.col(0).isApprox(-1 * rotation_XYZ.col(0))); + BOOST_CHECK(rotation_xyz.col(1).isApprox(-1 * rotation_XYZ.col(1))); + BOOST_CHECK(rotation_xyz.col(2).isApprox(rotation_XYZ.col(2))); const Vector3D offset_xyz{-2 * x, 0., 0.}; GeometryView::drawSurface(objVis, *plane_xyz, tgContext, @@ -127,18 +127,18 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Mixed case --------------------------------- auto plane_xYz = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, "xY*", 1); - BOOST_TEST(plane_xYz != nullptr); - BOOST_TEST(plane_xYz->type() == Surface::Plane); + BOOST_CHECK_NE(plane_xYz, nullptr); + BOOST_CHECK_EQUAL(plane_xYz->type(), Surface::Plane); auto bounds_xYz = dynamic_cast(&(plane_xYz->bounds())); - BOOST_TEST(bounds_xYz != nullptr); - BOOST_TEST(bounds_xYz == bounds_xYz); + BOOST_CHECK_NE(bounds_xYz, nullptr); + BOOST_CHECK_EQUAL(bounds_xYz, bounds_xYz); auto transform_xYz = plane_xYz->transform(tgContext); auto rotation_xYz = transform_xYz.rotation(); - BOOST_TEST(rotation_xYz.col(0).isApprox(-1 * rotation_XYZ.col(0))); - BOOST_TEST(rotation_xYz.col(1).isApprox(rotation_XYZ.col(1))); - BOOST_TEST(rotation_xYz.col(2).isApprox(-1. * rotation_XYZ.col(2))); + BOOST_CHECK(rotation_xYz.col(0).isApprox(-1 * rotation_XYZ.col(0))); + BOOST_CHECK(rotation_xYz.col(1).isApprox(rotation_XYZ.col(1))); + BOOST_CHECK(rotation_xYz.col(2).isApprox(-1. * rotation_XYZ.col(2))); const Vector3D offset_xYz{2 * x, 0., 0.}; GeometryView::drawSurface( @@ -157,8 +157,8 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Swap case --------------------------------- (x/y) here auto plane_YXz = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, "YX*", 1); - BOOST_TEST(plane_YXz != nullptr); - BOOST_TEST(plane_YXz->type() == Surface::Plane); + BOOST_CHECK_NE(plane_YXz, nullptr); + BOOST_CHECK_EQUAL(plane_YXz->type(), Surface::Plane); auto bounds_YXz = dynamic_cast(&(plane_YXz->bounds())); maxX = bounds_YXz->get(RectangleBounds::eMaxX); @@ -170,9 +170,9 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { auto transform_YXz = plane_YXz->transform(tgContext); auto rotation_YXz = transform_YXz.rotation(); - BOOST_TEST(rotation_YXz.col(0).isApprox(rotation_XYZ.col(1))); - BOOST_TEST(rotation_YXz.col(1).isApprox(rotation_XYZ.col(0))); - BOOST_TEST(rotation_YXz.col(2).isApprox(-1. * rotation_XYZ.col(2))); + BOOST_CHECK(rotation_YXz.col(0).isApprox(rotation_XYZ.col(1))); + BOOST_CHECK(rotation_YXz.col(1).isApprox(rotation_XYZ.col(0))); + BOOST_CHECK(rotation_YXz.col(2).isApprox(-1. * rotation_XYZ.col(2))); const Vector3D offset_YXz{5.5 * x, 0., 0.}; GeometryView::drawSurface(objVis, *plane_YXz, tgContext, @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(TGeoBBox_to_PlaneSurface) { // Scaling test --------------------------------- auto plane_XYZ10 = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, "xY*", 10); - BOOST_TEST(plane_XYZ10 != nullptr); + BOOST_CHECK_NE(plane_XYZ10, nullptr); auto bounds_XYZ10 = dynamic_cast(&(plane_XYZ10->bounds())); diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp index 54ec22d2c9c..837e9e2a64c 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoLayerBuilderTests.cpp @@ -85,14 +85,14 @@ BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) { ObjVisualization objVis; auto centralLayers = tglb.centralLayers(tgContext); - BOOST_TEST(centralLayers.size() = 1u); - BOOST_TEST(tglb.detectorElements().size() == 14u); + BOOST_CHECK_EQUAL(centralLayers.size(), 1u); + BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u); auto positiveLayers = tglb.positiveLayers(tgContext); // Check that it's split into two layers size_t ipl = 0; - BOOST_TEST(positiveLayers.size() = 2u); - BOOST_TEST(tglb.detectorElements().size() == 14u + 16u); + BOOST_CHECK_EQUAL(positiveLayers.size(), 2u); + BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u + 16u); for (const auto& pLayer : positiveLayers) { auto sArray = pLayer->surfaceArray(); if (sArray) { diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp index b30dbfa1b7c..5ed8d1d1265 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoParserTests.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(TGeoParser_Pixel) { TGeoParser::select(tgpState, tgpOptions); // This should select 176 PixelActive modules - BOOST_TEST(tgpState.selectedNodes.size() == 176u); + BOOST_CHECK_EQUAL(tgpState.selectedNodes.size(), 176u); /// Convert into surfaces using the TGeoSurfaceConverter & Draw them ObjVisualization objVis; @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(TGeoParser_Pixel_SelectInnermost) { TGeoParser::select(tgpState, tgpOptions); // This should select 14 PixelActive modules - BOOST_TEST(tgpState.selectedNodes.size() == 14u); + BOOST_CHECK_EQUAL(tgpState.selectedNodes.size(), 14u); /// Convert into surfaces using the TGeoSurfaceConverter & Draw them ObjVisualization objVis; diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoPrimitivesHelperTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoPrimitivesHelperTests.cpp index a6c7f4284b7..adf4c5128ec 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoPrimitivesHelperTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoPrimitivesHelperTests.cpp @@ -20,12 +20,12 @@ namespace Test { /// @brief Unit test checking the match probability BOOST_AUTO_TEST_CASE(TGeoPrimitivesHelper_match) { - BOOST_TEST(TGeoPrimitivesHelper::match("Pixel*Barrel", "PixelLBarrel")); - BOOST_TEST(!TGeoPrimitivesHelper::match("Pixel*Barrel", "Strips")); + BOOST_CHECK(TGeoPrimitivesHelper::match("Pixel*Barrel", "PixelLBarrel")); + BOOST_CHECK(!TGeoPrimitivesHelper::match("Pixel*Barrel", "Strips")); std::vector candidates = {"Pixel", "Barrel*", "*P*pe"}; - BOOST_TEST(TGeoPrimitivesHelper::match(candidates, "BarrelStrips")); - BOOST_TEST(TGeoPrimitivesHelper::match(candidates, "BeamPipe")); + BOOST_CHECK(TGeoPrimitivesHelper::match(candidates, "BarrelStrips")); + BOOST_CHECK(TGeoPrimitivesHelper::match(candidates, "BeamPipe")); } } // namespace Test diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoTrd1ConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoTrd1ConversionTests.cpp index d0722e7aa70..b6e4b8bc5d4 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoTrd1ConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoTrd1ConversionTests.cpp @@ -65,11 +65,11 @@ BOOST_AUTO_TEST_CASE(TGeoTrd1_to_PlaneSurface) { for (const auto &axes : allowedAxes) { auto plane = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(plane != nullptr); - BOOST_TEST(plane->type() == Surface::Plane); + BOOST_CHECK_NE(plane, nullptr); + BOOST_CHECK_EQUAL(plane->type(), Surface::Plane); auto bounds = dynamic_cast(&(plane->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); double hXminY = bounds->get(TrapezoidBounds::eHalfLengthXnegY); double hXmaxY = bounds->get(TrapezoidBounds::eHalfLengthXposY); double hY = bounds->get(TrapezoidBounds::eHalfLengthY); diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoTrd2ConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoTrd2ConversionTests.cpp index bd341b621d2..40d19fa33e0 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoTrd2ConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoTrd2ConversionTests.cpp @@ -65,11 +65,11 @@ BOOST_AUTO_TEST_CASE(TGeoTrd2_xz_to_PlaneSurface) { for (const auto &axes : axesTypes) { auto plane = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(plane != nullptr); - BOOST_TEST(plane->type() == Surface::Plane); + BOOST_CHECK_NE(plane, nullptr); + BOOST_CHECK_EQUAL(plane->type(), Surface::Plane); auto bounds = dynamic_cast(&(plane->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); double hXminY = bounds->get(TrapezoidBounds::eHalfLengthXnegY); double hXmaxY = bounds->get(TrapezoidBounds::eHalfLengthXposY); double hY = bounds->get(TrapezoidBounds::eHalfLengthY); @@ -130,11 +130,11 @@ BOOST_AUTO_TEST_CASE(TGeoTrd2_yz_to_PlaneSurface) { for (const auto &axes : axesTypes) { auto plane = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(plane != nullptr); - BOOST_TEST(plane->type() == Surface::Plane); + BOOST_CHECK_NE(plane, nullptr); + BOOST_CHECK_EQUAL(plane->type(), Surface::Plane); auto bounds = dynamic_cast(&(plane->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); double hXminY = bounds->get(TrapezoidBounds::eHalfLengthXnegY); double hXmaxY = bounds->get(TrapezoidBounds::eHalfLengthXposY); double hY = bounds->get(TrapezoidBounds::eHalfLengthY); diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp index 5795c051a49..1035d8985da 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp @@ -69,11 +69,11 @@ BOOST_AUTO_TEST_CASE(TGeoTube_to_CylinderSurface) { for (const auto &axes : allowedAxes) { auto cylinder = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(cylinder != nullptr); - BOOST_TEST(cylinder->type() == Surface::Cylinder); + BOOST_CHECK_NE(cylinder, nullptr); + BOOST_CHECK_EQUAL(cylinder->type(), Surface::Cylinder); auto bounds = dynamic_cast(&(cylinder->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); double bR = bounds->get(CylinderBounds::eR); double bhZ = bounds->get(CylinderBounds::eHalfLengthZ); @@ -100,12 +100,12 @@ BOOST_AUTO_TEST_CASE(TGeoTube_to_CylinderSurface) { if (icyl < 2) { auto cylinderSegment = TGeoSurfaceConverter::toSurface( *vols->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(cylinderSegment != nullptr); - BOOST_TEST(cylinderSegment->type() == Surface::Cylinder); + BOOST_CHECK_NE(cylinderSegment, nullptr); + BOOST_CHECK_EQUAL(cylinderSegment->type(), Surface::Cylinder); auto boundsSegment = dynamic_cast(&(cylinderSegment->bounds())); - BOOST_TEST(boundsSegment != nullptr); + BOOST_CHECK_NE(boundsSegment, nullptr); bR = boundsSegment->get(CylinderBounds::eR); bhZ = boundsSegment->get(CylinderBounds::eHalfLengthZ); double hphi = boundsSegment->get(CylinderBounds::eHalfPhiSector); @@ -167,11 +167,11 @@ BOOST_AUTO_TEST_CASE(TGeoTube_to_DiscSurface) { for (const auto &axes : allowedAxes) { auto disc = TGeoSurfaceConverter::toSurface(*vol->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(disc != nullptr); - BOOST_TEST(disc->type() == Surface::Disc); + BOOST_CHECK_NE(disc, nullptr); + BOOST_CHECK_EQUAL(disc->type(), Surface::Disc); auto bounds = dynamic_cast(&(disc->bounds())); - BOOST_TEST(bounds != nullptr); + BOOST_CHECK_NE(bounds, nullptr); double bminr = bounds->get(RadialBounds::eMinR); double bmaxr = bounds->get(RadialBounds::eMaxR); @@ -195,12 +195,12 @@ BOOST_AUTO_TEST_CASE(TGeoTube_to_DiscSurface) { if (idisc < 2) { auto discSegment = TGeoSurfaceConverter::toSurface( *vols->GetShape(), *gGeoIdentity, axes, 1); - BOOST_TEST(discSegment != nullptr); - BOOST_TEST(discSegment->type() == Surface::Disc); + BOOST_CHECK_NE(discSegment, nullptr); + BOOST_CHECK_EQUAL(discSegment->type(), Surface::Disc); auto boundsSegment = dynamic_cast(&(discSegment->bounds())); - BOOST_TEST(boundsSegment != nullptr); + BOOST_CHECK_NE(boundsSegment, nullptr); bminr = boundsSegment->get(RadialBounds::eMinR); bmaxr = boundsSegment->get(RadialBounds::eMaxR); double hphi = boundsSegment->get(RadialBounds::eHalfPhiSector);