You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
659B

  1. //go:build cufft
  2. package gpudemod
  3. import (
  4. "testing"
  5. "sdr-visual-suite/internal/dsp"
  6. )
  7. func TestValidateFreqShiftRejectsMismatchedLength(t *testing.T) {
  8. iq := []complex64{1 + 0i, 0 + 1i}
  9. shifted := []complex64{1 + 0i}
  10. if ValidateFreqShift(iq, 2048000, 12500, shifted, 1e-3) {
  11. t.Fatal("expected mismatched lengths to fail validation")
  12. }
  13. }
  14. func TestValidateFreqShiftAcceptsCPUReference(t *testing.T) {
  15. iq := []complex64{1 + 0i, 0.5 + 0.25i, -0.25 + 0.75i, 0.1 - 0.3i}
  16. shifted := dsp.FreqShift(iq, 2048000, 256000)
  17. if !ValidateFreqShift(iq, 2048000, 256000, shifted, 1e-6) {
  18. t.Fatal("expected CPU reference shifted IQ to pass validation")
  19. }
  20. }