17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 11:39:14 +01:00

feat(track): the foot of the ballast stays on the ground as designed

Rails, sleepers and the top of the ballast go with the unevenness, the
slope of the ballast takes up the difference.
This commit is contained in:
maj00r
2026-10-31 18:27:19 +01:00
parent 6aed9ec5bd
commit 3dbe8a75f8
6 changed files with 31 additions and 4 deletions

View File

@@ -165,6 +165,18 @@ TEST_CASE("uneven track: the value along a track meets its neighbours exactly")
}
}
TEST_CASE("uneven track: the foot of the ballast stays where it was")
{
double const rail{0.18};
double const height{0.38};
CHECK(track_uneven::bed_share(0.0, rail, height) == doctest::Approx(1.0)); // rail top
CHECK(track_uneven::bed_share(rail, rail, height) == doctest::Approx(1.0)); // top of the ballast
CHECK(track_uneven::bed_share(rail + 0.5 * height, rail, height) == doctest::Approx(0.5));
CHECK(track_uneven::bed_share(rail + height, rail, height) == doctest::Approx(0.0)); // its foot
CHECK(track_uneven::bed_share(rail + 2.0 * height, rail, height) == doctest::Approx(0.0));
CHECK(track_uneven::bed_share(rail + 1.0, rail, 0.0) == doctest::Approx(1.0)); // no ballast
}
TEST_CASE("uneven track: the rails dip around a joint")
{
CHECK(track_uneven::dip(0.0) == doctest::Approx(1.0));