Permalink
Browse files

Add humanoid dynamic robot creation test.

  • Loading branch information...
1 parent 3c72990 commit e9538e7db109911674f48f6a115e0ffe6b6c6b9f Antonio El Khoury committed Oct 12, 2012
Showing with 53 additions and 0 deletions.
  1. +1 −0 tests/CMakeLists.txt
  2. +52 −0 tests/create-humanoid-dynamic-robot.cc
View
1 tests/CMakeLists.txt
@@ -31,3 +31,4 @@ ADD_TESTCASE(create-body)
ADD_TESTCASE(create-hand)
ADD_TESTCASE(create-foot)
ADD_TESTCASE(create-dynamic-robot)
+ADD_TESTCASE(create-humanoid-dynamic-robot)
View
52 tests/create-humanoid-dynamic-robot.cc
@@ -0,0 +1,52 @@
+// 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-humanoid-dynamic-robot
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+#include <ard/rbdl/tools/util.hh>
+#include <ard/rbdl/model/humanoid-dynamic-robot.hh>
+#include <ard/rbdl/model/robot-dynamics-object-factory.hh>
+
+BOOST_AUTO_TEST_CASE (create_humanoid_dynamic_robot)
+{
+ using namespace ard::rbdl;
+
+ // Create dynamic robot with defaut constructor.
+ ardHumanoidDynamicRobotShPtr_t robotDefault (new humanoidDynamicRobot_t);
+
+ BOOST_CHECK_EQUAL (!robotDefault, 0);
+
+ // Create joints from factory.
+ RobotDynamicsObjectFactory factory = RobotDynamicsObjectFactory ();
+
+ ardHumanoidDynamicRobotShPtr_t robot = factory.createHumanoidDynamicRobot ();
+
+ BOOST_CHECK_EQUAL (!robot, 0);
+
+ // Create dynamic robot with copy constructor.
+ humanoidDynamicRobotShPtr_t robotDynCast;
+ getPtrFromBase (robotDynCast, robot);
+
+ ardHumanoidDynamicRobotShPtr_t robotCopy
+ (new humanoidDynamicRobot_t (*robotDynCast));
+
+ BOOST_CHECK_EQUAL (!robotCopy, 0);
+}

0 comments on commit e9538e7

Please sign in to comment.