Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8c4b5b6a
Commit
8c4b5b6a
authored
7 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core(test): parallel_for test with exception
parent
7dc88f26
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
test_misc.cpp
modules/core/test/test_misc.cpp
+32
-0
No files found.
modules/core/test/test_misc.cpp
View file @
8c4b5b6a
...
...
@@ -157,4 +157,36 @@ TEST(Core_Copy, repeat_regression_8972)
});
}
class
ThrowErrorParallelLoopBody
:
public
cv
::
ParallelLoopBody
{
public
:
ThrowErrorParallelLoopBody
(
cv
::
Mat
&
dst
,
int
i
)
:
dst_
(
dst
),
i_
(
i
)
{}
~
ThrowErrorParallelLoopBody
()
{}
void
operator
()(
const
cv
::
Range
&
r
)
const
{
for
(
int
i
=
r
.
start
;
i
<
r
.
end
;
i
++
)
{
CV_Assert
(
i
!=
i_
);
dst_
.
row
(
i
).
setTo
(
1
);
}
}
protected
:
Mat
dst_
;
int
i_
;
};
TEST
(
Core_Parallel
,
propagate_exceptions
)
{
Mat
dst1
(
1000
,
100
,
CV_8SC1
,
Scalar
::
all
(
0
));
ASSERT_NO_THROW
({
parallel_for_
(
cv
::
Range
(
0
,
dst1
.
rows
),
ThrowErrorParallelLoopBody
(
dst1
,
-
1
));
});
Mat
dst2
(
1000
,
100
,
CV_8SC1
,
Scalar
::
all
(
0
));
ASSERT_THROW
({
parallel_for_
(
cv
::
Range
(
0
,
dst2
.
rows
),
ThrowErrorParallelLoopBody
(
dst2
,
dst2
.
rows
/
2
));
},
cv
::
Exception
);
}
}}
// namespace
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment