@@ -112,11 +112,7 @@ int NearestNeighborTest::checkFind( const Mat& data )
112
112
}
113
113
114
114
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;
120
116
}
121
117
122
118
return code;
@@ -152,6 +148,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
152
148
153
149
releaseModel ();
154
150
151
+ if (::testing::Test::HasFailure ()) code = cvtest::TS::FAIL_BAD_ACCURACY;
155
152
ts->set_failed_test_info ( code );
156
153
}
157
154
@@ -201,10 +198,9 @@ int CV_FlannTest::knnSearch( Mat& points, Mat& neighbors )
201
198
}
202
199
203
200
// 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 );
206
202
207
- return cvtest::TS::OK;
203
+ return :: testing::Test::HasFailure () ? cvtest::TS::FAIL_BAD_ACCURACY : cvtest::TS::OK;
208
204
}
209
205
210
206
int CV_FlannTest::radiusSearch ( Mat& points, Mat& neighbors )
@@ -232,11 +228,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
232
228
for ( j = 0 ; it != indices.end (); ++it, j++ )
233
229
neighbors1.at <int >(i,j) = *it;
234
230
}
231
+
235
232
// 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 );
238
234
239
- return cvtest::TS::OK;
235
+ return :: testing::Test::HasFailure () ? cvtest::TS::FAIL_BAD_ACCURACY : cvtest::TS::OK;
240
236
}
241
237
242
238
void CV_FlannTest::releaseModel ()
0 commit comments