/*
 * FastDtwTest.java   Jul 14, 2004
 *
 * Copyright (c) 2004 Stan Salvador
 * stansalvador@hotmail.com
 */

package com.fastdtw.examples;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.fastdtw.dtw.TimeWarpInfo;
import com.fastdtw.timeseries.TimeSeries;
import com.fastdtw.util.EuclideanDistance;

public class FastDtwTest {

    private static final double PRECISION = 0.00000001;

    @Test
    public void testDistanceBetweenTrace0AndTrace1() {
        final TimeSeries tsI = new TimeSeries("src/test/resources/trace0.csv", false, false, ',');
        final TimeSeries tsJ = new TimeSeries("src/test/resources/trace1.csv", false, false, ',');

        final TimeWarpInfo info = com.fastdtw.dtw.FastDTW.getWarpInfoBetween(tsI, tsJ, 10, new EuclideanDistance());
        assertEquals(9.139400704860002, info.getDistance(), PRECISION);
    }

}

@@ -255,16 +255,50 @@
 pInfo;%0D%0A
+import com.fastdtw.dtw.WarpPath;%0D%0A
 import c
@@ -332,16 +332,16 @@
 eries;%0D%0A
-
 import c
@@ -826,16 +826,33 @@
 tsJ, 10,
+%0D%0A               
  new Euc
@@ -940,24 +940,650 @@
 RECISION);%0D%0A
+        // %5B(0,0),(0,1),(1,2),(2,3),...,(272,272),(273,272),(274,273),(274,274)%5D%0D%0A        WarpPath p = info.getPath();%0D%0A        assertEquals(0, p.get(0).getCol());%0D%0A        assertEquals(0, p.get(0).getRow());%0D%0A        assertEquals(0, p.get(1).getCol());%0D%0A        assertEquals(1, p.get(1).getRow());%0D%0A%0D%0A        assertEquals(1, p.get(2).getCol());%0D%0A        assertEquals(2, p.get(2).getRow());%0D%0A%0D%0A        assertEquals(274, p.get(p.size() - 2).getCol());%0D%0A        assertEquals(273, p.get(p.size() - 2).getRow());%0D%0A        assertEquals(274, p.get(p.size() - 1).getCol());%0D%0A        assertEquals(274, p.get(p.size() - 1).getRow());%0D%0A
     %7D%0D%0A%0D%0A%7D%0D%0A

add path test