Commit 8019498c authored by Alexander Alekhin's avatar Alexander Alekhin

java tests fixes

parent fe29080d
......@@ -1777,7 +1777,7 @@ public class CoreTest extends OpenCVTestCase {
};
Mat roots = new Mat();
assertEquals(0.0, Core.solvePoly(coeffs, roots));
assertGE(1e-6, Math.abs(Core.solvePoly(coeffs, roots)));
truth = new Mat(3, 1, CvType.CV_32FC2) {
{
......
......@@ -359,7 +359,7 @@ public class ImgprocTest extends OpenCVTestCase {
double distance = Imgproc.compareHist(H1, H2, Imgproc.CV_COMP_CORREL);
assertEquals(1., distance);
assertEquals(1., distance, EPS);
}
public void testContourAreaMat() {
......@@ -368,7 +368,7 @@ public class ImgprocTest extends OpenCVTestCase {
double area = Imgproc.contourArea(contour);
assertEquals(45., area);
assertEquals(45., area, EPS);
}
public void testContourAreaMatBoolean() {
......@@ -377,7 +377,7 @@ public class ImgprocTest extends OpenCVTestCase {
double area = Imgproc.contourArea(contour, true);
assertEquals(45., area);
assertEquals(45., area, EPS);
// TODO_: write better test
}
......
......@@ -244,6 +244,10 @@ public class OpenCVTestCase extends TestCase {
TestCase.fail(msg);
}
public static void assertGE(double v1, double v2) {
assertTrue("Failed: " + v1 + " >= " + v2, v1 >= v2);
}
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2) {
if (list1.size() != list2.size()) {
throw new UnsupportedOperationException();
......@@ -458,10 +462,10 @@ public class OpenCVTestCase extends TestCase {
if (isEqualityMeasured)
assertTrue("Max difference between expected and actiual Mats is "+ maxDiff + ", that bigger than " + eps,
Core.checkRange(diff, true, 0.0, eps));
maxDiff <= eps);
else
assertFalse("Max difference between expected and actiual Mats is "+ maxDiff + ", that less than " + eps,
Core.checkRange(diff, true, 0.0, eps));
maxDiff <= eps);
}
protected static String readFile(String path) {
......
......@@ -270,6 +270,10 @@ public class OpenCVTestCase extends TestCase {
TestCase.fail(msg);
}
public static void assertGE(double v1, double v2) {
assertTrue("Failed: " + v1 + " >= " + v2, v1 >= v2);
}
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2) {
if (list1.size() != list2.size()) {
throw new UnsupportedOperationException();
......@@ -484,10 +488,10 @@ public class OpenCVTestCase extends TestCase {
if (isEqualityMeasured)
assertTrue("Max difference between expected and actiual Mats is "+ maxDiff + ", that bigger than " + eps,
Core.checkRange(diff, true, 0.0, eps));
maxDiff <= eps);
else
assertFalse("Max difference between expected and actiual Mats is "+ maxDiff + ", that less than " + eps,
Core.checkRange(diff, true, 0.0, eps));
maxDiff <= eps);
}
protected static String readFile(String path) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment