package de.biomedical_imaging.traj.features.test;

import static org.junit.Assert.*;

import org.junit.Test;

import de.biomedical_imaging.traJ.Trajectory;
import de.biomedical_imaging.traJ.features.MeanSpeedFeature;

public class MeanSpeedFeatureTest {

	@Test
	public void MeanSpeedTest() {
		Trajectory t  = new Trajectory(2);
		
		t.add(0, 0, 0);
	
		for(int i = 1; i < 20; i++){
			t.add(0,i,0);
		}
		double timelag = 1.0/30;
		MeanSpeedFeature speed = new MeanSpeedFeature(t, timelag);
		
		double meanspeed = speed.evaluate()[0];
		
		assertEquals(30, meanspeed,0.01);
	}

}

@@ -292,45 +292,219 @@
 %7B%0A%09%09
-Trajectory t  = new Trajectory(2);%0A%09%09
+%0A%09%09//Create trajectory object %0A%09%09int dimension=2;%0A%09%09Trajectory t  = new Trajectory(dimension);%0A%09%09%0A%09%09//Add Positions%0A%09%09int x = 0;%0A%09%09int y = 0;%0A%09%09int z = 0; // As the dimension is 2, it will ignore this component.
 %0A%09%09t
@@ -512,20 +512,18 @@
 add(
-0, 0, 0
+x, y, z
 );%0A
-%09%0A
 %09%09fo
@@ -549,16 +549,24 @@
 ; i++)%7B%0A
+%09%09%09y=i;%0A
 %09%09%09t.add
@@ -570,20 +570,70 @@
 add(
-0,i,0
+x,y,z
 );%0A%09%09%7D%0A
+%09%09%0A%09%09//Calculate the mean speed of the trajectory%0A
 %09%09do

Add documentation