Skip to content

Commit

Permalink
Merge pull request #3112 from SunBlack/modernize-use-using_test
Browse files Browse the repository at this point in the history
Use using instead of typedef [test]
  • Loading branch information
taketwo authored Jun 10, 2019
2 parents 575a9b9 + b703ec7 commit 08e01f8
Show file tree
Hide file tree
Showing 54 changed files with 384 additions and 379 deletions.
10 changes: 5 additions & 5 deletions test/common/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ TEST (PCL, PointTypes)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

template <typename T> class XYZPointTypesTest : public ::testing::Test { };
typedef ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_XYZ_POINT_TYPES)> XYZPointTypes;
using XYZPointTypes = ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_XYZ_POINT_TYPES)>;
TYPED_TEST_CASE(XYZPointTypesTest, XYZPointTypes);
TYPED_TEST(XYZPointTypesTest, GetVectorXfMap)
{
Expand All @@ -319,7 +319,7 @@ TYPED_TEST(XYZPointTypesTest, GetArrayXfMap)
}

template <typename T> class NormalPointTypesTest : public ::testing::Test { };
typedef ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_NORMAL_POINT_TYPES)> NormalPointTypes;
using NormalPointTypes = ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_NORMAL_POINT_TYPES)>;
TYPED_TEST_CASE(NormalPointTypesTest, NormalPointTypes);
TYPED_TEST(NormalPointTypesTest, GetNormalVectorXfMap)
{
Expand All @@ -331,7 +331,7 @@ TYPED_TEST(NormalPointTypesTest, GetNormalVectorXfMap)
}

