Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 0b0b06a9 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adapt testcase: allow few traction interruptions to be longer than specified...

adapt testcase: allow few traction interruptions to be longer than specified in model data (i.e. due to gearshift right before a speed change (simulation interval can't be changed))
parent 5897a704
No related branches found
No related tags found
No related merge requests found
...@@ -148,7 +148,8 @@ namespace TUGraz.VectoCore.Tests.Reports ...@@ -148,7 +148,8 @@ namespace TUGraz.VectoCore.Tests.Reports
} }
[TestCase(@"TestData\XML\XMLReaderDeclaration\Tractor_4x2_vehicle-class-5_5_t_0.xml", 1, 1.0), [TestCase(@"TestData\XML\XMLReaderDeclaration\Tractor_4x2_vehicle-class-5_5_t_0.xml", 1, 1.0),
] TestCase(@"TestData\XML\XMLReaderDeclaration\Tractor_4x2_vehicle-class-5_5_t_0.xml", 7, 1.0)
]
public void TractionInterruptionTest(string filename, int idx, double expectedTractionInterruption) public void TractionInterruptionTest(string filename, int idx, double expectedTractionInterruption)
{ {
var writer = new FileOutputWriter(filename); var writer = new FileOutputWriter(filename);
...@@ -172,19 +173,28 @@ namespace TUGraz.VectoCore.Tests.Reports ...@@ -172,19 +173,28 @@ namespace TUGraz.VectoCore.Tests.Reports
var tractionInterruptionTimes = ExtractTractionInterruptionTimes(modData); var tractionInterruptionTimes = ExtractTractionInterruptionTimes(modData);
var min = tractionInterruptionTimes.Values.Min(); var min = tractionInterruptionTimes.Values.Min();
var max = tractionInterruptionTimes.Values.Max(); //var max = tractionInterruptionTimes.Values.Max();
Console.WriteLine("number of traction interruption intervals: {0}", tractionInterruptionTimes.Count); Console.WriteLine("number of traction interruption intervals: {0}", tractionInterruptionTimes.Count);
var exceeding = tractionInterruptionTimes.Where(x => x.Value.IsGreater(expectedTractionInterruption, 0.1)).ToList(); var exceedingHigh = tractionInterruptionTimes.Where(x => x.Value.IsGreater(expectedTractionInterruption, 0.1)).ToList();
Console.WriteLine("number of traction interruption times exceeding specified interval: {0}", exceeding.Count()); var exceedingLow = tractionInterruptionTimes.Where(x => x.Value.IsSmaller(expectedTractionInterruption, 0.1)).ToList();
if (exceeding.Count > 0) { Console.WriteLine("number of traction interruption times exceeding specified interval: {0}", exceedingHigh.Count());
foreach (var e in exceeding) { if (exceedingHigh.Count > 0) {
foreach (var e in exceedingHigh) {
Console.WriteLine("{0} : {1}", e.Key, e.Value); Console.WriteLine("{0} : {1}", e.Key, e.Value);
} }
} }
if (exceedingLow.Count > 0) {
foreach (var e in exceedingLow) {
Console.WriteLine("{0} : {1}", e.Key, e.Value);
}
}
Assert.IsTrue(exceedingHigh.Count < 5);
var max2 = tractionInterruptionTimes.Values.OrderBy(x => x.Value()).Reverse().Skip(5).Max();
Assert.IsTrue(min.IsEqual(expectedTractionInterruption, 0.05), "minimum traction interruption time: {0}", min); Assert.IsTrue(min.IsEqual(expectedTractionInterruption, 0.1), "minimum traction interruption time: {0}", min);
Assert.IsTrue(max.IsEqual(expectedTractionInterruption, 0.1), "maximum traction interruption time: {0}", max); Assert.IsTrue(max2.IsEqual(expectedTractionInterruption, 0.1), "maximum traction interruption time: {0}", max2);
} }
......
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