GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/* |
||
2 |
* Copyright 2010, |
||
3 |
* François Bleibel, |
||
4 |
* Olivier Stasse, |
||
5 |
* |
||
6 |
* CNRS/AIST |
||
7 |
* |
||
8 |
*/ |
||
9 |
|||
10 |
/* -------------------------------------------------------------------------- */ |
||
11 |
/* --- INCLUDES ------------------------------------------------------------- */ |
||
12 |
/* -------------------------------------------------------------------------- */ |
||
13 |
#include <dynamic-graph/all-signals.h> |
||
14 |
#include <dynamic-graph/linear-algebra.h> |
||
15 |
|||
16 |
#include <iostream> |
||
17 |
using namespace std; |
||
18 |
using namespace dynamicgraph; |
||
19 |
|||
20 |
class DummyClass { |
||
21 |
public: |
||
22 |
2 |
dynamicgraph::Vector &fun(dynamicgraph::Vector &res, double j) { |
|
23 |
2 |
res.resize(3); |
|
24 |
2 |
res.fill(j); |
|
25 |
2 |
return res; |
|
26 |
} |
||
27 |
}; |
||
28 |
|||
29 |
dynamicgraph::Vector test_data(6); |
||
30 |
Signal<dynamicgraph::Vector, double> sig("sigtest"); |
||
31 |
DummyClass dummy; |
||
32 |
|||
33 |
2 |
dynamicgraph::Vector &fun(dynamicgraph::Vector &res, double /*j*/) { |
|
34 |
2 |
return res = test_data; |
|
35 |
} |
||
36 |
|||
37 |
1 |
int main(void) { |
|
38 |
✓✗ | 1 |
test_data.fill(1); |
39 |
1 |
cout << "test_data: " << test_data << endl; |
|
40 |
|||
41 |
1 |
sig.setConstant(test_data); |
|
42 |
✓✗✓✗ ✓✗ |
1 |
cout << "Constant: " << sig.access(1.) << endl; |
43 |
✓✗ | 1 |
test_data *= 2; |
44 |
✓✗✓✗ ✓✗ |
1 |
cout << "Constant: " << sig(1.) << endl; |
45 |
|||
46 |
1 |
sig.setReference(&test_data); |
|
47 |
✓✗✓✗ ✓✗ |
1 |
cout << "Reference: " << sig(1.) << endl; |
48 |
✓✗ | 1 |
test_data *= 2; |
49 |
✓✗✓✗ ✓✗ |
1 |
cout << "Reference: " << sig(1.) << endl; |
50 |
|||
51 |
✓✗ | 1 |
sig.setFunction(&fun); |
52 |
✓✗✓✗ ✓✗ |
1 |
cout << "Function: " << sig(1.) << endl; |
53 |
✓✗ | 1 |
test_data *= 2; |
54 |
✓✗✓✗ ✓✗ |
1 |
cout << "Function: " << sig(1.) << endl; |
55 |
|||
56 |
// boost::function2<int,int,double> onClick = (&DummyClass::fun, &dummy, |
||
57 |
// _1,_2) ; boost::function<> onClick = boost::bind(&DummyClass::fun, |
||
58 |
// &dummy); |
||
59 |
✓✗ | 1 |
sig.setFunction(boost::bind(&DummyClass::fun, &dummy, _1, _2)); |
60 |
✓✗✓✗ ✓✗ |
1 |
cout << "Function: " << sig(1.5) << endl; |
61 |
✓✗ | 1 |
test_data *= 2; |
62 |
✓✗✓✗ ✓✗ |
1 |
cout << "Function: " << sig(1.34) << endl; |
63 |
|||
64 |
// sig.setFunction(&DummyClass::fun, dummy); |
||
65 |
// cout << "Function: " << sig(1.5) <<endl; |
||
66 |
// test_data*=2; |
||
67 |
// cout << "Function: " << sig(12.34) <<endl; |
||
68 |
|||
69 |
1 |
return 0; |
|
70 |
} |
Generated by: GCOVR (Version 4.2) |