utest.cpp
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "utest.h"
37 
38 using namespace std;
39 using namespace PointMatcherSupport;
40 
41 // TODO: avoid global by using testing::Environment
42 
44 
51 
52 //---------------------------
53 // Main
54 //---------------------------
55 int main(int argc, char **argv)
56 {
57  dataPath = "";
58  for(int i=1; i < argc; i++)
59  {
60  if (strcmp(argv[i], "--path") == 0 && i+1 < argc)
61  dataPath = argv[i+1];
62  }
63 
64  if(dataPath == "")
65  {
66  cerr << "Missing the flag --path ./path/to/examples/data\n Please give the path to the test data folder which should be included with the source code. The folder is named 'examples/data'." << endl;
67  return -1;
68  }
69 
70  // Load point cloud for all test
71  ref2D = DP::load(dataPath + "2D_oneBox.csv");
72  data2D = DP::load(dataPath + "2D_twoBoxes.csv");
73  ref3D = DP::load(dataPath + "car_cloud400.csv");
74  data3D = DP::load(dataPath + "car_cloud401.csv");
75 
76  // Result of data express in ref (from visual inspection)
78  validT2d << 0.987498, 0.157629, 0.0859918,
79  -0.157629, 0.987498, 0.203247,
80  0, 0, 1;
81 
83  validT3d << 0.982304, 0.166685, -0.0854066, 0.0446816,
84  -0.150189, 0.973488, 0.172524, 0.191998,
85  0.111899, -0.156644, 0.981296, -0.0356313,
86  0, 0, 0, 1;
87 
88  testing::GTEST_FLAG(print_time) = true;
89  testing::InitGoogleTest(&argc, argv);
90  return RUN_ALL_TESTS();
91 }
92 
93 
94 
std::string dataPath
Definition: utest.cpp:43
DP data3D
Definition: utest.cpp:48
::std::string string
Definition: gtest.h:1979
PM::TransformationParameters validT3d
Definition: utest.cpp:50
Functions and classes that are not dependant on scalar type are defined in this namespace.
DP data2D
Definition: utest.cpp:46
#define GTEST_FLAG(name)
Definition: gtest.h:3016
void InitGoogleTest(int *argc, char **argv)
Definition: gtest-all.cc:6489
int main(int argc, char **argv)
Definition: utest.cpp:55
PM::TransformationParameters validT2d
Definition: utest.cpp:49
DP ref2D
Definition: utest.cpp:45
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:20057
DP ref3D
Definition: utest.cpp:47
static DataPoints load(const std::string &fileName)
Load a point cloud from a file, determine format from extension.
Matrix TransformationParameters
A matrix holding the parameters a transformation.
Definition: PointMatcher.h:182


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03