mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
fix(tapes): a command is not taken for the header, and a gap in a tape is neither driving nor distance
- The header is the line that doesn't start with a figure. A line whose command, which is free text, says "Security" was taken for it, moving the alerter's column and dropping the line. - A tape the black box writes goes on after a gap when the player comes back to its vehicle. A step of more than twenty usual steps between two lines (a second at least) is time not recorded: no distance over it, and neither running nor standing time; the average with the stops leaves it out too.
This commit is contained in:
@@ -86,6 +86,31 @@ public class HaslerTapeTests
|
||||
Assert.True(tape.Samples[1].SecurityAlarm);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_command_named_like_a_heading_is_read_as_a_line_not_as_the_header()
|
||||
{
|
||||
var tape = HaslerTape.Parse(Header + Line(0, 36, 0, 0, command: "Security") + Line(1, 36, 0, 0, security: 1));
|
||||
|
||||
Assert.Equal(2, tape.Samples.Count);
|
||||
Assert.False(tape.Samples[0].SecurityAlarm);
|
||||
Assert.True(tape.Samples[1].SecurityAlarm);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_gap_in_the_time_is_neither_driving_nor_standing_and_covers_no_distance()
|
||||
{
|
||||
// the player in another vehicle for ten minutes, then back in this one
|
||||
var tape = HaslerTape.Parse(Header + Line(0, 36, 0, 0) + Line(1, 36, 0, 0) + Line(601, 36, 0, 0)
|
||||
+ Line(602, 36, 0, 0) + Line(603, 0, 0, 0));
|
||||
|
||||
Assert.Equal(603, tape.Duration, 6);
|
||||
Assert.Equal(600, tape.GapTime, 6);
|
||||
Assert.Equal(2, tape.RunningTime, 6);
|
||||
Assert.Equal(1, tape.StandingTime, 6); // the last second, stopping
|
||||
Assert.Equal(10 + 10 + 5, tape.DistanceM, 6);
|
||||
Assert.Equal(25 / 3.0 * 3.6, tape.AverageWithStopsKmh, 6);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_sample_under_a_point_of_the_tape_is_found_by_time_and_by_distance()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user