1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

core: add solveLP type checks for output

to forbid Mat1f

Checks are not reliable: empty uninitialized `cv::Mat` has `CV_8UC1` type
This commit is contained in:
Alexander Alekhin
2018-09-01 14:31:15 +00:00
parent f9c8bb40b1
commit 70a27c7dd6
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -141,4 +141,14 @@ TEST(Core_LPSolver, regression_cycling){
#endif
}
TEST(Core_LPSolver, issue_12337)
{
Mat A=(cv::Mat_<double>(3,1)<<3,1,2);
Mat B=(cv::Mat_<double>(3,4)<<1,1,3,30,2,2,5,24,4,1,2,36);
EXPECT_ANY_THROW(Mat1f z_float; cv::solveLP(A, B, z_float));
EXPECT_NO_THROW(Mat1d z_double; cv::solveLP(A, B, z_double));
EXPECT_ANY_THROW(Mat1i z_int; cv::solveLP(A, B, z_int));
//need to update interface: EXPECT_ANY_THROW(Mat1b z_8u; cv::solveLP(A, B, z_8u));
}
}} // namespace