bool
BufferResultMatcher::isBufferResultMatch(const geom::Geometry& actualBuffer,
	                         const geom::Geometry& expectedBuffer,
	                         double distance)
{
	if (actualBuffer.isEmpty() && expectedBuffer.isEmpty())
		return true;

	/**
	 * MD - need some more checks here - symDiffArea won't catch
	 * very small holes ("tears")
	 * near the edge of computed buffers (which can happen
	 * in current version of JTS (1.8)).
	 * This can probably be handled by testing
	 * that every point of the actual buffer is at least a certain
	 * distance away from the geometry boundary.
	 */
	if (! isSymDiffAreaInTolerance(actualBuffer, expectedBuffer))
	{
std::cerr << "isSymDiffAreaInTolerance failed" << std::endl;
		return false;
	}

	if (! isBoundaryHausdorffDistanceInTolerance(actualBuffer,
	           expectedBuffer, distance))
	{
std::cerr << "isBoundaryHasudorffDistanceInTolerance failed" << std::endl;
		return false;
	}

	return true;
}
bool
SingleSidedBufferResultMatcher::isBufferResultMatch(const geom::Geometry& actualBuffer,
	                         const geom::Geometry& expectedBuffer,
	                         double distance)
{
	bool aEmpty = actualBuffer.isEmpty();
	bool eEmpty = expectedBuffer.isEmpty();

	// Both empty succeeds
	if (aEmpty && eEmpty) return true;

	// One empty and not the other is a failure
	if (aEmpty || eEmpty)
	{
std::cerr << "isBufferResultMatch failed (one empty and one not)" << std::endl;
		return false;
	}


   // NOTE: we need to test hausdorff distance in both directions

	if (! isBoundaryHausdorffDistanceInTolerance(actualBuffer,
	           expectedBuffer, distance))
	{
std::cerr << "isBoundaryHasudorffDistanceInTolerance failed (actual,expected)" << std::endl;
		return false;
	}

	if (! isBoundaryHausdorffDistanceInTolerance(expectedBuffer,
	           actualBuffer, distance))
	{
std::cerr << "isBoundaryHasudorffDistanceInTolerance failed (expected,actual)" << std::endl;
		return false;
	}

	return true;
}