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
93bb52c3
"src/collision_func_matrix.cpp" did not exist on "c90f59efcaae87fee65f2ff42c77f07a8dc69710"
Commit
93bb52c3
authored
5 years ago
by
Olivier Stasse
Committed by
olivier stasse
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Add real-time-tracer test.
parent
f9c7bac7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/CMakeLists.txt
+2
-0
2 additions, 0 deletions
tests/CMakeLists.txt
tests/debug-real-time-tracer.cpp
+111
-0
111 additions, 0 deletions
tests/debug-real-time-tracer.cpp
with
113 additions
and
0 deletions
tests/CMakeLists.txt
+
2
−
0
View file @
93bb52c3
...
...
@@ -59,6 +59,8 @@ DYNAMIC_GRAPH_TEST(real-time-logger)
DYNAMIC_GRAPH_TEST
(
debug-trace
)
DYNAMIC_GRAPH_TEST
(
debug-tracer
)
TARGET_LINK_LIBRARIES
(
debug-tracer tracer
)
DYNAMIC_GRAPH_TEST
(
debug-real-time-tracer
)
TARGET_LINK_LIBRARIES
(
debug-real-time-tracer tracer-real-time tracer
)
DYNAMIC_GRAPH_TEST
(
debug-logger
)
DYNAMIC_GRAPH_TEST
(
debug-logger-winit
)
DYNAMIC_GRAPH_TEST
(
signal-all
)
...
...
This diff is collapsed.
Click to expand it.
tests/debug-real-time-tracer.cpp
0 → 100644
+
111
−
0
View file @
93bb52c3
/* Copyright 2019, LAAS-CNRS
*
* Olivier Stasse
*
*/
#include
<iostream>
#include
<dynamic-graph/entity.h>
#include
<dynamic-graph/exception-factory.h>
#include
<dynamic-graph/factory.h>
#include
<dynamic-graph/pool.h>
#include
<dynamic-graph/signal-ptr.h>
#include
<dynamic-graph/signal-time-dependent.h>
#include
<dynamic-graph/tracer-real-time.h>
#define BOOST_TEST_MODULE debug - tracer
#include
<boost/test/output_test_stream.hpp>
#include
<boost/test/unit_test.hpp>
using
boost
::
test_tools
::
output_test_stream
;
namespace
dynamicgraph
{
struct
MyEntity
:
public
dynamicgraph
::
Entity
{
static
const
std
::
string
CLASS_NAME
;
dynamicgraph
::
Signal
<
double
,
int
>
m_sigdSIN
;
dynamicgraph
::
SignalTimeDependent
<
double
,
int
>
m_sigdTimeDepSOUT
;
dynamicgraph
::
SignalTimeDependent
<
double
,
int
>
m_sigdTwoTimeDepSOUT
;
MyEntity
(
const
std
::
string
&
name
)
:
Entity
(
name
),
m_sigdSIN
(
"MyEntity("
+
name
+
")::input(double)::in_double"
),
m_sigdTimeDepSOUT
(
boost
::
bind
(
&
MyEntity
::
update
,
this
,
_1
,
_2
),
m_sigdSIN
,
"MyEntity("
+
name
+
")::input(double)::out_double"
),
m_sigdTwoTimeDepSOUT
(
boost
::
bind
(
&
MyEntity
::
update
,
this
,
_1
,
_2
),
m_sigdSIN
,
"MyEntity("
+
name
+
")::input(double)::out2double"
)
{
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
)
{
const
double
&
aDouble
=
m_sigdSIN
(
inTime
);
res
=
aDouble
;
return
res
;
}
};
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
(
MyEntity
,
"MyEntity"
);
}
// namespace dynamicgraph
BOOST_AUTO_TEST_CASE
(
test_tracer
)
{
using
namespace
dynamicgraph
;
// Creates a tracer.
TracerRealTime
&
atracer
=
*
dynamic_cast
<
TracerRealTime
*>
(
FactoryStorage
::
getInstance
()
->
newEntity
(
"TracerRealTime"
,
"my-tracer"
));
Entity
&
entity
=
*
FactoryStorage
::
getInstance
()
->
newEntity
(
"MyEntity"
,
"my-entity"
);
std
::
string
rootdir
(
"/tmp"
);
std
::
string
basename
(
"my-tracer"
);
std
::
string
suffix
(
".dat"
);
/// Test openfiles
atracer
.
openFiles
(
rootdir
,
basename
,
suffix
);
/// Add trace by name
atracer
.
addSignalToTraceByName
(
"my-entity.out_double"
,
"output"
);
/// Add trace by name
SignalBase
<
int
>
&
aSignal
=
entity
.
getSignal
(
"out2double"
);
Signal
<
double
,
int
>
&
aSignalInt
=
*
(
dynamic_cast
<
Signal
<
double
,
int
>
*>
(
&
entity
.
getSignal
(
"in_double"
)));
aSignalInt
.
setConstant
(
1.5
);
atracer
.
start
();
atracer
.
trace
();
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
{
aSignal
.
setTime
(
i
);
aSignalInt
.
setTime
(
i
);
atracer
.
recordTrigger
(
i
,
i
);
}
atracer
.
stop
();
atracer
.
clearSignalToTrace
();
atracer
.
closeFiles
();
atracer
.
record
();
output_test_stream
output
;
atracer
.
display
(
output
);
BOOST_CHECK
(
output
.
is_equal
(
"TracerRealTime my-tracer [mode=pause] : "
"
\n
- Dep list:
\n
"
));
}
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