Skip to content

Commit

Permalink
[fix] Dangling pointers in Clone tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-bremond committed Jan 9, 2019
1 parent def3c0f commit 9d12da4
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST (Library_Mathematics_Geometry_2D_Objects_LineString, Clone)

{

EXPECT_NO_THROW(LineString({ { 0.0, 0.0 }, { 0.0, 1.0 }, { 1.0, 0.0 } }).clone()) ;
EXPECT_NO_THROW(const LineString* lineStringPtr = LineString({ { 0.0, 0.0 }, { 0.0, 1.0 }, { 1.0, 0.0 } }).clone() ; delete lineStringPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST (Library_Mathematics_Geometry_2D_Objects_Point, Clone)

{

EXPECT_NO_THROW(Point(1.0, 2.0).clone()) ;
EXPECT_NO_THROW(const Point* pointPtr = Point(1.0, 2.0).clone() ; delete pointPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST (Library_Mathematics_Geometry_2D_Objects_PointSet, Clone)

{

EXPECT_NO_THROW(PointSet({ { 0.0, 0.0 }, { 0.0, 1.0 }, { 0.0, 2.0 } }).clone()) ;
EXPECT_NO_THROW(const PointSet* pointSetPtr = PointSet({ { 0.0, 0.0 }, { 0.0, 1.0 }, { 0.0, 2.0 } }).clone() ; delete pointSetPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST (Library_Mathematics_Geometry_2D_Objects_Polygon, Clone)
{ 1.0, 0.0 }
} ;

EXPECT_NO_THROW(Polygon(vertices).clone()) ;
EXPECT_NO_THROW(const Polygon* polygonPtr = Polygon(vertices).clone() ; delete polygonPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Composite, Clone)

const Pyramid pyramid = { base, apex } ;

EXPECT_NO_THROW(Composite(pyramid).clone() ;) ;
EXPECT_NO_THROW(const Composite* compositePtr = Composite(pyramid).clone() ; delete compositePtr ;) ;

}

Expand Down
2 changes: 1 addition & 1 deletion test/Library/Mathematics/Geometry/3D/Objects/Cone.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Cone, Clone)
const Vector3d axis = Vector3d::Z() ;
const Angle angle = Angle::Degrees(45.0) ;

EXPECT_NO_THROW(Cone(apex, axis, angle).clone()) ;
EXPECT_NO_THROW(const Cone* conePtr = Cone(apex, axis, angle).clone() ; delete conePtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Cuboid, Clone)
const std::array<Vector3d, 3> axes = { Vector3d { 1.0, 0.0, 0.0 }, Vector3d { 0.0, 1.0, 0.0 }, Vector3d { 0.0, 0.0, 1.0 } } ;
const std::array<Real, 3> extent = { 1.0, 2.0, 3.0 } ;

EXPECT_NO_THROW(Cuboid(center, axes, extent).clone()) ;
EXPECT_NO_THROW(const Cuboid* cuboidPtr = Cuboid(center, axes, extent).clone() ; delete cuboidPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Ellipsoid, Clone)

{

EXPECT_NO_THROW(Ellipsoid({ 1.0, 2.0, 3.0 }, 4.0, 5.0, 6.0).clone()) ;
EXPECT_NO_THROW(const Ellipsoid* ellipsoidPtr = Ellipsoid({ 1.0, 2.0, 3.0 }, 4.0, 5.0, 6.0).clone() ; delete ellipsoidPtr ;) ;

}

Expand Down
2 changes: 1 addition & 1 deletion test/Library/Mathematics/Geometry/3D/Objects/Line.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Line, Clone)

{

EXPECT_NO_THROW(Line({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone()) ;
EXPECT_NO_THROW(const Line* linePtr = Line({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone() ; delete linePtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_LineString, Clone)

{

EXPECT_NO_THROW(LineString({ { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 1.0, 0.0, 1.0 } }).clone()) ;
EXPECT_NO_THROW(const LineString* lineStringPtr = LineString({ { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 1.0, 0.0, 1.0 } }).clone() ; delete lineStringPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Plane, Clone)

{

EXPECT_NO_THROW(Plane({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone()) ;
EXPECT_NO_THROW(const Plane* planePtr = Plane({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone() ; delete planePtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Point, Clone)

{

EXPECT_NO_THROW(Point(1.0, 2.0, 3.0).clone()) ;
EXPECT_NO_THROW(const Point* pointPtr = Point(1.0, 2.0, 3.0).clone() ; delete pointPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_PointSet, Clone)

{

EXPECT_NO_THROW(PointSet({ { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }, { 0.0, 0.0, 2.0 } }).clone()) ;
EXPECT_NO_THROW(const PointSet* pointSetPtr = PointSet({ { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }, { 0.0, 0.0, 2.0 } }).clone() ; delete pointSetPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Polygon, Clone)
const Vector3d xAxis = { 1.0, 0.0, 0.0 } ;
const Vector3d yAxis = { 0.0, 1.0, 0.0 } ;

EXPECT_NO_THROW(Polygon(polygon2d, origin, xAxis, yAxis).clone()) ;
EXPECT_NO_THROW(const Polygon* polygonPtr = Polygon(polygon2d, origin, xAxis, yAxis).clone() ; delete polygonPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Pyramid, Clone)
const Polygon base = { { { { 0.0, 0.0 }, { 1.0, 0.0 }, { 1.0, 1.0 }, { 0.0, 1.0 } } }, { 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 } } ;
const Point apex = { 0.0, 0.0, 1.0 } ;

EXPECT_NO_THROW(Pyramid(base, apex).clone()) ;
EXPECT_NO_THROW(const Pyramid* pyramidPtr = Pyramid(base, apex).clone() ; delete pyramidPtr ;) ;

}

Expand Down
2 changes: 1 addition & 1 deletion test/Library/Mathematics/Geometry/3D/Objects/Ray.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Ray, Clone)

{

EXPECT_NO_THROW(Ray({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone()) ;
EXPECT_NO_THROW(const Ray* rayPtr = Ray({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone() ; delete rayPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Segment, Clone)

{

EXPECT_NO_THROW(Segment({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone()) ;
EXPECT_NO_THROW(const Segment* segmentPtr = Segment({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0 }).clone() ; delete segmentPtr ;) ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST (Library_Mathematics_Geometry_3D_Objects_Sphere, Clone)

{

EXPECT_NO_THROW(Sphere({ 1.0, 2.0, 3.0 }, 4.0).clone()) ;
EXPECT_NO_THROW(const Sphere* spherePtr = Sphere({ 1.0, 2.0, 3.0 }, 4.0).clone() ; delete spherePtr ;) ;

}

Expand Down

0 comments on commit 9d12da4

Please sign in to comment.