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

Function check_stdvector_transform

test/stdvector_overload.cpp:65–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64template<typename TransformType>
65void check_stdvector_transform(const TransformType&)
66{
67 typedef typename TransformType::MatrixType MatrixType;
68 TransformType x(MatrixType::Random()), y(MatrixType::Random());
69 std::vector<TransformType> v(10), w(20, y);
70 v[5] = x;
71 w[6] = v[5];
72 VERIFY_IS_APPROX(w[6], v[5]);
73 v = w;
74 for(int i = 0; i < 20; i++)
75 {
76 VERIFY_IS_APPROX(w[i], v[i]);
77 }
78
79 v.resize(21);
80 v[20] = x;
81 VERIFY_IS_APPROX(v[20], x);
82 v.resize(22,y);
83 VERIFY_IS_APPROX(v[21], y);
84 v.push_back(x);
85 VERIFY_IS_APPROX(v[22], x);
86 VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType));
87
88 // do a lot of push_back such that the vector gets internally resized
89 // (with memory reallocation)
90 TransformType* ref = &w[0];
91 for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)
92 v.push_back(w[i%w.size()]);
93 for(unsigned int i=23; i<v.size(); ++i)
94 {
95 VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix());
96 }
97}
98
99template<typename QuaternionType>
100void check_stdvector_quaternion(const QuaternionType&)

Callers 1

test_stdvector_overloadFunction · 0.70

Calls 4

resizeMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
matrixMethod · 0.45

Tested by 1

test_stdvector_overloadFunction · 0.56