mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
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:
@@ -41,8 +41,7 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class Core_RotatedRectConstructorTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -72,7 +71,7 @@ int Core_RotatedRectConstructorTest::prepare_test_case( int test_case_idx )
|
||||
{
|
||||
b = Point2f( rng.uniform(-MAX_COORD_VAL, MAX_COORD_VAL), rng.uniform(-MAX_COORD_VAL, MAX_COORD_VAL) );
|
||||
}
|
||||
while( norm(a - b) <= FLT_EPSILON );
|
||||
while( cv::norm(a - b) <= FLT_EPSILON );
|
||||
Vec2f along(a - b);
|
||||
Vec2f perp = Vec2f(-along[1], along[0]);
|
||||
double d = (double) rng.uniform(1.0f, 5.0f);
|
||||
@@ -93,9 +92,9 @@ int Core_RotatedRectConstructorTest::validate_test_results( int )
|
||||
int count_match = 0;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if( norm(vertices[i] - a) <= 0.001 ) count_match++;
|
||||
else if( norm(vertices[i] - b) <= 0.001 ) count_match++;
|
||||
else if( norm(vertices[i] - c) <= 0.001 ) count_match++;
|
||||
if( cv::norm(vertices[i] - a) <= 0.001 ) count_match++;
|
||||
else if( cv::norm(vertices[i] - b) <= 0.001 ) count_match++;
|
||||
else if( cv::norm(vertices[i] - c) <= 0.001 ) count_match++;
|
||||
}
|
||||
if( count_match == 3 )
|
||||
return cvtest::TS::OK;
|
||||
@@ -105,3 +104,5 @@ int Core_RotatedRectConstructorTest::validate_test_results( int )
|
||||
}
|
||||
|
||||
TEST(Core_RotatedRect, three_point_constructor) { Core_RotatedRectConstructorTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user