/*
 * algorithms  Copyright (C) 2015 Ratchet Robotics
 * Licensed under the BSD license.
 */

import org.junit.Test;
import org.ratchetrobotics.algorithms.ai.ResponseCurve;

import static org.junit.Assert.assertEquals;

public class ResponseCurveTest {
    @Test
    public void aPointShouldInterpolateToItself() {
        ResponseCurve responseCurve = new ResponseCurve(
                new double[]{0.0, 1.0, 2.0},
                new double[]{0.0, 1.0, 2.0});

        assertEquals("respond(0.0) for y 0.0 should be 0.0", 0.0, responseCurve.respond(0.0), 0.0/*ε, a small fudge for doubles*/);
        assertEquals("respond(1.0) for y 1.0 should be 1.0", 1.0, responseCurve.respond(1.0), 0.0/*ε, a small fudge for doubles*/);
        assertEquals("respond(2.0) for y 2.0 should be 2.0", 2.0, responseCurve.respond(2.0), 0.0/*ε, a small fudge for doubles*/);
    }
}

@@ -87,16 +87,82 @@
 e.%0A */%0A%0A
+import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;%0A
 import o
@@ -176,16 +176,16 @@
 t.Test;%0A
-
 import o
@@ -233,16 +233,68 @@
 Curve;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 import s
@@ -528,16 +528,16 @@
 , 2.0%7D,%0A
-
         
@@ -575,16 +575,720 @@
 2.0%7D);%0A%0A
+        assertEquals(%22respond(0.0) for y 0.0 should be 0.0%22, 0.0, responseCurve.respond(0.0), 0.0/*%CE%B5, a small fudge for doubles*/);%0A        assertEquals(%22respond(1.0) for y 1.0 should be 1.0%22, 1.0, responseCurve.respond(1.0), 0.0/*%CE%B5, a small fudge for doubles*/);%0A        assertEquals(%22respond(2.0) for y 2.0 should be 2.0%22, 2.0, responseCurve.respond(2.0), 0.0/*%CE%B5, a small fudge for doubles*/);%0A    %7D%0A%0A    public void aVector2DShouldInterpolateToItself() %7B%0A        List%3CVector2D%3E points = new ArrayList%3CVector2D%3E();%0A        points.add(new Vector2D(0, 0));%0A        points.add(new Vector2D(1, 1));%0A        points.add(new Vector2D(2, 2));%0A%0A        ResponseCurve responseCurve = new ResponseCurve(points);%0A%0A
         

Test the List<Vector2D> form of ResponseCurve