Skip to content

Commit

Permalink
finalise
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Oct 25, 2024
1 parent 51a5ace commit cce4e4f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 21 deletions.
3 changes: 0 additions & 3 deletions Tests/UnitTests/Core/Surfaces/DiamondBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ BOOST_AUTO_TEST_CASE(DiamondBoundsProperties) {
Vector2 inRectangle(15., 0.);

/// Test dump
// Acts::DiamondBounds: (minHlengthX, medHlengthX, maxHlengthX, hlengthY1,
// hlengthY2 ) = (30.0000000, 10.0000000, 50.0000000, 10.0000000,
// 20.0000000)
diamondBoundsObject.toStream(std::cout);
boost::test_tools::output_test_stream dumpOuput;
diamondBoundsObject.toStream(dumpOuput);
Expand Down
6 changes: 3 additions & 3 deletions Tests/UnitTests/Core/Surfaces/DiscTrapezoidBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ BOOST_AUTO_TEST_CASE(DiscTrapezoidBoundsProperties) {
/// Test halfPhiSector (redundant; not configurable)
CHECK_SMALL(DiscTrapezoidBoundsObject.stereo(), 1e-6);

/// Test minHalflengthX
/// Test minHalfLengthX
CHECK_CLOSE_REL(
DiscTrapezoidBoundsObject.get(DiscTrapezoidBounds::eHalfLengthXminR),
minHalfX, 1e-6);

/// Test maxHalflengthX
/// Test maxHalfLengthX
CHECK_CLOSE_REL(
DiscTrapezoidBoundsObject.get(DiscTrapezoidBounds::eHalfLengthXmaxR),
maxHalfX, 1e-6);

/// Test halflengthY
/// Test halfLengthY
CHECK_CLOSE_REL(DiscTrapezoidBoundsObject.halfLengthY(), 0.792286991, 1e-6);
}
/// Unit test for testing DiscTrapezoidBounds assignment
Expand Down
9 changes: 9 additions & 0 deletions Tests/UnitTests/Core/Surfaces/EllipseBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,47 @@ BOOST_AUTO_TEST_CASE(ConeBoundsExceptions) {
BOOST_CHECK_THROW(
EllipseBounds(-innerRx, innerRy, outerRx, outerRy, phiSector, averagePhi),
std::logic_error);

// Exception for innerRy < 0
BOOST_CHECK_THROW(
EllipseBounds(innerRx, -innerRy, outerRx, outerRy, phiSector, averagePhi),
std::logic_error);

// Exception for innerRx < 0 and innerRy < 0
BOOST_CHECK_THROW(EllipseBounds(-innerRx, -innerRy, outerRx, outerRy,
phiSector, averagePhi),
std::logic_error);

// Exception for opening outerRx <= 0
BOOST_CHECK_THROW(
EllipseBounds(innerRx, innerRy, 0., outerRy, phiSector, averagePhi),
std::logic_error);

// Exception for opening outerRy <= 0
BOOST_CHECK_THROW(
EllipseBounds(innerRx, innerRy, outerRx, 0., phiSector, averagePhi),
std::logic_error);

// Exception for iouterRx < 0 and outerRy < 0
BOOST_CHECK_THROW(EllipseBounds(innerRx, innerRy, -outerRx, -outerRy,
phiSector, averagePhi),
std::logic_error);

// Exception for innerRx > outerRx
BOOST_CHECK_THROW(
EllipseBounds(outerRx, innerRy, innerRx, outerRy, phiSector, averagePhi),
std::logic_error);

// Exception for innerRxy > outerRy
BOOST_CHECK_THROW(
EllipseBounds(innerRx, outerRy, outerRx, innerRy, phiSector, averagePhi),
std::logic_error);

// Exception for negative phiSector
BOOST_CHECK_THROW(
EllipseBounds(innerRx, innerRy, outerRx, outerRy, -phiSector, averagePhi),
std::logic_error);

// Exception for average phi out of bound
BOOST_CHECK_THROW(
EllipseBounds(innerRx, innerRy, outerRx, outerRy, phiSector, 4.),
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Surfaces/LineBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(LineBoundsProperties) {
/// Test for r()
BOOST_CHECK_EQUAL(lineBoundsObject.get(LineBounds::eR), radius);

/// Test for halflengthZ (NOTE: Naming violation)
/// Test for halfLengthZ
BOOST_CHECK_EQUAL(lineBoundsObject.get(LineBounds::eHalfLengthZ), halfZ);

/// Test for dump
Expand Down
6 changes: 2 additions & 4 deletions Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,24 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) {
BOOST_CHECK(output.is_equal("Acts::LineSurface"));

// normal
// arbitrary position, because should be irrelevant
Vector3 position{5, 5, 5}; // should be irrelevant
{
Vector3 position{5, 5, 5}; // should be irrelevant
Vector3 direction{1, 0, 0};
CHECK_CLOSE_ABS(line.normal(tgContext, position, direction), direction,
1e-6);
}
{
Vector3 position{5, 5, 5}; // should be irrelevant
Vector3 direction = Vector3{1, 0, 0.1}.normalized();
CHECK_CLOSE_ABS(line.normal(tgContext, position, direction),
Vector3::UnitX(), 1e-6);
}
{
Vector3 position{5, 5, 5}; // should be irrelevant
Vector3 direction{-1, 0, 0};
CHECK_CLOSE_ABS(line.normal(tgContext, position, direction), direction,
1e-6);
}
{
Vector3 position{5, 5, 5}; // should be irrelevant
Vector3 direction{0, 1, 0};
CHECK_CLOSE_ABS(line.normal(tgContext, position, direction), direction,
1e-6);
Expand Down
8 changes: 4 additions & 4 deletions Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceExtent) {
}

BOOST_AUTO_TEST_CASE(RotatedTrapezoid) {
double shortHalfX{100.};
double longHalfX{200.};
double halfY{300.};
double rotAngle{45._degree};
const double shortHalfX = 100.;
const double longHalfX = 200.;
const double halfY = 300.;
const double rotAngle = 45._degree;

Vector2 edgePoint{longHalfX - 10., halfY};

Expand Down
4 changes: 3 additions & 1 deletion Tests/UnitTests/Core/Surfaces/RadialBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ BOOST_AUTO_TEST_CASE(RadialBoundsProperties) {
/// Unit test for testing RadialBounds assignment
BOOST_AUTO_TEST_CASE(RadialBoundsAssignment) {
RadialBounds radialBoundsObject(rMin, rMax, halfPhiSector);
// operator == not implemented in this class

/// Test operator ==
// not implemented in this class

/// Test assignment
RadialBounds assignedRadialBoundsObject(10.1, 123.);
Expand Down
10 changes: 6 additions & 4 deletions Tests/UnitTests/Core/Surfaces/RectangleBoundsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsProperties) {
const double halfY = 5.;

RectangleBounds rect(halfX, halfY);
BOOST_CHECK_EQUAL(rect.halfLengthX(), 10.);
BOOST_CHECK_EQUAL(rect.halfLengthY(), 5.);
BOOST_CHECK_EQUAL(rect.halfLengthX(), halfX);
BOOST_CHECK_EQUAL(rect.halfLengthY(), halfY);

CHECK_CLOSE_ABS(rect.min(), Vector2(-halfX, -halfY), 1e-6);
CHECK_CLOSE_ABS(rect.max(), Vector2(halfX, halfY), 1e-6);

const std::vector<Vector2> coords = {
{-10., -5.}, {10., -5.}, {10., 5.}, {-10., 5.}};
{-halfX, -halfY}, {halfX, -halfY}, {halfX, halfY}, {-halfX, halfY}};
// equality, ensure ordering is ok
const auto& rectVertices = rect.vertices();
BOOST_CHECK_EQUAL_COLLECTIONS(coords.cbegin(), coords.cend(),
Expand All @@ -101,7 +101,9 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsProperties) {
BOOST_CHECK(rect.inside(pointA, tolerance));
}
BOOST_AUTO_TEST_CASE(RectangleBoundsAssignment) {
const double halfX(10.), halfY(2.);
const double halfX = 10.;
const double halfY = 2.; // != 5.

RectangleBounds rectA(halfX, halfY);
RectangleBounds rectB(0., 0.);
rectB = rectA;
Expand Down
3 changes: 2 additions & 1 deletion Tests/UnitTests/Core/Surfaces/SurfaceTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ BOOST_AUTO_TEST_CASE(EqualityOperators) {
BOOST_CHECK(surface1 == surface2);

// remove test for the moment, surfaces do not have a concept of thickness
// (only detector elements have) only thickness is different here
// (only detector elements have)
// only thickness is different here
// BOOST_CHECK_NE(surface1, surface3);

BOOST_CHECK(surface1 != surface4);
Expand Down

0 comments on commit cce4e4f

Please sign in to comment.