Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph
Commits
d5039779
Commit
d5039779
authored
5 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Improve coverage of signal-cast-registered.
parent
c24bc649
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/debug-real-time-tracer.cpp
+4
-8
4 additions, 8 deletions
tests/debug-real-time-tracer.cpp
tests/signal-all.cpp
+18
-0
18 additions, 0 deletions
tests/signal-all.cpp
tests/signal-cast-registerer.cpp
+9
-0
9 additions, 0 deletions
tests/signal-cast-registerer.cpp
with
31 additions
and
8 deletions
tests/debug-real-time-tracer.cpp
+
4
−
8
View file @
d5039779
...
@@ -42,12 +42,6 @@ struct MyEntity : public dynamicgraph::Entity {
...
@@ -42,12 +42,6 @@ struct MyEntity : public dynamicgraph::Entity {
signalRegistration
(
m_sigdSIN
<<
m_sigdTimeDepSOUT
<<
m_sigdTwoTimeDepSOUT
);
signalRegistration
(
m_sigdSIN
<<
m_sigdTimeDepSOUT
<<
m_sigdTwoTimeDepSOUT
);
}
}
virtual
void
display
(
std
::
ostream
&
os
)
const
{
os
<<
"Hello! My name is "
<<
getName
()
<<
" !"
<<
std
::
endl
;
}
virtual
const
std
::
string
&
getClassName
()
const
{
return
CLASS_NAME
;
}
double
&
update
(
double
&
res
,
const
int
&
inTime
)
{
double
&
update
(
double
&
res
,
const
int
&
inTime
)
{
const
double
&
aDouble
=
m_sigdSIN
(
inTime
);
const
double
&
aDouble
=
m_sigdSIN
(
inTime
);
res
=
aDouble
;
res
=
aDouble
;
...
@@ -64,8 +58,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
...
@@ -64,8 +58,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
TracerRealTime
&
atracer
=
*
dynamic_cast
<
TracerRealTime
*>
(
TracerRealTime
&
atracer
=
*
dynamic_cast
<
TracerRealTime
*>
(
FactoryStorage
::
getInstance
()
->
newEntity
(
"TracerRealTime"
,
"my-tracer"
));
FactoryStorage
::
getInstance
()
->
newEntity
(
"TracerRealTime"
,
"my-tracer"
));
Entity
&
entity
=
My
Entity
&
entity
=
*
dynamic_cast
<
MyEntity
*>
(
*
FactoryStorage
::
getInstance
()
->
newEntity
(
"MyEntity"
,
"my-entity"
);
FactoryStorage
::
getInstance
()
->
newEntity
(
"MyEntity"
,
"my-entity"
)
)
;
std
::
string
rootdir
(
"/tmp"
);
std
::
string
rootdir
(
"/tmp"
);
std
::
string
basename
(
"my-tracer"
);
std
::
string
basename
(
"my-tracer"
);
...
@@ -80,6 +74,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
...
@@ -80,6 +74,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
/// Add trace by name
/// Add trace by name
SignalBase
<
int
>
&
aSignal
=
entity
.
getSignal
(
"out2double"
);
SignalBase
<
int
>
&
aSignal
=
entity
.
getSignal
(
"out2double"
);
entity
.
m_sigdTwoTimeDepSOUT
.
recompute
(
2
);
Signal
<
double
,
int
>
&
aSignalInt
=
Signal
<
double
,
int
>
&
aSignalInt
=
*
(
dynamic_cast
<
Signal
<
double
,
int
>
*>
(
&
entity
.
getSignal
(
"in_double"
)));
*
(
dynamic_cast
<
Signal
<
double
,
int
>
*>
(
&
entity
.
getSignal
(
"in_double"
)));
...
...
This diff is collapsed.
Click to expand it.
tests/signal-all.cpp
+
18
−
0
View file @
d5039779
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
<assert.h>
#include
<assert.h>
#include
<boost/test/output_test_stream.hpp>
#include
<boost/test/output_test_stream.hpp>
#include
<boost/test/unit_test.hpp>
#include
<boost/test/unit_test.hpp>
#include
<iostream>
#define BOOST_TEST_MODULE signal_array
#define BOOST_TEST_MODULE signal_array
...
@@ -196,3 +197,20 @@ BOOST_AUTO_TEST_CASE(test_cast_helper) {
...
@@ -196,3 +197,20 @@ BOOST_AUTO_TEST_CASE(test_cast_helper) {
DefaultCastRegisterer
<
std
::
string
>
defaultSR
;
DefaultCastRegisterer
<
std
::
string
>
defaultSR
;
boost
::
any
aTest
=
defaultSR
.
cast
(
aiss
);
boost
::
any
aTest
=
defaultSR
.
cast
(
aiss
);
}
}
BOOST_AUTO_TEST_CASE
(
signal_caster_basics
)
{
/// Get the singleton on registered types.
SignalCaster
*
asig_caster
=
SignalCaster
::
getInstance
();
/// List the registered types.
std
::
vector
<
std
::
string
>
amap
=
asig_caster
->
listTypenames
();
for
(
std
::
vector
<
std
::
string
>::
iterator
it
=
amap
.
begin
();
it
!=
amap
.
end
();
++
it
)
std
::
cout
<<
"signal_caster:listTypename: "
<<
*
it
<<
std
::
endl
;
/// Unregister a type
asig_caster
->
unregisterCast
(
typeid
(
double
));
asig_caster
->
destroy
();
BOOST_CHECK
(
true
);
}
This diff is collapsed.
Click to expand it.
tests/signal-cast-registerer.cpp
+
9
−
0
View file @
d5039779
...
@@ -139,6 +139,15 @@ BOOST_AUTO_TEST_CASE(standard_double_registerer) {
...
@@ -139,6 +139,15 @@ BOOST_AUTO_TEST_CASE(standard_double_registerer) {
BOOST_AUTO_TEST_CASE
(
custom_vector_registerer
)
{
BOOST_AUTO_TEST_CASE
(
custom_vector_registerer
)
{
dynamicgraph
::
Signal
<
dynamicgraph
::
Vector
,
int
>
myVectorSignal
(
"vector"
);
dynamicgraph
::
Signal
<
dynamicgraph
::
Vector
,
int
>
myVectorSignal
(
"vector"
);
/// Create a second local vector registerer to generate an exception.
bool
res
=
false
;
try
{
EigenCastRegisterer_V
myVectorCast2
;
}
catch
(
const
ExceptionSignal
&
aes
)
{
res
=
(
aes
.
getCode
()
==
ExceptionSignal
::
GENERIC
);
}
// BOOST_CHECK(res);
// Print the signal name.
// Print the signal name.
{
{
output_test_stream
output
;
output_test_stream
output
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment