public void CompareTestDifferencesTooSmall() { List <double> source = new List <double>(); List <double> target = new List <double>(); double tolerance = 0.01; double epsilon = 0.001; for (double i = 0; i < 10; i++) { source.Add(1); target.Add(1 + epsilon); } double[] sourceDoubles = source.ToArray(); double[] targetDoubles = target.ToArray(); var testing = new X86Mathematics(); var retCompare = testing.CompareAbsolute(sourceDoubles, targetDoubles, tolerance, epsilon); Assert.AreEqual(0, retCompare.Item1); }
public void CompareAbsoluteSampleTest() { byte[] refFile = DSCTests.Properties.Resources.RD_UnitTest_P1Ref_X_100A_10_0_1; byte[] targetFile = DSCTests.Properties.Resources.RD_UnitTest_P1Ref_X_100A_10_0_1; int expectedFail = 0; refDose = new Model.DoseMatrixOptimal(new EvilDICOM.RT.DoseMatrix(EvilDICOM.Core.DICOMObject.Read(refFile))); targetDose = new Model.DoseMatrixOptimal(new EvilDICOM.RT.DoseMatrix(EvilDICOM.Core.DICOMObject.Read(targetFile))); SingleComparison result = mathematics.CompareAbsolute(refDose, targetDose, dtas[DtaTypes.t0d0p0mm]); System.Diagnostics.Debug.WriteLine("Compared"); Assert.AreEqual(targetDose.Count, result.TotalCompared); // confirm all voxels are compared System.Diagnostics.Debug.WriteLine("Failed"); Assert.AreEqual(expectedFail, result.TotalFailed); //confirms the number of failed voxels is zero }
public void CompareTestSingleNotFailure() { List <double> source = new List <double>(); List <double> target = new List <double>(); double tolerance = 0.01; double epsilon = 0.01; for (double i = 0; i < 10; i++) { source.Add(1); target.Add(1); } target[0] = 1 + tolerance - epsilon; var testing = new X86Mathematics(); double[] sourceDoubles = source.ToArray(); double[] targetDoubles = target.ToArray(); var retCompare = testing.CompareAbsolute(sourceDoubles, targetDoubles, tolerance, epsilon); Assert.AreEqual(0, retCompare.Item1); }