ts: refactor OpenCV tests

- removed tr1 usage (dropped in C++17)
- moved includes of vector/map/iostream/limits into ts.hpp
- require opencv_test + anonymous namespace (added compile check)
- fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions
- added missing license headers
This commit is contained in:
Alexander Alekhin
2017-11-05 13:48:40 +00:00
parent f1e50ecab3
commit 4a297a2443
435 changed files with 2009 additions and 2378 deletions
+11 -7
View File
@@ -1,3 +1,7 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////// tests for matrix operations and math functions ///////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
@@ -7,8 +11,7 @@
#include <math.h>
#include "opencv2/core/softfloat.hpp"
using namespace cv;
using namespace std;
namespace opencv_test { namespace {
/// !!! NOTE !!! These tests happily avoid overflow cases & out-of-range arguments
/// so that output arrays contain neigher Inf's nor Nan's.
@@ -3079,7 +3082,7 @@ TEST(Core_Cholesky, accuracy64f)
for (int i = 0; i < A.rows; i++)
for (int j = i + 1; j < A.cols; j++)
A.at<double>(i, j) = 0.0;
EXPECT_LE(norm(refA, A*A.t(), CV_RELATIVE_L2), FLT_EPSILON);
EXPECT_LE(cvtest::norm(refA, A*A.t(), CV_RELATIVE_L2), FLT_EPSILON);
}
TEST(Core_QR_Solver, accuracy64f)
@@ -3099,7 +3102,7 @@ TEST(Core_QR_Solver, accuracy64f)
//solve system with square matrix
solve(A, B, solutionQR, DECOMP_QR);
EXPECT_LE(norm(A*solutionQR, B, CV_RELATIVE_L2), FLT_EPSILON);
EXPECT_LE(cvtest::norm(A*solutionQR, B, CV_RELATIVE_L2), FLT_EPSILON);
A = Mat(m, n, CV_64F);
B = Mat(m, n, CV_64F);
@@ -3108,13 +3111,13 @@ TEST(Core_QR_Solver, accuracy64f)
//solve normal system
solve(A, B, solutionQR, DECOMP_QR | DECOMP_NORMAL);
EXPECT_LE(norm(A.t()*(A*solutionQR), A.t()*B, CV_RELATIVE_L2), FLT_EPSILON);
EXPECT_LE(cvtest::norm(A.t()*(A*solutionQR), A.t()*B, CV_RELATIVE_L2), FLT_EPSILON);
//solve overdeterminated system as a least squares problem
Mat solutionSVD;
solve(A, B, solutionQR, DECOMP_QR);
solve(A, B, solutionSVD, DECOMP_SVD);
EXPECT_LE(norm(solutionQR, solutionSVD, CV_RELATIVE_L2), FLT_EPSILON);
EXPECT_LE(cvtest::norm(solutionQR, solutionSVD, CV_RELATIVE_L2), FLT_EPSILON);
//solve system with singular matrix
A = Mat(10, 10, CV_64F);
@@ -3718,7 +3721,7 @@ TEST(Core_SoftFloat, sincos64)
softdouble x = inputs[i];
int xexp = x.getExp();
softdouble randEps = eps.setExp(max(xexp-52, -46));
softdouble randEps = eps.setExp(std::max(xexp-52, -46));
softdouble sx = sin(x);
softdouble cx = cos(x);
ASSERT_FALSE(sx.isInf()); ASSERT_FALSE(cx.isInf());
@@ -3862,4 +3865,5 @@ TEST(Core_SoftFloat, CvRound)
}
}
}} // namespace
/* End of file. */