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

Function check_qtvector_transform

test/qtvector.cpp:61–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

test_qtvectorFunction · 0.85

Calls 5

fillMethod · 0.80
resizeMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
matrixMethod · 0.45

Tested by 1

test_qtvectorFunction · 0.68