Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olena
pylene
Commits
876a5afa
Commit
876a5afa
authored
Feb 04, 2019
by
Michaël Roynard
Browse files
concept check clip
parent
439304a7
Pipeline
#12901
failed with stages
in 6 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/core/image/view/clip.cpp
View file @
876a5afa
#include <
mln/core/algorithm/fill
.hpp>
#include <
helpers
.hpp>
#include <mln/core/algorithm/all_of.hpp>
#include <mln/core/algorithm/fill.hpp>
#include <mln/core/concept/new/archetype/image.hpp>
#include <mln/core/image/image2d.hpp>
#include <mln/core/image/private/image_operators.hpp>
#include <mln/core/image/view/clip.hpp>
#include <mln/core/concept/new/archetype/image.hpp>
#include <helpers.hpp>
#include <gtest/gtest.h>
...
...
@@ -36,6 +36,14 @@ TEST(View, clip)
auto
clipped
=
mln
::
view
::
clip
(
ima
,
domain
);
fill
(
clipped
,
42
);
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert
(
concepts
::
OutputImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
ViewImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
IndexableAndAccessibleImage
<
decltype
(
clipped
)
>
);
static_assert
(
not
concepts
::
BidirectionalImage
<
decltype
(
clipped
)
>
);
static_assert
(
not
concepts
::
RawImage
<
decltype
(
clipped
)
>
);
#endif // PYLENE_CONCEPT_TS_ENABLED
for
(
auto
p
:
clipped
.
domain
())
{
ASSERT_EQ
(
42
,
ima
(
p
));
...
...
@@ -63,9 +71,26 @@ TEST(View, clip_twice)
auto
A
=
mln
::
view
::
clip
(
ima
,
domain_a
);
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert
(
concepts
::
OutputImage
<
decltype
(
A
)
>
);
static_assert
(
concepts
::
ViewImage
<
decltype
(
A
)
>
);
static_assert
(
concepts
::
IndexableAndAccessibleImage
<
decltype
(
A
)
>
);
static_assert
(
not
concepts
::
BidirectionalImage
<
decltype
(
A
)
>
);
static_assert
(
not
concepts
::
RawImage
<
decltype
(
A
)
>
);
#endif // PYLENE_CONCEPT_TS_ENABLED
auto
B
=
mln
::
view
::
clip
(
A
,
domain_b
);
fill
(
B
,
42
);
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert
(
concepts
::
OutputImage
<
decltype
(
B
)
>
);
static_assert
(
concepts
::
ViewImage
<
decltype
(
B
)
>
);
static_assert
(
concepts
::
IndexableAndAccessibleImage
<
decltype
(
B
)
>
);
static_assert
(
not
concepts
::
BidirectionalImage
<
decltype
(
B
)
>
);
static_assert
(
not
concepts
::
RawImage
<
decltype
(
B
)
>
);
#endif // PYLENE_CONCEPT_TS_ENABLED
for
(
auto
p
:
B
.
domain
())
{
ASSERT_EQ
(
42
,
ima
(
p
));
...
...
@@ -88,12 +113,21 @@ TEST(View, clip_other_a_box2d)
{
5
,
42
,
42
,
8
,
9
},
//
{
10
,
11
,
12
,
13
,
14
}};
mln
::
box2d
domain
=
{{
0
,
1
},
{
2
,
3
}};
mln
::
box2d
domain
=
{{
0
,
1
},
{
2
,
3
}};
// Clip returns an 'image2d'
mln
::
image2d
<
int
>
clipped
=
mln
::
view
::
clip
(
ima
,
domain
);
fill
(
clipped
,
42
);
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert
(
concepts
::
OutputImage
<
decltype
(
clipped
)
>
);
static_assert
(
not
concepts
::
ViewImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
ConcreteImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
IndexableAndAccessibleImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
BidirectionalImage
<
decltype
(
clipped
)
>
);
static_assert
(
concepts
::
RawImage
<
decltype
(
clipped
)
>
);
#endif // PYLENE_CONCEPT_TS_ENABLED
for
(
auto
p
:
clipped
.
domain
())
{
ASSERT_EQ
(
42
,
ima
(
p
));
...
...
@@ -105,8 +139,10 @@ TEST(View, clip_other_a_box2d)
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert
(
mln
::
concepts
::
AccessibleImage
<
mln
::
clip_view
<
mln
::
archetypes
::
AccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
static_assert
(
mln
::
concepts
::
OutputImage
<
mln
::
clip_view
<
mln
::
archetypes
::
OutputAccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
static_assert
(
mln
::
concepts
::
IndexableAndAccessibleImage
<
mln
::
clip_view
<
mln
::
archetypes
::
IndexableAndAccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
static_assert
(
mln
::
concepts
::
AccessibleImage
<
mln
::
clip_view
<
mln
::
archetypes
::
AccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
static_assert
(
mln
::
concepts
::
OutputImage
<
mln
::
clip_view
<
mln
::
archetypes
::
OutputAccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
static_assert
(
mln
::
concepts
::
IndexableAndAccessibleImage
<
mln
::
clip_view
<
mln
::
archetypes
::
IndexableAndAccessibleImage
,
mln
::
archetypes
::
Domain
>>
);
#endif // PYLENE_CONCEPT_TS_ENABLED
Write
Preview
Supports
Markdown
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