From 28f25110c77be0e2eb865d41ef503edf81ec98f0 Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Mon, 6 Jun 2016 16:54:45 +0200
Subject: [PATCH] enhanced loss maps for tests

---
 .../DriverStrategy/SimpleCycles.cs            | 20 +++++++++----------
 .../Models/Simulation/SimulationTests.cs      | 18 +++++++++++++----
 .../TestData/Components/24t Coach.vmap        |  3 +++
 .../MeasuredSpeed/FuelConsumption.vmap        |  5 ++++-
 4 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs b/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs
index a9edbb1a1a..e3c8cc7e4b 100644
--- a/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs
+++ b/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs
@@ -70,11 +70,11 @@ namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy
 			return slopeStr;
 		}
 
-		[
-			TestCase(0, 80), TestCase(80, 0), TestCase(80, 80),
-			TestCase(0, 60), TestCase(60, 0), TestCase(60, 60),
-			TestCase(0, 40), TestCase(40, 0), TestCase(40, 40),
-			TestCase(0, 20), TestCase(20, 0), TestCase(20, 20),
+		[Category("LongRunning"),
+		TestCase(0, 80), TestCase(80, 0), TestCase(80, 80),
+		TestCase(0, 60), TestCase(60, 0), TestCase(60, 60),
+		TestCase(0, 40), TestCase(40, 0), TestCase(40, 40),
+		TestCase(0, 20), TestCase(20, 0), TestCase(20, 20),
 		]
 		public void Truck_AllSlopes(double v1, double v2)
 		{
@@ -100,11 +100,11 @@ namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy
 			}
 		}
 
-		[
-			TestCase(0, 80), TestCase(80, 0), TestCase(80, 80),
-			TestCase(0, 60), TestCase(60, 0), TestCase(60, 60),
-			TestCase(0, 40), TestCase(40, 0), TestCase(40, 40),
-			TestCase(0, 20), TestCase(20, 0), TestCase(20, 20),
+		[Category("LongRunning"),
+		TestCase(0, 80), TestCase(80, 0), TestCase(80, 80),
+		TestCase(0, 60), TestCase(60, 0), TestCase(60, 60),
+		TestCase(0, 40), TestCase(40, 0), TestCase(40, 40),
+		TestCase(0, 20), TestCase(20, 0), TestCase(20, 20),
 		]
 		public void Coach_AllSlopes(double v1, double v2)
 		{
diff --git a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs
index 75bd4460e5..0f8a54d266 100644
--- a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs
+++ b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs
@@ -67,6 +67,8 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
 			var job = CreateRun(actual);
 			job.Run();
 
+			Assert.IsTrue(job.FinishedWithoutErrors);
+
 			ResultFileHelper.TestModFile(expected, actual);
 		}
 
@@ -86,10 +88,14 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
 
 			var run = CreateRun(actual);
 
-			var sim = new JobContainer(new MockSumWriter());
-			sim.AddRun(run);
-			sim.Execute();
-			sim.WaitFinished();
+			var jobContainer = new JobContainer(new MockSumWriter());
+			jobContainer.AddRun(run);
+			jobContainer.Execute();
+			jobContainer.WaitFinished();
+
+			foreach (var r in jobContainer.Runs) {
+				Assert.IsTrue(r.Run.FinishedWithoutErrors, string.Format("{0}", r.ExecException));
+			}
 
 			ResultFileHelper.TestModFile(expected, actual);
 		}
@@ -124,6 +130,10 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
 
 			jobContainer.WaitFinished();
 
+			foreach (var run in jobContainer.Runs) {
+				Assert.IsTrue(run.Run.FinishedWithoutErrors, string.Format("{0}", run.ExecException));
+			}
+
 			ResultFileHelper.TestSumFile(@"TestData\Results\EngineOnlyCycles\24t Coach.vsum",
 				@"TestData\Jobs\24t Coach EngineOnly.vsum");
 
diff --git a/VectoCore/VectoCoreTest/TestData/Components/24t Coach.vmap b/VectoCore/VectoCoreTest/TestData/Components/24t Coach.vmap
index 26c035cad9..ef9b0c0123 100644
--- a/VectoCore/VectoCoreTest/TestData/Components/24t Coach.vmap	
+++ b/VectoCore/VectoCoreTest/TestData/Components/24t Coach.vmap	
@@ -111,3 +111,6 @@
 2100,800,35717
 2100,1000,45643
 2100,1100,50653
+500,-500,50000
+3000,1500,50000
+3000,-500,50000
\ No newline at end of file
diff --git a/VectoCore/VectoCoreTest/TestData/MeasuredSpeed/FuelConsumption.vmap b/VectoCore/VectoCoreTest/TestData/MeasuredSpeed/FuelConsumption.vmap
index f7ad107b96..28bb956919 100644
--- a/VectoCore/VectoCoreTest/TestData/MeasuredSpeed/FuelConsumption.vmap
+++ b/VectoCore/VectoCoreTest/TestData/MeasuredSpeed/FuelConsumption.vmap
@@ -183,4 +183,7 @@ engine speed [1/min],torque [Nm],fuel consumption [g/h]
 2600,400,23315
 2600,480,28351
 2700,-150,0
-2700,0,5900
\ No newline at end of file
+2700,0,5900
+1200,-400,50000
+0,-400,50000
+3000,-400,50000
\ No newline at end of file
-- 
GitLab