Skip to content

Commit

Permalink
Merge pull request PointCloudLibrary#4263 from kunaltyagi/expect_true
Browse files Browse the repository at this point in the history
`EXPECT_{TRUE,FALSE}(...);` instead of `EXPECT_EQ(...,{true,false});`
  • Loading branch information
SergioRAgostinho authored Jul 11, 2020
2 parents c262ec6 + 2c9982e commit 2420642
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 91 deletions.
40 changes: 20 additions & 20 deletions test/common/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ TEST(PCL, isFinite)
{
PointXYZ p;
p.x = std::numeric_limits<float>::quiet_NaN ();
EXPECT_EQ (isFinite (p), false);
EXPECT_FALSE (isFinite (p));
Normal n;
n.normal_x = std::numeric_limits<float>::quiet_NaN ();
EXPECT_EQ (isFinite (n), false);
EXPECT_FALSE (isFinite (n));
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -178,10 +178,10 @@ TEST (PCL, PointCloud)
cloud.width = 640;
cloud.height = 480;

EXPECT_EQ (cloud.isOrganized (), true);
EXPECT_TRUE (cloud.isOrganized ());

cloud.height = 1;
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());

cloud.width = 10;
for (std::uint32_t i = 0; i < cloud.width*cloud.height; ++i)
Expand Down Expand Up @@ -260,27 +260,27 @@ TEST (PCL, PointCloud)
cloud.height = 480;

cloud.insert (cloud.end (), PointXYZ (1, 1, 1));
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 1);

cloud.insert (cloud.end (), 5, PointXYZ (1, 1, 1));
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 6);

cloud.erase (cloud.end () - 1);
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 5);

cloud.erase (cloud.begin (), cloud.end ());
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 0);

cloud.emplace (cloud.end (), 1, 1, 1);
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 1);

auto& new_point = cloud.emplace_back (1, 1, 1);
EXPECT_EQ (cloud.isOrganized (), false);
EXPECT_FALSE (cloud.isOrganized ());
EXPECT_EQ (cloud.width, 2);
EXPECT_EQ (&new_point, &cloud.back ());
}
Expand Down Expand Up @@ -378,15 +378,15 @@ TEST (PCL, Intersections)
yline[0] = 0.493479f; yline[1] = 0.169246f; yline[2] = 1.22677f; yline[3] = 0.5992f; yline[4] = 0.0505085f; yline[5] = 0.405749f;

Eigen::Vector4f pt;
EXPECT_EQ ((pcl::lineWithLineIntersection (zline, yline, pt)), true);
EXPECT_TRUE (pcl::lineWithLineIntersection (zline, yline, pt));
EXPECT_NEAR (pt[0], 0.574544, 1e-3);
EXPECT_NEAR (pt[1], 0.175526, 1e-3);
EXPECT_NEAR (pt[2], 1.27636, 1e-3);
EXPECT_EQ (pt[3], 0);

zline << 0.545203f, -0.514419f, 1.31967f, 0.0243372f, 0.597946f, -0.0413579f;
yline << 0.492706f, 0.164196f, 1.23192f, 0.598704f, 0.0442014f, 0.411328f;
EXPECT_EQ ((pcl::lineWithLineIntersection (zline, yline, pt)), false);
EXPECT_FALSE (pcl::lineWithLineIntersection (zline, yline, pt));
//intersection: [ 3.06416e+08 15.2237 3.06416e+08 4.04468e-34 ]
}

Expand All @@ -409,27 +409,27 @@ TEST (PCL, CopyIfFieldExists)
rgb_val = std::numeric_limits<float>::quiet_NaN ();

pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "x", is_x, x_val));
EXPECT_EQ (is_x, true);
EXPECT_TRUE (is_x);
EXPECT_EQ (x_val, 1.0);
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "y", is_y, y_val));
EXPECT_EQ (is_y, true);
EXPECT_TRUE (is_y);
EXPECT_EQ (y_val, 2.0);
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "z", is_z, z_val));
EXPECT_EQ (is_z, true);
EXPECT_TRUE (is_z);
EXPECT_EQ (z_val, 3.0);
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "rgb", is_rgb, rgb_val));
EXPECT_EQ (is_rgb, true);
EXPECT_TRUE (is_rgb);
std::uint32_t rgb;
std::memcpy (&rgb, &rgb_val, sizeof(rgb_val));
EXPECT_EQ (rgb, 0xff7f40fe); // alpha is 255
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "normal_x", is_normal_x, normal_x_val));
EXPECT_EQ (is_normal_x, true);
EXPECT_TRUE (is_normal_x);
EXPECT_EQ (normal_x_val, 1.0);
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "normal_y", is_normal_y, normal_y_val));
EXPECT_EQ (is_normal_y, true);
EXPECT_TRUE (is_normal_y);
EXPECT_EQ (normal_y_val, 0.0);
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "normal_z", is_normal_z, normal_z_val));
EXPECT_EQ (is_normal_z, true);
EXPECT_TRUE (is_normal_z);
EXPECT_EQ (normal_z_val, 0.0);

pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "x", x_val));
Expand All @@ -440,7 +440,7 @@ TEST (PCL, CopyIfFieldExists)
EXPECT_EQ (xx_val, -1.0);
bool is_xx = true;
pcl::for_each_type<FieldList> (CopyIfFieldExists<PointXYZRGBNormal, float> (p, "xx", is_xx, xx_val));
EXPECT_EQ (is_xx, false);
EXPECT_FALSE (is_xx);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
24 changes: 12 additions & 12 deletions test/features/test_boundary_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,23 @@ TEST (PCL, BoundaryEstimation)
// isBoundaryPoint (indices)
bool pt = false;
pt = b.isBoundaryPoint (cloud, 0, indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) / 3, indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) / 2, indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, static_cast<int> (indices.size ()) - 1, indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, true);
EXPECT_TRUE (pt);

// isBoundaryPoint (points)
pt = b.isBoundaryPoint (cloud, cloud[0], indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 3], indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 2], indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = b.isBoundaryPoint (cloud, cloud[indices.size () - 1], indices, u, v, float (M_PI) / 2.0);
EXPECT_EQ (pt, true);
EXPECT_TRUE (pt);

// Object
PointCloud<Boundary>::Ptr bps (new PointCloud<Boundary> ());
Expand All @@ -120,13 +120,13 @@ TEST (PCL, BoundaryEstimation)
EXPECT_EQ (bps->points.size (), indices.size ());

pt = (*bps)[0].boundary_point;
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = (*bps)[indices.size () / 3].boundary_point;
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = (*bps)[indices.size () / 2].boundary_point;
EXPECT_EQ (pt, false);
EXPECT_FALSE (pt);
pt = (*bps)[indices.size () - 1].boundary_point;
EXPECT_EQ (pt, true);
EXPECT_TRUE (pt);
}

/* ---[ */
Expand Down
Loading

0 comments on commit 2420642

Please sign in to comment.