@Test
public void testDistanceCalculation() throws MapLoadException {
MapLoader mapLoader = MapList.getDefaultList().getMapByName("mountain lake");
IMapData mapData = mapLoader.getMapData();
int width = mapData.getWidth();
int height = mapData.getHeight();
int testDistance = FISHER.getWorkRadius();
MilliStopWatch stopWatch = new MilliStopWatch();
BitSet actual = DistancesCalculationAlgorithm.calculatePositionsInDistance(width, height, (x, y) -> mapData.getLandscape(x, y).isWater,
testDistance);
stopWatch.stop("calculatePositionsInDistance");
stopWatch.restart();
BitSet expected = calculatePositionsInDistanceTrivial(width, height, (x, y) -> mapData.getLandscape(x, y).isWater, testDistance);
stopWatch.stop("calculatePositionsInDistance");
DebugImagesHelper.writeDebugImageBoolean("actual", width, height, (x, y) -> actual.get(x + y * width));
DebugImagesHelper.writeDebugImageBoolean("expected", width, height, (x, y) -> expected.get(x + y * width));
expected.xor(actual);
DebugImagesHelper.writeDebugImageBoolean("difference", width, height, (x, y) -> expected.get(x + y * width));
assertTrue("there exists a difference between actual and expected", expected.isEmpty());
}