diff --git a/VectoCore/VectoCore/Models/Declaration/Segments.cs b/VectoCore/VectoCore/Models/Declaration/Segments.cs index 03f5181a72a470d482d162a9059eb903303dc3bf..e97a807c64149797014e025684a3f0a68638973f 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segments.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segments.cs @@ -67,12 +67,20 @@ namespace TUGraz.VectoCore.Models.Declaration DataRow row; try { - row = SegmentTable.Rows.Cast<DataRow>().First(r => r.Field<string>("valid") == "1" - && r.Field<string>("vehiclecategory") == vehicleCategory.ToString() - && r.Field<string>("axleconf.") == axleConfiguration.GetName() - && r.ParseDouble("gvw_min").SI().Ton < grossVehicleMassRating - && r.ParseDouble("gvw_max").SI().Ton >= grossVehicleMassRating - ); + row = SegmentTable.Rows.Cast<DataRow>().First(r => { + var isValid = r.Field<string>("valid"); + var category = r.Field<string>("vehiclecategory"); + var axleConf = r.Field<string>("axleconf."); + var massMin = r.ParseDouble("gvw_min").SI().Ton; + var massMax = r.ParseDouble("gvw_max").SI().Ton; + return isValid == "1" + && category == vehicleCategory.ToString() + && axleConf == axleConfiguration.GetName() + // MK 2016-06-07: normally the next condition should be "mass > massMin", except for 7.5t where is should be ">=" + // in any case ">=" is also correct, because the segment table is sorted by weight. + && grossVehicleMassRating >= massMin + && grossVehicleMassRating <= massMax; + }); } catch (InvalidOperationException e) { var errorMessage = string.Format( "ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleMassRating: {2}", diff --git a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv index 4e093ca9fa1b8e144045f0ddfd3fc1f63104f8a0..f0ac67d600ea4e0cf9348459f85e53b38ed1a0b1 100644 --- a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv +++ b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv @@ -1,29 +1,29 @@ Valid,Vehicle Category ,Axle Conf.,GVW_Min,GVW_Max,HDV class,.vacc file ,Cross Wind Correction - Long haul,Cross Wind Correction - Other,Truck Axles - Long haul,Truck Axles - Other,Trailer Axles - Long haul,Trailer Axles - Other,Long haul,Regional delivery,Urban delivery,Municipal utility,Construction,Heavy Urban,Urban,Suburban,Interurban,Coach,Mass Extra - Long haul,Mass Extra - Regional delivery,Mass Extra - Urban delivery,Mass Extra - Municipal utility,Mass Extra - Construction,Mass Extra - Heavy Urban,Mass Extra - Urban,Mass Extra - Suburban,Mass Extra - Interurban,Mass Extra - Coach,Payload - Long haul,Payload - Regional delivery,Payload - Urban delivery,Payload - Municipal utility,Payload - Construction,Payload - Heavy Urban,Payload - Urban,Payload - Suburban,Payload - Interurban,Payload - Coach -0,RigidTruck,4x2,0,7.5,0,Truck.vacc,-,RigidSolo,-,-,-,-,0,1,1,0,0,0,0,0,0,0,-,???,???,-,-,-,-,-,-,-,-,???,???,-,-,-,-,-,-,- -1,RigidTruck,4x2,7.5,10,1,Truck.vacc,-,RigidSolo,-,45/55,-,-,0,1,1,0,0,0,0,0,0,0,-,1600,1600,-,-,-,-,-,-,-,-,f,f,-,-,-,-,-,-,- -1,Tractor,4x2,7.5,10,1,Truck.vacc,-,RigidSolo,-,45/55,-,-,0,1,1,0,0,0,0,0,0,0,-,1600,1600,-,-,-,-,-,-,-,-,f,f,-,-,-,-,-,-,- -1,RigidTruck,4x2,10,12,2,Truck.vacc,RigidSolo,RigidSolo,40/60,45/55,-,-,1,1,1,0,0,0,0,0,0,0,1900,1900,1900,-,-,-,-,-,-,-,f,f,f,-,-,-,-,-,-,- -1,Tractor,4x2,10,12,2,Truck.vacc,RigidSolo,RigidSolo,40/60,45/55,-,-,1,1,1,0,0,0,0,0,0,0,1900,1900,1900,-,-,-,-,-,-,-,f,f,f,-,-,-,-,-,-,- -1,RigidTruck,4x2,12,16,3,Truck.vacc,-,RigidSolo,-,40/60,-,-,0,1,1,0,0,0,0,0,0,0,-,2000,2000,-,-,-,-,-,-,-,-,f,f,-,-,-,-,-,-,- -1,Tractor,4x2,12,16,3,Truck.vacc,-,RigidSolo,-,40/60,-,-,0,1,1,0,0,0,0,0,0,0,-,2000,2000,-,-,-,-,-,-,-,-,f,f,-,-,-,-,-,-,- -1,RigidTruck,4x2,16,99,4,Truck.vacc,RigidTrailer,RigidSolo,20/30,45/55,50/2,-,1,1,0,1,0,0,0,0,0,0,7500,2100,-,2100,-,-,-,-,-,-,14000,4400,-,4400,-,-,-,-,-,- -1,Tractor,4x2,16,99,5,Truck.vacc,TractorSemitrailer,TractorSemitrailer,20/25,25/25,55/3,50/3,1,1,0,0,0,0,0,0,0,0,7500,7500,-,-,-,-,-,-,-,-,19300,12900,-,-,-,-,-,-,-,- -0,RigidTruck,4x4,7.5,16,6,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,1,1,0,0,0,0,0,-,-,-,???,???,-,-,-,-,-,-,-,-,???,???,-,-,-,-,- -0,RigidTruck,4x4,16,99,7,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -0,Tractor,4x4,16,99,8,Truck.vacc,-,TractorSemitrailer,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -1,RigidTruck,6x2,0,99,9,Truck.vacc,RigidTrailer,RigidSolo,20/30/15,35/40/25,35/2,-,1,1,0,1,0,0,0,0,0,0,7600,2200,-,2200,-,-,-,-,-,-,19300,7100,-,7100,-,-,-,-,-,- -1,Tractor,6x2,0,99,10,Truck.vacc,TractorSemitrailer,TractorSemitrailer,15/10/20,20/10/20,55/2,50/2,1,1,0,0,0,0,0,0,0,0,7500,7500,-,-,-,-,-,-,-,-,19300,12900,-,-,-,-,-,-,-,- -0,RigidTruck,6x4,0,99,11,Truck.vacc,-,RigidSolo,-,35/35/30,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,7100,-,-,-,-,- -0,Tractor,6x4,0,99,12,Truck.vacc,-,TractorSemitrailer,-,20/15/15,-,50/2,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,12900,-,-,-,-,- -0,RigidTruck,6x6,0,99,13,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -0,Tractor,6x6,0,99,14,Truck.vacc,-,TractorSemitrailer,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -0,RigidTruck,8x2,0,99,15,Truck.vacc,-,RigidSolo,-,-,-,-,0,1,0,0,0,0,0,0,0,0,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,-,-,-,- -0,RigidTruck,8x4,0,99,16,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,12900,-,-,-,-,- -0,RigidTruck,8x6,0,99,17,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -0,RigidTruck,8x8,0,99,17,Truck.vacc,-,RigidSolo,-,-,-,-,0,0,0,0,1,0,0,0,0,0,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,-,-,-,-,- -0,CityBus,4x2,0,18,B1,N/A,-,CoachBus,-,-,-,-,0,0,0,0,0,1,1,1,0,0,-,-,-,-,-,???,???,???,-,-,-,-,-,-,-,???,???,???,-,- -0,InterurbanBus,4x2,0,18,B2,N/A,-,CoachBus,-,-,-,-,0,0,0,0,0,0,0,0,1,0,-,-,-,-,-,-,-,-,???,-,-,-,-,-,-,-,-,-,???,- -0,Coach,4x2,0,18,B3,N/A,-,CoachBus,-,-,-,-,0,0,0,0,0,0,0,0,0,1,-,-,-,-,-,-,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.cs index 2029c8659fa0978fad3500f0a3ae03c1d6c814be..5ab2a8e9050846fa6135dd95cdde57c3600ddf62 100644 --- a/VectoCore/VectoCore/Utils/VectoCSVFile.cs +++ b/VectoCore/VectoCore/Utils/VectoCSVFile.cs @@ -133,7 +133,7 @@ namespace TUGraz.VectoCore.Utils do { var line = lines.Current; - var cells = line.Split(Delimiter); + var cells = line.Split(Delimiter).Select(s => s.Trim()).ToArray(); if (!ignoreEmptyColumns && cells.Length != table.Columns.Count) { throw new CSVReadException( string.Format("Line {0}: The number of values is not correct. Expected {1} Columns, Got {2} Columns", i, diff --git a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs index 4ff7d0935f2fce6cabaf5cdd17864a716900130b..037c1972adbffcb04f414e3e1264a35586a979ea 100644 --- a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs +++ b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs @@ -33,6 +33,8 @@ using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; +// ReSharper disable ObjectCreationAsStatement + namespace TUGraz.VectoCore.Tests.Exceptions { [TestClass] diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index ddcb5033769cfa3f654b7ead2502c34a428af43f..0cbf0383c1918dee086aa9da10be736c297caf78 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -414,29 +414,65 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration } } - [Test] - public void SegmentLookupTestOutOfRange() + [ + TestCase(0), + TestCase(1000), + TestCase(3500), + TestCase(7499) + ] + public void SegmentWeightOutOfRange4X2(double weight) + { + AssertHelper.Exception<VectoException>(() => + DeclarationData.Segments.Lookup( + VehicleCategory.RigidTruck, + AxleConfiguration.AxleConfig_4x2, + weight.SI<Kilogram>(), + 0.SI<Kilogram>()), + "Gross vehicle mass must be greater than 7.5 tons"); + } + + [ + TestCase(0), + TestCase(1000), + TestCase(3500), + TestCase(7499) + ] + public void SegmentWeightOutOfRange4X4(double weight) { - AssertHelper.Exception<VectoException>( - () => - DeclarationData.Segments.Lookup(VehicleCategory.RigidTruck, - AxleConfiguration.AxleConfig_4x2, - 1000.SI<Kilogram>(), 0.SI<Kilogram>()), "Gross vehicle mass must be greater than 7.5 tons"); + AssertHelper.Exception<VectoException>(() => + DeclarationData.Segments.Lookup( + VehicleCategory.RigidTruck, + AxleConfiguration.AxleConfig_4x4, + weight.SI<Kilogram>(), + 0.SI<Kilogram>()), + "Gross vehicle mass must be greater than 7.5 tons"); } [Test, + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7500, 0, VehicleClass.Class1), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500, 0, VehicleClass.Class1), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, VehicleClass.Class1), TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, VehicleClass.Class1), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10001, 0, VehicleClass.Class2), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10001, 0, VehicleClass.Class2), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, VehicleClass.Class2), TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, VehicleClass.Class2), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12001, 0, VehicleClass.Class3), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12001, 0, VehicleClass.Class3), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, VehicleClass.Class3), TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, VehicleClass.Class3), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, VehicleClass.Class4), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 99000, 0, VehicleClass.Class4), TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, VehicleClass.Class5), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 99000, 0, VehicleClass.Class5), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7500, 0, VehicleClass.Class9), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, VehicleClass.Class10), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, VehicleClass.Class9), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 99000, 0, VehicleClass.Class9), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, VehicleClass.Class10), TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 99000, 0, VehicleClass.Class10), ] public void SegmentLookupTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, double curbWeight, VehicleClass expectedClass)