Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
alta
alta
Commits
0318c022
Commit
0318c022
authored
Feb 14, 2017
by
Ludovic Courtès
Browse files
core: Test 'load_data_from_text' filtering using the vector syntax.
parent
8c90c23b
Changes
1
Hide whitespace changes
Inline
Side-by-side
sources/tests/core/data-io.cpp
View file @
0318c022
...
...
@@ -123,6 +123,37 @@ static void test_simple_load_from_text_filtering()
TEST_ASSERT
(
data
->
get
(
1
)
==
Eigen
::
Vector4d
(
2.
,
7.
,
8.
,
9.
));
}
// Likewise, but using the vector syntax for boundaries.
static
void
test_simple_load_from_text_filtering_vectors
()
{
static
const
char
example
[]
=
"\
#DIM 1 3f
\n
\
#VS 0
\n
\
#PARAM_IN COS_TH
\n
\
#PARAM_OUT RGB_COLOR
\n
\
-1 4 4 4
\n
\
0 1 2 3
\n
\
1 4 5 6
\n
\
2 7 8 9
\n
\
3 10 11 12
\n
\
4 7 7 7
\n
"
;
std
::
istringstream
input
(
example
);
arguments
args
=
{
{
"ymin"
,
"[ 4, 5, 6 ]"
},
{
"max"
,
"[ 3 ]"
}
};
auto
data
=
plugins_manager
::
load_data
(
"vertical_segment"
,
input
,
args
);
TEST_ASSERT
(
data
!=
NULL
);
// There should be only 3 elements left after filtering.
TEST_ASSERT
(
data
->
size
()
==
3
);
TEST_ASSERT
(
data
->
get
(
0
)
==
Eigen
::
Vector4d
(
1.
,
4.
,
5.
,
6.
));
TEST_ASSERT
(
data
->
get
(
1
)
==
Eigen
::
Vector4d
(
2.
,
7.
,
8.
,
9.
));
TEST_ASSERT
(
data
->
get
(
2
)
==
Eigen
::
Vector4d
(
3.
,
10.
,
11.
,
12.
));
}
// Files that are automatically deleted upon destruction.
class
temporary_file
{
...
...
@@ -205,6 +236,7 @@ int main(int argc, char** argv)
// Simple tests first.
test_simple_load_from_text
();
test_simple_load_from_text_filtering
();
test_simple_load_from_text_filtering_vectors
();
// Try a sequence of loads and saves.
try
...
...
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