Directory: | ./ |
---|---|
File: | tests/traces/test_traces.cpp |
Date: | 2024-08-13 12:13:25 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 24 | 24 | 100.0% |
Branches: | 30 | 60 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright 2010, | ||
3 | * François Bleibel, | ||
4 | * Olivier Stasse, | ||
5 | * | ||
6 | * CNRS/AIST | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #include <dynamic-graph/linear-algebra.h> | ||
11 | #include <dynamic-graph/signal-base.h> | ||
12 | #include <dynamic-graph/signal-time-dependent.h> | ||
13 | #include <dynamic-graph/signal.h> | ||
14 | #include <dynamic-graph/tracer.h> | ||
15 | |||
16 | #include <iostream> | ||
17 | #include <sot/core/debug.hh> | ||
18 | |||
19 | using namespace std; | ||
20 | using namespace dynamicgraph; | ||
21 | using namespace dynamicgraph::sot; | ||
22 | |||
23 | 1 | double &f(double &res, const int & /*t*/) { | |
24 | 1 | cout << "SIGM!" << endl; | |
25 | 1 | return res; | |
26 | } | ||
27 | |||
28 | 1 | int main() { | |
29 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
2 | Signal<Vector, int> sig1("sig1"); |
30 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Vector v1(2); |
31 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | v1.fill(1.1); |
32 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | sig1 = v1; |
33 | |||
34 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
2 | Signal<Vector, int> sig2("sig2"); |
35 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Vector v2(4); |
36 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | v2.fill(2.); |
37 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | sig2 = v2; |
38 | |||
39 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
2 | Signal<Vector, int> sig3("sig3"); |
40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Vector v3(6); |
41 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | v3.fill(3.); |
42 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | sig3 = v3; |
43 | |||
44 |
3/6✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
2 | SignalTimeDependent<double, int> sigM(f, sotNOSIGNAL, "sigM"); |
45 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | sigM.access(0); |
46 | |||
47 |
3/6✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | Tracer *tracer = new Tracer("trace"); |
48 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | tracer->addSignalToTrace(sig1); |
49 |
4/8✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
|
1 | tracer->openFiles("/tmp/sot-core", "tr_", ".dat"); |
50 | |||
51 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | tracer->addSignalToTrace(sig2); |
52 | |||
53 | 1 | return 0; | |
54 | 1 | } | |
55 |