MCPcopy Create free account
hub / github.com/PX4/eigen / check_stdlist_transform

Function check_stdlist_transform

test/stdlist_overload.cpp:86–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84
85template<typename TransformType>
86void check_stdlist_transform(const TransformType&)
87{
88 typedef typename TransformType::MatrixType MatrixType;
89 TransformType x(MatrixType::Random()), y(MatrixType::Random());
90 std::list<TransformType> v(10), w(20, y);
91 typename std::list<TransformType>::iterator itv = get(v, 5);
92 typename std::list<TransformType>::iterator itw = get(w, 6);
93 *itv = x;
94 *itw = *itv;
95 VERIFY_IS_APPROX(*itw, *itv);
96 v = w;
97 itv = v.begin();
98 itw = w.begin();
99 for(int i = 0; i < 20; i++)
100 {
101 VERIFY_IS_APPROX(*itw, *itv);
102 ++itv;
103 ++itw;
104 }
105
106 v.resize(21);
107 set(v, 20, x);
108 VERIFY_IS_APPROX(*get(v, 20), x);
109 v.resize(22,y);
110 VERIFY_IS_APPROX(*get(v, 21), y);
111 v.push_back(x);
112 VERIFY_IS_APPROX(*get(v, 22), x);
113
114 // do a lot of push_back such that the list gets internally resized
115 // (with memory reallocation)
116 TransformType* ref = &(*get(w, 0));
117 for(int i=0; i<30 || ((ref==&(*get(w, 0))) && i<300); ++i)
118 v.push_back(*get(w, i%w.size()));
119 for(unsigned int i=23; i<v.size(); ++i)
120 {
121 VERIFY(get(v, i)->matrix()==get(w, (i-23)%w.size())->matrix());
122 }
123}
124
125template<typename QuaternionType>
126void check_stdlist_quaternion(const QuaternionType&)

Callers 1

test_stdlist_overloadFunction · 0.70

Calls 7

beginMethod · 0.80
getFunction · 0.70
setFunction · 0.70
resizeMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
matrixMethod · 0.45

Tested by 1

test_stdlist_overloadFunction · 0.56