Range
This commit is contained in:
@ -206,6 +206,7 @@ public class UnitTestCalculations
|
||||
[TestMethod]
|
||||
public void TestAreaPermille()
|
||||
{
|
||||
int faceAreaPermille=1000;
|
||||
Location location;
|
||||
double confidence = 0.1D;
|
||||
int areaPermille, left, top, right, bottom, width, height;
|
||||
@ -215,7 +216,7 @@ public class UnitTestCalculations
|
||||
bottom = 100;
|
||||
width = 100;
|
||||
height = 100;
|
||||
areaPermille = IMapping.GetAreaPermille(bottom, height, left, right, top, width);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, bottom, height, left, right, top, width);
|
||||
Assert.IsTrue(areaPermille == 1000);
|
||||
left = 0;
|
||||
right = 50;
|
||||
@ -224,7 +225,7 @@ public class UnitTestCalculations
|
||||
width = 100;
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
areaPermille = IMapping.GetAreaPermille(height, location, width);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, height, location, width);
|
||||
Assert.IsTrue(areaPermille == 250);
|
||||
left = 0;
|
||||
right = 25;
|
||||
@ -234,7 +235,7 @@ public class UnitTestCalculations
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
OutputResolution outputResolution = new(height, 0, width);
|
||||
areaPermille = IMapping.GetAreaPermille(location, outputResolution);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, location, outputResolution);
|
||||
Assert.IsTrue(areaPermille == 62);
|
||||
}
|
||||
|
||||
@ -541,4 +542,29 @@ public class UnitTestCalculations
|
||||
Assert.IsNotNull(lines);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGetConfidencePercent()
|
||||
{
|
||||
int faceConfidencePercent = 100;
|
||||
double minimum, target, maximum, value, check;
|
||||
minimum = 0.8f;
|
||||
target = 0.8f;
|
||||
maximum = int.MaxValue;
|
||||
value = 0f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 0);
|
||||
target = 0.8f;
|
||||
value = 0.4f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 50);
|
||||
target = 0.8f;
|
||||
value = 0.8f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 100);
|
||||
target = 0.8f;
|
||||
value = 1.6f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 200);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user