IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 32b3e5aa authored by ralfulrich's avatar ralfulrich Committed by Ralf Ulrich
Browse files

coverage

parent 8ec7cd96
No related branches found
No related tags found
No related merge requests found
...@@ -101,6 +101,10 @@ TEST_CASE("Geometry CoordinateSystems") { ...@@ -101,6 +101,10 @@ TEST_CASE("Geometry CoordinateSystems") {
// vector norm invariant under rotation // vector norm invariant under rotation
CHECK(v1.getComponents(rotatedCS).getNorm().magnitude() == CHECK(v1.getComponents(rotatedCS).getNorm().magnitude() ==
Approx(v1.getComponents(rootCS).getNorm().magnitude())); Approx(v1.getComponents(rootCS).getNorm().magnitude()));
// this is not possible
QuantityVector<length_d> const axis_invalid{0_m, 0_m, 0_km};
CHECK_THROWS(make_rotation(rootCS, axis_invalid, angle));
} }
SECTION("multiple rotations") { SECTION("multiple rotations") {
...@@ -201,6 +205,10 @@ TEST_CASE("Geometry CoordinateSystem-hirarchy") { ...@@ -201,6 +205,10 @@ TEST_CASE("Geometry CoordinateSystem-hirarchy") {
CoordinateSystemPtr root = get_root_CoordinateSystem(); CoordinateSystemPtr root = get_root_CoordinateSystem();
Point const p1(root, {0_m, 0_m, 0_m}); // the origin of the root CS Point const p1(root, {0_m, 0_m, 0_m}); // the origin of the root CS
CHECK(p1.getX(root) == 0_m);
CHECK(p1.getY(root) == 0_m);
CHECK(p1.getZ(root) == 0_m);
// root -> cs2 // root -> cs2
CoordinateSystemPtr cs2 = make_translation(root, {0_m, 0_m, 1_m}); CoordinateSystemPtr cs2 = make_translation(root, {0_m, 0_m, 1_m});
Point const p2(cs2, {0_m, 0_m, -1_m}); Point const p2(cs2, {0_m, 0_m, -1_m});
...@@ -280,6 +288,8 @@ TEST_CASE("Geometry Trajectories") { ...@@ -280,6 +288,8 @@ TEST_CASE("Geometry Trajectories") {
.getNorm() .getNorm()
.magnitude() == Approx(0).margin(absMargin)); .magnitude() == Approx(0).margin(absMargin));
CHECK((line.getTimeFromArclength(10_m) / (10_m / v0.getNorm()) == Approx(1)));
auto const t = 1_s; auto const t = 1_s;
StraightTrajectory base(line, t); StraightTrajectory base(line, t);
CHECK(line.getPosition(t).getCoordinates() == base.getPosition(1.).getCoordinates()); CHECK(line.getPosition(t).getCoordinates() == base.getPosition(1.).getCoordinates());
...@@ -348,8 +358,6 @@ TEST_CASE("Distance between points") { ...@@ -348,8 +358,6 @@ TEST_CASE("Distance between points") {
CHECK(distance(p5, p6) / 1_m == Approx(1)); CHECK(distance(p5, p6) / 1_m == Approx(1));
} }
TEST_CASE("Geometry Tree") {}
TEST_CASE("Path") { TEST_CASE("Path") {
// define a known CS // define a known CS
CoordinateSystemPtr root = get_root_CoordinateSystem(); CoordinateSystemPtr root = get_root_CoordinateSystem();
......
...@@ -186,6 +186,7 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking, ...@@ -186,6 +186,7 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
particle.setNode(nextVol); particle.setNode(nextVol);
particle.setPosition(traj.getPosition(1)); particle.setPosition(traj.getPosition(1));
particle.setMomentum(traj.getDirection(1) * particle.getMomentum().getNorm()); particle.setMomentum(traj.getDirection(1) * particle.getMomentum().getNorm());
SpeedType const speed_0 = particle.getVelocity().getNorm();
if (outer) { if (outer) {
// now we know we are in target volume, depending on "outer" // now we know we are in target volume, depending on "outer"
CHECK(traj.getLength(1) / 1_m == Approx(0).margin(1e-3)); CHECK(traj.getLength(1) / 1_m == Approx(0).margin(1e-3));
...@@ -211,6 +212,7 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking, ...@@ -211,6 +212,7 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking,
particle.getMomentum().getNorm(), particle.getMomentum().getNorm(),
particle.getVelocity().getNorm(), traj2.getLength(1), particle.getVelocity().getNorm(), traj2.getLength(1),
traj2.getLength(1) / particle.getVelocity().getNorm()); traj2.getLength(1) / particle.getVelocity().getNorm());
CHECK(speed_0 / traj2.getVelocity(1).getNorm() == Approx(1));
} }
CHECK_FALSE(hit_2nd_behind); // this can never happen CHECK_FALSE(hit_2nd_behind); // this can never happen
// the next line is maybe an actual BUG: this should be investigated and eventually // the next line is maybe an actual BUG: this should be investigated and eventually
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment