@Test
public void plus() {
DoublesPair point1 = new DoublesPair(1.0, 2.0);
double value1 = 2345.678;
SurfaceValue surf1 = SurfaceValue.from(point1, value1);
DoublesPair point2 = new DoublesPair(2.0, Math.PI);
double value2 = 10 * Math.E;
SurfaceValue surfPlus1 = SurfaceValue.plus(surf1, point2, value2);
assertEquals("Surface value - plus", 2, surfPlus1.getMap().size());
assertTrue("Surface value - plus", surfPlus1.getMap().containsKey(point1));
assertTrue("Surface value - plus", surfPlus1.getMap().containsKey(point2));
assertEquals("Surface value - plus", value1, surfPlus1.getMap().get(point1), TOLERANCE);
assertEquals("Surface value - plus", value2, surfPlus1.getMap().get(point2), TOLERANCE);
SurfaceValue surf2 = SurfaceValue.from(point2, value2);
SurfaceValue surfPlus2 = SurfaceValue.plus(surf1, surf2);
assertEquals("Surface value - plus", 2, surfPlus2.getMap().size());
assertTrue("Surface value - plus", surfPlus2.getMap().containsKey(point1));
assertTrue("Surface value - plus", surfPlus2.getMap().containsKey(point2));
assertEquals("Surface value - plus", value1, surfPlus2.getMap().get(point1), TOLERANCE);
assertEquals("Surface value - plus", value2, surfPlus2.getMap().get(point2), TOLERANCE);
assertTrue("Surface value - plus", SurfaceValue.compare(SurfaceValue.plus(surfPlus2, surfPlus2), SurfaceValue.multiplyBy(surfPlus2, 2), TOLERANCE));
DoublesPair point3 = new DoublesPair(2.0, 2.0);
double value3 = 12.345;
SurfaceValue surf3 = SurfaceValue.from(point3, value3);
assertTrue("Surface value - plus", SurfaceValue.compare(SurfaceValue.plus(surfPlus2, point3, value3), SurfaceValue.plus(surfPlus2, surf3), TOLERANCE));
}