Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99bb3e2

Browse files
committed
QuatExpMap test: Move the test data into the functions.
Try to fix GCC 4.8 on Travis.
1 parent9ae07b6 commit99bb3e2

File tree

1 file changed

+65
-83
lines changed

1 file changed

+65
-83
lines changed

‎tests/cplusplus/Util/QuatExpMap.cpp‎

Lines changed: 65 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -155,39 +155,6 @@ static inline ::std::ostream &operator<<(::std::ostream &os,
155155
staticconst Vector3d Vec3dZero = Vector3d::Zero();
156156

157157
/* Tests that take a unit quat as input*/
158-
staticconstauto BasicQuats = {
159-
QuatCreator::Identity(),
160-
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitX()),
161-
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitY()),
162-
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitZ()),
163-
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitX()),
164-
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitY()),
165-
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitZ())};
166-
167-
staticconstauto SmallQuats = {
168-
QuatCreator::AngleAxis(SMALL,Vector3d::UnitX()),
169-
QuatCreator::AngleAxis(SMALL,Vector3d::UnitY()),
170-
QuatCreator::AngleAxis(SMALL,Vector3d::UnitZ()),
171-
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitX()),
172-
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitY()),
173-
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitZ())};
174-
staticconstauto SmallNegativeQuats = {
175-
QuatCreator::AngleAxis(-SMALL,Vector3d::UnitX()),
176-
QuatCreator::AngleAxis(-SMALL,Vector3d::UnitY()),
177-
QuatCreator::AngleAxis(-SMALL,Vector3d::UnitZ()),
178-
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitX()),
179-
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitY()),
180-
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitZ())};
181-
182-
#if0
183-
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitX()),
184-
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitY()),
185-
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitZ()),
186-
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitX()),
187-
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitY()),
188-
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitZ()),
189-
#endif
190-
191158
TEST_CASE("UnitQuatInput") {
192159
constauto doTests = [](QuatCreatorconst &qCreator) {
193160
CAPTURE(qCreator);
@@ -221,37 +188,48 @@ TEST_CASE("UnitQuatInput") {
221188
#endif// HAVE_QUATLIB
222189
};
223190
SECTION("Basic quats") {
224-
auto quatCreator =GENERATE(values(BasicQuats));
191+
auto quatCreator =GENERATE(
192+
values({QuatCreator::Identity(),
193+
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitX()),
194+
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitY()),
195+
QuatCreator::AngleAxis(EIGEN_PI /2,Vector3d::UnitZ()),
196+
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitX()),
197+
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitY()),
198+
QuatCreator::AngleAxis(-EIGEN_PI /2,Vector3d::UnitZ())}));
225199
doTests(quatCreator);
226200
}
227201
SECTION("Small quats") {
228-
auto quatCreator =GENERATE(values(SmallQuats));
202+
auto quatCreator =GENERATE(
203+
values({QuatCreator::AngleAxis(SMALL,Vector3d::UnitX()),
204+
QuatCreator::AngleAxis(SMALL,Vector3d::UnitY()),
205+
QuatCreator::AngleAxis(SMALL,Vector3d::UnitZ()),
206+
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitX()),
207+
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitY()),
208+
QuatCreator::AngleAxis(SMALLER,Vector3d::UnitZ())}));
229209
doTests(quatCreator);
230210
}
231211
SECTION("Small negative quats") {
232-
auto quatCreator =GENERATE(values(SmallNegativeQuats));
212+
auto quatCreator =GENERATE(
213+
values({QuatCreator::AngleAxis(-SMALL,Vector3d::UnitX()),
214+
QuatCreator::AngleAxis(-SMALL,Vector3d::UnitY()),
215+
QuatCreator::AngleAxis(-SMALL,Vector3d::UnitZ()),
216+
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitX()),
217+
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitY()),
218+
QuatCreator::AngleAxis(-SMALLER,Vector3d::UnitZ())}));
233219
doTests(quatCreator);
234220
}
221+
222+
#if0
223+
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitX()),
224+
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitY()),
225+
QuatCreator::AngleAxis(EIGEN_PI, Vector3d::UnitZ()),
226+
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitX()),
227+
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitY()),
228+
QuatCreator::AngleAxis(3 * EIGEN_PI / 2, Vector3d::UnitZ()),
229+
#endif
235230
}
236231

