Skip to content

Commit

Permalink
Simplify checkUnionResult
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jan 22, 2025
1 parent 17c73f6 commit 500f52d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions tests/xmltester/XMLTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,11 @@ bool
Test::checkOverlaySuccess(Geometry const& gExpected, Geometry const& gActual)
{
double tol = operation::overlay::snap::GeometrySnapper::computeSizeBasedSnapTolerance(gExpected);
//-- BUG: this allows all empties to test equal
if(gExpected.equals(&gActual)) {
return 1;
}
//TODO: is this needed by any tests?
std::cerr << "Using an overlay tolerance of " << tol << std::endl;
if(gExpected.equalsExact(&gActual, tol)) {
return 1;
Expand Down Expand Up @@ -871,23 +873,14 @@ Test::checkResult( const std::unique_ptr<Geometry>& result,
actualResultStr = tester.printGeom(gActualRes.get());
}

//TODO: fix this hack. Only used for union now, and has a bug where empties test equal
//TODO: remove this hack when tests are fixed. Only used for union, and has a bug where empties test equal
void
Test::checkUnionResult( const std::unique_ptr<Geometry>& result )
{
std::string sExpected = opResult;
std::unique_ptr<Geometry> gExpected(tester.parseGeometry(sExpected, "expected"));
gExpected->normalize();

std::unique_ptr<Geometry> gActual(result->clone());
gActual->normalize();

isSuccess = checkOverlaySuccess(*gExpected.get(), *gActual.get());

if(testValidOutput) {
isSuccess &= tester.testValid(gActual.get(), "result");
}
actualResultStr = tester.printGeom(gActual.get());
checkResult( result,
[](std::unique_ptr<Geometry>& expected, std::unique_ptr<Geometry>& actual) -> bool {
return checkOverlaySuccess(*expected.get(), *actual.get());
});
}

void
Expand Down

0 comments on commit 500f52d

Please sign in to comment.