Skip to content

Commit

Permalink
Fix ODR violations in tests
Browse files Browse the repository at this point in the history
CMake builds all tests into a single executable. So, naming these two
classes the same is an ODR violation, which also causes segmentation
fault on my machine when I try to run tests.

With this patch, test executable do not crash anymore. However, there
are still 13 failing tests, which require further investigation.
  • Loading branch information
DanShaders committed Oct 8, 2023
1 parent e51efc1 commit 28582b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/TensorProductPatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ TEST_F(TensorProductPatchTest, bbox) {
}


class Callback : public ShadingPatch::Callback {
class TensorProductPatchTestCallback : public ShadingPatch::Callback {
public:
void patchSegment (GraphicsPath<double> &path, const Color &color) {
ostringstream oss;
Expand All @@ -284,7 +284,7 @@ class Callback : public ShadingPatch::Callback {


TEST_F(TensorProductPatchTest, approximate) {
Callback callback;
TensorProductPatchTestCallback callback;
vector<Color> colors(4);
TensorProductPatch tpp(_points, colors, Color::ColorSpace::RGB, 0, 0);
tpp.approximate(2, false, 0.1, callback);
Expand Down
4 changes: 2 additions & 2 deletions tests/TriangularPatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST(TriangularPatchTest, boundaryPath) {
}


class Callback : public ShadingPatch::Callback {
class TriangularPatchTestCallback : public ShadingPatch::Callback {
public:
void patchSegment (GraphicsPath<double> &path, const Color &color) {
ostringstream oss;
Expand All @@ -167,7 +167,7 @@ TEST(TriangularPatchTest, approximate) {
points[2] = DPair(0, 10);
vector<Color> colors(3);
TriangularPatch tp(points, colors, Color::ColorSpace::RGB, 0, 0);
Callback callback;
TriangularPatchTestCallback callback;
tp.approximate(2, false, 0.1, callback);
EXPECT_EQ(callback.pathstr(), "M0 0H10L0 10Z");
EXPECT_EQ(callback.colorstr(), "#000");
Expand Down

0 comments on commit 28582b5

Please sign in to comment.