trajectory-3d.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <sstream>
00003 #include <gtest/gtest.h>
00004 
00005 #include "walk_interfaces/discretized-trajectory.hh"
00006 
00007 TEST(TestTrajectory, empty)
00008 {
00009   walk::DiscretizedTrajectory3d gamma;
00010   walk::DiscretizedTrajectory3d::data_t data; // empty data.
00011   gamma.data() = data;
00012 
00013   walk::TimeDuration zero;
00014   EXPECT_EQ(zero, gamma.computeLength());
00015 }
00016 
00017 TEST(TestTrajectory, simple)
00018 {
00019   using namespace boost::posix_time;
00020 
00021   walk::DiscretizedTrajectory3d gamma;
00022   walk::DiscretizedTrajectory3d::data_t data; // empty data.
00023 
00024   data.resize(2);
00025 
00026   data[0].duration = seconds(1);
00027   data[0].position <<
00028     1., 0., 0., 1.,
00029     0., 1., 0., 2.,
00030     0., 0., 1., 3.,
00031     0., 0., 0., 1.;
00032 
00033   data[1].duration = seconds(2);
00034   data[1].position <<
00035     1., 0., 0., 5.,
00036     0., 1., 0., 10.,
00037     0., 0., 1., 15.,
00038     0., 0., 0., 1.;
00039 
00040   gamma.data() = data;
00041 
00042   walk::TimeDuration zero = seconds(1 + 2);
00043   EXPECT_EQ(zero, gamma.computeLength());
00044 
00045   std::stringstream ss;
00046   ss << gamma;
00047   EXPECT_TRUE(!ss.str().empty());
00048 }
00049 
00050 int main(int argc, char **argv)
00051 {
00052   testing::InitGoogleTest(&argc, argv);
00053   return RUN_ALL_TESTS();
00054 }


walk_interfaces
Author(s): Thomas Moulard/thomas.moulard@gmail.com, Antonio El Khoury
autogenerated on Sat Dec 28 2013 17:05:21