237232
/* Tests that take a rotation vector as input*/
238-
staticconst std::initializer_list<Vector3d> BasicVecs = {
239-
Vector3d::Zero(),
240-
Vector3d(EIGEN_PI /2,0,0),
241-
Vector3d(0, EIGEN_PI /2,0),
242-
Vector3d(0,0, EIGEN_PI /2),
243-
Vector3d(-EIGEN_PI /2,0,0),
244-
Vector3d(0, -EIGEN_PI /2,0),
245-
Vector3d(0,0, -EIGEN_PI /2)};
246-
staticconst std::initializer_list<Vector3d> SmallVecs = {
247-
Vector3d(SMALL,0,0),Vector3d(0, SMALL,0),Vector3d(0,0, SMALL),
248-
Vector3d(SMALLER,0,0),Vector3d(0, SMALLER,0),Vector3d(0,0, SMALLER)};
249-
250-
staticconst std::initializer_list<Vector3d> SmallNegativeVecs = {
251-
Vector3d(-SMALL,0,0),Vector3d(0, -SMALL,0),
252-
Vector3d(0,0, -SMALL),Vector3d(-SMALLER,0,0),
253-
Vector3d(0, -SMALLER,0),Vector3d(0,0, -SMALLER)};
254-
255233
TEST_CASE("ExpMapVecInput") {
256234
constauto doTests = [](Vector3dconst &v) {
257235
CAPTURE(v);
@@ -284,15 +262,25 @@ TEST_CASE("ExpMapVecInput") {
284262
#endif// HAVE_QUATLIB
285263
};
286264
SECTION("BasicVecs") {
287-
Vector3d v =GENERATE(values(BasicVecs));
265+
Vector3d v =GENERATE(values(
266+
{Vector3d(Vector3d::Zero()),Vector3d(EIGEN_PI /2,0,0),
267+
Vector3d(0, EIGEN_PI /2,0),Vector3d(0,0, EIGEN_PI /2),
268+
Vector3d(-EIGEN_PI /2,0,0),Vector3d(0, -EIGEN_PI /2,0),
269+
Vector3d(0,0, -EIGEN_PI /2)}));
288270
doTests(v);
289271
}
290272
SECTION("SmallVecs") {
291-
Vector3d v =GENERATE(values(SmallVecs));
273+
Vector3d v =GENERATE(
274+
values({Vector3d(SMALL,0,0),Vector3d(0, SMALL,0),
275+
Vector3d(0,0, SMALL),Vector3d(SMALLER,0,0),
276+
Vector3d(0, SMALLER,0),Vector3d(0,0, SMALLER)}));
292277
doTests(v);
293278
}
294279
SECTION("SmallNegativeVecs") {
295-
Vector3d v =GENERATE(values(SmallNegativeVecs));
280+
Vector3d v =GENERATE(
281+
values({Vector3d(-SMALL,0,0),Vector3d(0, -SMALL,0),
282+
Vector3d(0,0, -SMALL),Vector3d(-SMALLER,0,0),
283+
Vector3d(0, -SMALLER,0),Vector3d(0,0, -SMALLER)}));
296284
doTests(v);
297285
}
298286
}
@@ -307,30 +295,6 @@ TEST_CASE("SimpleEquivalencies-Exp") {
307295
}
308296

309297
/* Tests that take a pair of equivalent quaternion and vector as input*/
310-
staticconstauto HalfPiMultiples = {
311-
makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitX()),
312-
makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitY()),
313-
makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitZ()),
314-
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitX()),
315-
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitY()),
316-
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitZ())};
317-
318-
staticconstauto SmallEquivalentValues = {
319-
makePairFromAngleAxis(SMALL,Vector3d::UnitX()),
320-
makePairFromAngleAxis(SMALL,Vector3d::UnitY()),
321-
makePairFromAngleAxis(SMALL,Vector3d::UnitZ()),
322-
makePairFromAngleAxis(SMALLER,Vector3d::UnitX()),
323-
makePairFromAngleAxis(SMALLER,Vector3d::UnitY()),
324-
makePairFromAngleAxis(SMALLER,Vector3d::UnitZ())};
325-
326-
staticconstauto SmallNegativeEquivalentValues = {
327-
makePairFromAngleAxis(-SMALL,Vector3d::UnitX()),
328-
makePairFromAngleAxis(-SMALL,Vector3d::UnitY()),
329-
makePairFromAngleAxis(-SMALL,Vector3d::UnitZ()),
330-
makePairFromAngleAxis(-SMALLER,Vector3d::UnitX()),
331-
makePairFromAngleAxis(-SMALLER,Vector3d::UnitY()),
332-
makePairFromAngleAxis(-SMALLER,Vector3d::UnitZ())};
333-
334298
TEST_CASE("EquivalentInput") {
335299
constauto doTests = [](QuatCreatorconst &qCreator, Vector3dconst &v) {
336300
CAPTURE(v);
@@ -360,15 +324,33 @@ TEST_CASE("EquivalentInput") {
360324
#endif// HAVE_QUATLIB
361325
};
362326
SECTION("HalfPiMultiples") {
363-
QuatVecPair qvp =GENERATE(values(HalfPiMultiples));
327+
QuatVecPair qvp =GENERATE(
328+
values({makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitX()),
329+
makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitY()),
330+
makePairFromAngleAxis(EIGEN_PI /2,Vector3d::UnitZ()),
331+
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitX()),
332+
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitY()),
333+
makePairFromAngleAxis(-EIGEN_PI /2,Vector3d::UnitZ())}));
364334
doTests(qvp.first, qvp.second);
365335
}
366336
SECTION("SmallEquivalentValues") {
367-
QuatVecPair qvp =GENERATE(values(SmallEquivalentValues));
337+
QuatVecPair qvp =GENERATE(
338+
values({makePairFromAngleAxis(SMALL,Vector3d::UnitX()),
339+
makePairFromAngleAxis(SMALL,Vector3d::UnitY()),
340+
makePairFromAngleAxis(SMALL,Vector3d::UnitZ()),
341+
makePairFromAngleAxis(SMALLER,Vector3d::UnitX()),
342+
makePairFromAngleAxis(SMALLER,Vector3d::UnitY()),
343+
makePairFromAngleAxis(SMALLER,Vector3d::UnitZ())}));
368344
doTests(qvp.first, qvp.second);
369345
}
370346
SECTION("SmallNegativeVecs") {
371-
QuatVecPair qvp =GENERATE(values(SmallNegativeEquivalentValues));
347+
QuatVecPair qvp =GENERATE(
348+
values({makePairFromAngleAxis(-SMALL,Vector3d::UnitX()),
349+
makePairFromAngleAxis(-SMALL,Vector3d::UnitY()),
350+
makePairFromAngleAxis(-SMALL,Vector3d::UnitZ()),
351+
makePairFromAngleAxis(-SMALLER,Vector3d::UnitX()),
352+
makePairFromAngleAxis(-SMALLER,Vector3d::UnitY()),
353+
makePairFromAngleAxis(-SMALLER,Vector3d::UnitZ())}));
372354
doTests(qvp.first, qvp.second);
373355
}
374356
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp