27 lines
571 B
Go
27 lines
571 B
Go
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|||
|
|
// SPDX-License-Identifier: MIT
|
||
|
|
|
||
|
|
package signal
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"sourcedock.dev/petrbalvin/tensor/internal/core"
|
||
|
|
)
|
||
|
|
|
||
|
|
// TestFloat32FFT checks that the transform computes in float64 from
|
||
|
|
// float32 inputs.
|
||
|
|
func TestFloat32FFT(t *testing.T) {
|
||
|
|
a, err := core.FromFloat32s([]float32{1, 1, 1, 1}, 4)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
spec, err := FFT(a)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("FFT float32: %v", err)
|
||
|
|
}
|
||
|
|
if v := spec.ComplexAt(0); v != 4 {
|
||
|
|
t.Fatalf("FFT DC: %v", v)
|
||
|
|
}
|
||
|
|
}
|