Skip to content

Commit c6d1aa2

Browse files
Merge pull request #4173 from haritha-j/indicesTestCommon
[test] Replace usage of `std::vector<int>` with `Indices` in common module tests
2 parents f4b5570 + c0f23bb commit c6d1aa2

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

test/common/test_centroid.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pcl::PCLPointCloud2 cloud_blob;
5858
TEST (PCL, compute3DCentroidFloat)
5959
{
6060
pcl::PointIndices pindices;
61-
std::vector<int> indices;
61+
Indices indices;
6262
PointXYZ point;
6363
PointCloud<PointXYZ> cloud;
6464
Eigen::Vector4f centroid;
@@ -164,7 +164,7 @@ TEST (PCL, compute3DCentroidFloat)
164164
TEST (PCL, compute3DCentroidDouble)
165165
{
166166
pcl::PointIndices pindices;
167-
std::vector<int> indices;
167+
Indices indices;
168168
PointXYZ point;
169169
PointCloud<PointXYZ> cloud;
170170
Eigen::Vector4d centroid;
@@ -269,7 +269,7 @@ TEST (PCL, compute3DCentroidDouble)
269269
TEST (PCL, compute3DCentroidCloudIterator)
270270
{
271271
pcl::PointIndices pindices;
272-
std::vector<int> indices;
272+
Indices indices;
273273
PointXYZ point;
274274
PointCloud<PointXYZ> cloud;
275275
Eigen::Vector4f centroid_f;
@@ -333,7 +333,7 @@ TEST (PCL, computeCovarianceMatrix)
333333
{
334334
PointCloud<PointXYZ> cloud;
335335
PointXYZ point;
336-
std::vector <int> indices;
336+
Indices indices;
337337
Eigen::Vector4f centroid;
338338
Eigen::Matrix3f covariance_matrix;
339339

@@ -449,7 +449,7 @@ TEST (PCL, computeCovarianceMatrixNormalized)
449449
{
450450
PointCloud<PointXYZ> cloud;
451451
PointXYZ point;
452-
std::vector <int> indices;
452+
Indices indices;
453453
Eigen::Vector4f centroid;
454454
Eigen::Matrix3f covariance_matrix;
455455

@@ -567,7 +567,7 @@ TEST (PCL, computeDemeanedCovariance)
567567
{
568568
PointCloud<PointXYZ> cloud;
569569
PointXYZ point;
570-
std::vector <int> indices;
570+
Indices indices;
571571
Eigen::Matrix3f covariance_matrix;
572572

573573
// test empty cloud which is dense
@@ -673,7 +673,7 @@ TEST (PCL, computeMeanAndCovariance)
673673
{
674674
PointCloud<PointXYZ> cloud;
675675
PointXYZ point;
676-
std::vector <int> indices;
676+
Indices indices;
677677
Eigen::Matrix3f covariance_matrix;
678678
Eigen::Vector4f centroid;
679679

@@ -931,7 +931,7 @@ TEST (PCL, CentroidPoint)
931931
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
932932
TEST (PCL, computeCentroid)
933933
{
934-
std::vector<int> indices;
934+
Indices indices;
935935
PointXYZI point;
936936
PointCloud<PointXYZI> cloud;
937937
PointXYZINormal centroid;
@@ -1057,7 +1057,7 @@ TEST (PCL, demeanPointCloud)
10571057
EXPECT_XYZ_NEAR (cloud_demean[0], PointXYZ (0.034503, 0.010837, 0.013447), 1e-4);
10581058
EXPECT_XYZ_NEAR (cloud_demean[cloud_demean.size () - 1], PointXYZ (-0.048849, 0.072507, -0.071702), 1e-4);
10591059

1060-
std::vector<int> indices (cloud.size ());
1060+
Indices indices (cloud.size ());
10611061
for (int i = 0; i < static_cast<int> (indices.size ()); ++i) { indices[i] = i; }
10621062

10631063
// Check standard demean w/ indices

test/common/test_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ TEST (PCL, GetMaxDistance)
552552
test::EXPECT_EQ_VECTORS (max_exp_pt, max_pt);
553553

554554
// Specifying indices
555-
std::vector<int> idx (2);
555+
Indices idx (2);
556556
idx[0] = 1; idx[1] = 2;
557557
max_exp_pt = cloud[2].getVector4fMap ();
558558
getMaxDistance (cloud, idx, pivot_pt, max_pt);

test/common/test_io.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ TEST (PCL, copyPointCloud)
9696
EXPECT_EQ (cloud_xyz_rgba[i].rgba, cloud_xyz_rgb_normal[i].rgba);
9797
}
9898

99-
std::vector<int> indices;
99+
Indices indices;
100100
indices.push_back (0); indices.push_back (1);
101101
pcl::copyPointCloud (cloud_xyz_rgba, indices, cloud_xyz_rgb_normal);
102102
ASSERT_EQ (int (cloud_xyz_rgb_normal.size ()), 2);
@@ -107,7 +107,7 @@ TEST (PCL, copyPointCloud)
107107
EXPECT_EQ (cloud_xyz_rgba[i].rgba, cloud_xyz_rgb_normal[i].rgba);
108108
}
109109

110-
std::vector<int, Eigen::aligned_allocator<int> > indices_aligned;
110+
IndicesAllocator< Eigen::aligned_allocator<int> > indices_aligned;
111111
indices_aligned.push_back (1); indices_aligned.push_back (2); indices_aligned.push_back (3);
112112
pcl::copyPointCloud (cloud_xyz_rgba, indices_aligned, cloud_xyz_rgb_normal);
113113
ASSERT_EQ (int (cloud_xyz_rgb_normal.size ()), 3);
@@ -440,7 +440,7 @@ TEST (PCL, CopyPointCloudWithIndicesAndRGBToRGBA)
440440
CloudXYZRGB cloud_xyz_rgb;
441441
CloudXYZRGBA cloud_xyz_rgba (5, 1, pt_xyz_rgba);
442442

443-
std::vector<int> indices;
443+
Indices indices;
444444
indices.push_back (2);
445445
indices.push_back (3);
446446

test/common/test_transforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Transforms : public ::testing::Test
103103
pcl::PointCloud<pcl::PointXYZRGBNormal> p_xyz_normal, p_xyz_normal_trans;
104104

105105
// Indices, every second point
106-
std::vector<int> indices;
106+
Indices indices;
107107

108108
PCL_MAKE_ALIGNED_OPERATOR_NEW;
109109
};
@@ -266,7 +266,7 @@ TEST (PCL, Matrix4Affine3Transform)
266266

267267
affine = transformation;
268268

269-
std::vector<int> indices (1); indices[0] = 0;
269+
Indices indices (1); indices[0] = 0;
270270

271271
pcl::transformPointCloud (c, indices, ct, affine);
272272
EXPECT_NEAR (pt.x, ct[0].x, 1e-4);

0 commit comments

Comments
 (0)