package nl.fifth.postulate.tools;

import org.jtransforms.fft.DoubleFFT_1D;
import org.junit.Test;

import java.util.Arrays;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.number.IsCloseTo.closeTo;
import static org.junit.Assert.assertThat;

public class JTransformTest {
    private static final double EPSILON = 0.01;

    @Test
    public void shouldDoAFFTTransform() {
        final double[] input = new double[]{ 1.0f, 1.5f, 0.5f, 2.0f, 2.0f, 0.5f, 1.5f, 1.0f };
        final double[] output = Arrays.copyOf(input, input.length);
        DoubleFFT_1D fft = new DoubleFFT_1D(output.length);

        fft.realForward(output);
 
        assertThat(output[0], is(closeTo(10.00f, EPSILON)));
        assertThat(output[1], is(closeTo( 0.00f, EPSILON)));
        assertThat(output[2], is(closeTo(-1.00f, EPSILON)));
        assertThat(output[3], is(closeTo(-0.41f, EPSILON)));
        assertThat(output[4], is(closeTo( 1.00f, EPSILON)));
        assertThat(output[5], is(closeTo( 1.00f, EPSILON)));
        assertThat(output[6], is(closeTo(-1.00f, EPSILON)));
        assertThat(output[7], is(closeTo(-2.41f, EPSILON)));
    }
}

@@ -535,16 +535,18 @@
 (input, 
+2*
 input.le
@@ -596,19 +596,18 @@
 eFFT_1D(
-out
+in
 put.leng
@@ -635,16 +635,20 @@
 lForward
+Full
 (output)
@@ -649,17 +649,16 @@
 utput);%0A
- 
 %0A       
@@ -677,16 +677,17 @@
 output%5B0
+ 
 %5D, is(cl
@@ -739,16 +739,17 @@
 output%5B1
+ 
 %5D, is(cl
@@ -801,16 +801,17 @@
 output%5B2
+ 
 %5D, is(cl
@@ -863,16 +863,17 @@
 output%5B3
+ 
 %5D, is(cl
@@ -925,16 +925,17 @@
 output%5B4
+ 
 %5D, is(cl
@@ -987,16 +987,17 @@
 output%5B5
+ 
 %5D, is(cl
@@ -1049,16 +1049,17 @@
 output%5B6
+ 
 %5D, is(cl
@@ -1111,16 +1111,17 @@
 output%5B7
+ 
 %5D, is(cl
@@ -1142,20 +1142,516 @@
 EPSILON)));%0A
+        assertThat(output%5B8 %5D, is(closeTo(  0.0f, EPSILON)));%0A        assertThat(output%5B9 %5D, is(closeTo(  0.0f, EPSILON)));%0A        assertThat(output%5B10%5D, is(closeTo( -1.0f, EPSILON)));%0A        assertThat(output%5B11%5D, is(closeTo( 2.41f, EPSILON)));%0A        assertThat(output%5B12%5D, is(closeTo(  1.0f, EPSILON)));%0A        assertThat(output%5B13%5D, is(closeTo( -1.0f, EPSILON)));%0A        assertThat(output%5B14%5D, is(closeTo( -1.0f, EPSILON)));%0A        assertThat(output%5B15%5D, is(closeTo( 0.41f, EPSILON)));%0A
     %7D%0A%7D%0A

Use correct API