From 53104e6f43072a93ed398eec3526a7255d777c84 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 28 Apr 2012 11:00:34 +0000 Subject: [PATCH] decreased the number of tests in Core_Eigen, decreased the maximum matrix size in Core_SVD; now those tests take less time to complete --- modules/core/test/test_eigen.cpp | 19 ++++++++++--------- modules/core/test/test_math.cpp | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/core/test/test_eigen.cpp b/modules/core/test/test_eigen.cpp index ffeda69..7f0ba00 100644 --- a/modules/core/test/test_eigen.cpp +++ b/modules/core/test/test_eigen.cpp @@ -79,10 +79,12 @@ protected: bool check_full(int type); // compex test for symmetric matrix virtual void run (int) = 0; // main testing method -private: +protected: float eps_val_32, eps_vec_32; float eps_val_64, eps_vec_64; + int ntests; + bool check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index = -1, int high_index = -1); bool check_pair_count(const cv::Mat& src, const cv::Mat& evalues, const cv::Mat& evectors, int low_index = -1, int high_index = -1); bool check_pairs_order(const cv::Mat& eigen_values); // checking order of eigen values & vectors (it should be none up) @@ -140,8 +142,7 @@ Core_EigenTest_Scalar_64::~Core_EigenTest_Scalar_64() {} void Core_EigenTest_Scalar_32::run(int) { - const size_t MATRIX_COUNT = 500; - for (size_t i = 0; i < MATRIX_COUNT; ++i) + for (int i = 0; i < ntests; ++i) { float value = cv::randu(); cv::Mat src(1, 1, CV_32FC1, Scalar::all((float)value)); @@ -151,8 +152,7 @@ void Core_EigenTest_Scalar_32::run(int) void Core_EigenTest_Scalar_64::run(int) { - const size_t MATRIX_COUNT = 500; - for (size_t i = 0; i < MATRIX_COUNT; ++i) + for (int i = 0; i < ntests; ++i) { float value = cv::randu(); cv::Mat src(1, 1, CV_64FC1, Scalar::all((double)value)); @@ -163,7 +163,9 @@ void Core_EigenTest_Scalar_64::run(int) void Core_EigenTest_32::run(int) { check_full(CV_32FC1); } void Core_EigenTest_64::run(int) { check_full(CV_64FC1); } -Core_EigenTest::Core_EigenTest() : eps_val_32(1e-3f), eps_vec_32(1e-2f), eps_val_64(1e-4f), eps_vec_64(1e-3f) {} +Core_EigenTest::Core_EigenTest() +: eps_val_32(1e-3f), eps_vec_32(1e-2f), + eps_val_64(1e-4f), eps_vec_64(1e-3f), ntests(100) {} Core_EigenTest::~Core_EigenTest() {} bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index, int high_index) @@ -382,14 +384,13 @@ bool Core_EigenTest::test_values(const cv::Mat& src) bool Core_EigenTest::check_full(int type) { - const int MATRIX_COUNT = 500; const int MAX_DEGREE = 7; srand((unsigned int)time(0)); - for (int i = 1; i <= MATRIX_COUNT; ++i) + for (int i = 0; i < ntests; ++i) { - int src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE+1)*1.0)); + int src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE)+1.)); cv::Mat src(src_size, src_size, type); diff --git a/modules/core/test/test_math.cpp b/modules/core/test/test_math.cpp index a847574..94b07a6 100644 --- a/modules/core/test/test_math.cpp +++ b/modules/core/test/test_math.cpp @@ -1802,6 +1802,7 @@ Core_MatrixTest( 1, 4, false, false, 1 ), flags(0), have_u(false), have_v(false), symmetric(false), compact(false), vector_w(false) { test_case_count = 100; + max_log_array_size = 8; test_array[TEMP].push_back(NULL); test_array[TEMP].push_back(NULL); test_array[TEMP].push_back(NULL); -- 2.7.4