/
create-foot.cc
70 lines (51 loc) · 2.03 KB
/
create-foot.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2012 by Antonio El Khoury.
//
// This file is part of the ard-rbdl.
//
// ard-rbdl is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// ard-rbdl is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with ard-rbdl. If not, see
// <http://www.gnu.org/licenses/>.
#define BOOST_TEST_MODULE create-foot
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>
#include <ard/rbdl/tools/pointer-util.hh>
#include <ard/rbdl/model/foot.hh>
#include <ard/rbdl/model/robot-dynamics-object-factory.hh>
BOOST_AUTO_TEST_CASE (create_foot)
{
using namespace ard::rbdl;
// Create foot with default constructor.
ardFootShPtr_t foot (new foot_t);
BOOST_CHECK_EQUAL (!foot, 0);
// Create foot using constructor with ard joint.
ardJointShPtr_t joint1 (new joint_t);
ardFootShPtr_t foot1 (new foot_t (joint1));
BOOST_CHECK_EQUAL (!foot1, 0);
// Create foot using constructor with joint.
jointShPtr_t joint2 (new joint_t);
ardFootShPtr_t foot2 (new foot_t (joint2));
BOOST_CHECK_EQUAL (!foot2, 0);
// Create foot from factory.
RobotDynamicsObjectFactory factory = RobotDynamicsObjectFactory ();
ardFootShPtr_t footFromFactory = factory.createFoot (joint1);
BOOST_CHECK_EQUAL (!footFromFactory, 0);
// Create foot with copy constructor.
footShPtr_t footDynCast;
getPtrFromBase (footDynCast, foot);
ardFootShPtr_t footCopy (new foot_t (*footDynCast));
BOOST_CHECK_EQUAL (!footCopy, 0);
// Create foot by assignment.
foot_t footAssigned = *footDynCast;
// Check self-assignment.
footAssigned = footAssigned;
}