Skip to content

Commit f2ec7ee

Browse files
committed
Merge pull request opencv#10966 from alalek:verbose_features2d_test
2 parents e869bb6 + da6dc67 commit f2ec7ee

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

modules/features2d/test/test_nearestneighbors.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ int NearestNeighborTest::checkFind( const Mat& data )
112112
}
113113

114114
double correctPerc = correctMatches / (double)pointsCount;
115-
if (correctPerc < .75)
116-
{
117-
ts->printf( cvtest::TS::LOG, "correct_perc = %d\n", correctPerc );
118-
code = cvtest::TS::FAIL_BAD_ACCURACY;
119-
}
115+
EXPECT_GE(correctPerc, .75) << "correctMatches=" << correctMatches << " pointsCount=" << pointsCount;
120116
}
121117

122118
return code;
@@ -152,6 +148,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
152148

153149
releaseModel();
154150

151+
if (::testing::Test::HasFailure()) code = cvtest::TS::FAIL_BAD_ACCURACY;
155152
ts->set_failed_test_info( code );
156153
}
157154

@@ -201,10 +198,9 @@ int CV_FlannTest::knnSearch( Mat& points, Mat& neighbors )
201198
}
202199

203200
// compare results
204-
if( cvtest::norm( neighbors, neighbors1, NORM_L1 ) != 0 )
205-
return cvtest::TS::FAIL_BAD_ACCURACY;
201+
EXPECT_LE(cvtest::norm(neighbors, neighbors1, NORM_L1), 0);
206202

207-
return cvtest::TS::OK;
203+
return ::testing::Test::HasFailure() ? cvtest::TS::FAIL_BAD_ACCURACY : cvtest::TS::OK;
208204
}
209205

210206
int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
@@ -232,11 +228,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
232228
for( j = 0; it != indices.end(); ++it, j++ )
233229
neighbors1.at<int>(i,j) = *it;
234230
}
231+
235232
// compare results
236-
if( cvtest::norm( neighbors, neighbors1, NORM_L1 ) != 0 )
237-
return cvtest::TS::FAIL_BAD_ACCURACY;
233+
EXPECT_LE(cvtest::norm(neighbors, neighbors1, NORM_L1), 0);
238234

239-
return cvtest::TS::OK;
235+
return ::testing::Test::HasFailure() ? cvtest::TS::FAIL_BAD_ACCURACY : cvtest::TS::OK;
240236
}
241237

242238
void CV_FlannTest::releaseModel()

0 commit comments

Comments
 (0)