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

Function check_stdlist_quaternion

test/stdlist.cpp:77–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76template<typename QuaternionType>
77void check_stdlist_quaternion(const QuaternionType&)
78{
79 typedef typename QuaternionType::Coefficients Coefficients;
80 QuaternionType x(Coefficients::Random()), y(Coefficients::Random());
81 std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> > v(10), w(20, y);
82 v.front() = x;
83 w.front() = w.back();
84 VERIFY_IS_APPROX(w.front(), w.back());
85 v = w;
86
87 typename std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator vi = v.begin();
88 typename std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator wi = w.begin();
89 for(int i = 0; i < 20; i++)
90 {
91 VERIFY_IS_APPROX(*vi, *wi);
92 ++vi;
93 ++wi;
94 }
95
96 v.resize(21);
97 v.back() = x;
98 VERIFY_IS_APPROX(v.back(), x);
99 v.resize(22,y);
100 VERIFY_IS_APPROX(v.back(), y);
101 v.push_back(x);
102 VERIFY_IS_APPROX(v.back(), x);
103}
104
105void test_stdlist()
106{

Callers 1

test_stdlistFunction · 0.70

Calls 3

beginMethod · 0.80
resizeMethod · 0.45
push_backMethod · 0.45

Tested by 1

test_stdlistFunction · 0.56