template <typename T> class RGBPointTypesTest : public ::testing::Test { };
typedef ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_RGB_POINT_TYPES)> RGBPointTypes;
using RGBPointTypes = ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_RGB_POINT_TYPES)>;
TYPED_TEST_CASE(RGBPointTypesTest, RGBPointTypes);
TYPED_TEST(RGBPointTypesTest, GetRGBVectorXi)
{
Expand Down Expand Up @@ -390,7 +390,7 @@ TEST (PCL, CopyIfFieldExists)
p.r = 127; p.g = 64; p.b = 254;
p.normal_x = 1.0; p.normal_y = 0.0; p.normal_z = 0.0;

typedef pcl::traits::fieldList<PointXYZRGBNormal>::type FieldList;
using FieldList = pcl::traits::fieldList<PointXYZRGBNormal>::type;
bool is_x = false, is_y = false, is_z = false, is_rgb = false,
is_normal_x = false, is_normal_y = false, is_normal_z = false;

Expand Down Expand Up @@ -443,7 +443,7 @@ TEST (PCL, SetIfFieldExists)
p.r = p.g = p.b = 0;
p.normal_x = p.normal_y = p.normal_z = 0.0;

typedef pcl::traits::fieldList<PointXYZRGBNormal>::type FieldList;
using FieldList = pcl::traits::fieldList<PointXYZRGBNormal>::type;
pcl::for_each_type<FieldList> (SetIfFieldExists<PointXYZRGBNormal, float> (p, "x", 1.0));
EXPECT_EQ (p.x, 1.0);
pcl::for_each_type<FieldList> (SetIfFieldExists<PointXYZRGBNormal, float> (p, "y", 2.0));
Expand Down
64 changes: 32 additions & 32 deletions test/common/test_eigen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ namespace
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, InverseGeneral3x3f)
{
typedef float Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = float;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -116,9 +116,9 @@ TEST (PCL, InverseGeneral3x3f)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, InverseGeneral3x3d)
{
typedef double Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = double;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -175,9 +175,9 @@ TEST (PCL, InverseGeneral3x3d)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, InverseSymmetric3x3f)
{
typedef float Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = float;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -240,9 +240,9 @@ TEST (PCL, InverseSymmetric3x3f)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, InverseSymmetric3x3d)
{
typedef double Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = double;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -306,9 +306,9 @@ TEST (PCL, InverseSymmetric3x3d)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, Inverse2x2f)
{
typedef float Scalar;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor> CMatrix;
using Scalar = float;
using RMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -364,9 +364,9 @@ TEST (PCL, Inverse2x2f)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, Inverse2x2d)
{
typedef double Scalar;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor> CMatrix;
using Scalar = double;
using RMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor>;
RMatrix r_matrix = RMatrix::Zero ();
RMatrix r_inverse = RMatrix::Zero ();
CMatrix c_matrix = CMatrix::Zero ();
Expand Down Expand Up @@ -422,7 +422,7 @@ TEST (PCL, Inverse2x2d)
template<class Matrix>
inline void generateSymPosMatrix2x2 (Matrix& matrix)
{
typedef typename Matrix::Scalar Scalar;
using Scalar = typename Matrix::Scalar;

unsigned test_case = rand_uint (rng) % 10;

Expand Down Expand Up @@ -464,9 +464,9 @@ inline void generateSymPosMatrix2x2 (Matrix& matrix)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, eigen22d)
{
typedef double Scalar;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor> CMatrix;
using Scalar = double;
using RMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor>;
RMatrix r_matrix;
RMatrix r_vectors;
Eigen::Matrix<Scalar, 2, 1> r_eigenvalues;
Expand Down Expand Up @@ -522,9 +522,9 @@ TEST (PCL, eigen22d)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, eigen22f)
{
typedef float Scalar;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor> CMatrix;
using Scalar = float;
using RMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 2, 2, Eigen::ColMajor>;
RMatrix r_matrix;
RMatrix r_vectors;
Eigen::Matrix<Scalar, 2, 1> r_eigenvalues;
Expand Down Expand Up @@ -582,7 +582,7 @@ TEST (PCL, eigen22f)
template<class Matrix>
inline void generateSymPosMatrix3x3 (Matrix& matrix)
{
typedef typename Matrix::Scalar Scalar;
using Scalar = typename Matrix::Scalar;

// 3 equal elements != 0
// 2 equal elements none 0
Expand Down Expand Up @@ -661,9 +661,9 @@ inline void generateSymPosMatrix3x3 (Matrix& matrix)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, eigen33d)
{
typedef double Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = double;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix;
RMatrix r_vectors;
Eigen::Matrix<Scalar, 3, 1> r_eigenvalues;
Expand Down Expand Up @@ -721,9 +721,9 @@ TEST (PCL, eigen33d)
// some errors > 0.2 but less than 1% is > 1e-3 -> we will just check whether the failure rate is below 1%
TEST (PCL, eigen33f)
{
typedef float Scalar;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor> RMatrix;
typedef Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor> CMatrix;
using Scalar = float;
using RMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::RowMajor>;
using CMatrix = Eigen::Matrix<Scalar, 3, 3, Eigen::ColMajor>;
RMatrix r_matrix;
RMatrix r_vectors;
Eigen::Matrix<Scalar, 3, 1> r_eigenvalues;
Expand Down
2 changes: 1 addition & 1 deletion test/common/test_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ using namespace pcl;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T> class XYZPointTypesTest : public ::testing::Test { };
typedef ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_XYZ_POINT_TYPES)> XYZPointTypes;
using XYZPointTypes = ::testing::Types<BOOST_PP_SEQ_ENUM(PCL_XYZ_POINT_TYPES)>;
TYPED_TEST_CASE(XYZPointTypesTest, XYZPointTypes);

TYPED_TEST(XYZPointTypesTest, Distance)
Expand Down
8 changes: 4 additions & 4 deletions test/common/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
using namespace pcl;
using namespace std;

typedef PointCloud <PointXYZRGBA> CloudXYZRGBA;
typedef PointCloud <PointXYZRGB> CloudXYZRGB;
typedef PointCloud <PointXYZRGBNormal> CloudXYZRGBNormal;
typedef PointCloud <PointXYZ> CloudXYZ;
using CloudXYZRGBA = PointCloud<PointXYZRGBA>;
using CloudXYZRGB = PointCloud<PointXYZRGB>;
using CloudXYZRGBNormal = PointCloud<PointXYZRGBNormal>;
using CloudXYZ = PointCloud<PointXYZ>;

PointXYZRGBA pt_xyz_rgba, pt_xyz_rgba2;
PointXYZRGB pt_xyz_rgb;
Expand Down
11 changes: 6 additions & 5 deletions test/common/test_transforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@

using namespace pcl;

typedef ::testing::Types<Eigen::Transform<float, 3, Eigen::Affine>,
Eigen::Transform<double, 3, Eigen::Affine>,
Eigen::Matrix<float, 4, 4>,
Eigen::Matrix<double, 4,4> > TransformTypes;
using TransformTypes = ::testing::Types
<Eigen::Transform<float, 3, Eigen::Affine>,
Eigen::Transform<double, 3, Eigen::Affine>,
Eigen::Matrix<float, 4, 4>,
Eigen::Matrix<double, 4,4> >;

template <typename Transform>
class Transforms : public ::testing::Test
{
public:
typedef typename Transform::Scalar Scalar;
using Scalar = typename Transform::Scalar;

Transforms ()
: ABS_ERROR (std::numeric_limits<Scalar>::epsilon () * 10)
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_base_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_board_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ using namespace pcl::test;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_boundary_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
4 changes: 2 additions & 2 deletions test/features/test_brisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef PointXYZRGBA PointT;
typedef PointWithScale KeyPointT;
using PointT = PointXYZRGBA;
using KeyPointT = PointWithScale;


PointCloud<PointT>::Ptr cloud_image (new PointCloud<PointT>);
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_cppf_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <pcl/features/cppf.h>
#include <pcl/io/pcd_io.h>

typedef pcl::PointXYZRGBNormal PointT;
using PointT = pcl::PointXYZRGBNormal;
static pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT> ());


Expand Down
2 changes: 1 addition & 1 deletion test/features/test_curvatures_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
4 changes: 2 additions & 2 deletions test/features/test_cvfh_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
typedef PointCloud<PointXYZ>::Ptr CloudPtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;
using CloudPtr = PointCloud<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
4 changes: 2 additions & 2 deletions test/features/test_flare_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#include <pcl/io/pcd_io.h>
#include <pcl/features/flare.h>

typedef pcl::search::KdTree<pcl::PointXYZ>::Ptr KdTreePtr;
typedef pcl::PointCloud<pcl::PointXYZ>::Ptr PointCloudPtr;
using KdTreePtr = pcl::search::KdTree<pcl::PointXYZ>::Ptr;
using PointCloudPtr = pcl::PointCloud<pcl::PointXYZ>::Ptr;

PointCloudPtr cloud;
KdTreePtr tree;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_ii_normals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
using namespace pcl;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;
PointCloud<PointXYZ> cloud;
KdTreePtr tree;

Expand Down
2 changes: 1 addition & 1 deletion test/features/test_invariants_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_normal_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
13 changes: 7 additions & 6 deletions test/features/test_pfh_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
#include <pcl/features/gfpfh.h>
#include <pcl/io/pcd_io.h>

typedef pcl::PointNormal PointT;
typedef pcl::search::KdTree<PointT>::Ptr KdTreePtr;
using PointT = pcl::PointNormal;
using KdTreePtr = pcl::search::KdTree<PointT>::Ptr;
using pcl::PointCloud;

static PointCloud<PointT>::Ptr cloud (new PointCloud<PointT> ());
Expand All @@ -66,8 +66,8 @@ testIndicesAndSearchSurface (const typename PointCloud<PointT>::Ptr & points,
const boost::shared_ptr<std::vector<int> > & indices, int ndims)

{
typedef pcl::search::KdTree<PointT> KdTreeT;
typedef FeatureEstimation<PointT, NormalT, OutputT> FeatureEstimationT;
using KdTreeT = pcl::search::KdTree<PointT>;
using FeatureEstimationT = FeatureEstimation<PointT, NormalT, OutputT>;

//
// Test setIndices and setSearchSurface
Expand Down Expand Up @@ -291,8 +291,9 @@ struct FPFHTest<FPFHEstimationOMP<PointT, PointT, FPFHSignature33> >
};

// Types which will be instantiated
typedef ::testing::Types<FPFHEstimation<PointT, PointT, FPFHSignature33>,
FPFHEstimationOMP<PointT, PointT, FPFHSignature33> > FPFHEstimatorTypes;
using FPFHEstimatorTypes = ::testing::Types
<FPFHEstimation<PointT, PointT, FPFHSignature33>,
FPFHEstimationOMP<PointT, PointT, FPFHSignature33> >;
TYPED_TEST_CASE (FPFHTest, FPFHEstimatorTypes);

// This is a copy of the old FPFHEstimation test which will now
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_ppf_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace pcl;
using namespace pcl::io;
using namespace std;

typedef search::KdTree<PointXYZ>::Ptr KdTreePtr;
using KdTreePtr = search::KdTree<PointXYZ>::Ptr;

PointCloud<PointXYZ> cloud;
vector<int> indices;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_rift_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TEST (PCL, RIFTEstimation)
}

// Compute the RIFT features
typedef Histogram<32> RIFTDescriptor;
using RIFTDescriptor = Histogram<32>;
RIFTEstimation<PointXYZI, IntensityGradient, RIFTDescriptor> rift_est;
search::KdTree<PointXYZI>::Ptr treept4 (new search::KdTree<PointXYZI> (false));
rift_est.setSearchMethod (treept4);
Expand Down
Loading

0 comments on commit 08e01f8

Please sign in to comment.