Wideband autonomous SDR analysis engine forked from sdr-visual-suite
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

60 行
1.6KB

  1. package gpudemod
  2. import "testing"
  3. func TestStreamingGPUUsesSafeProductionDefault(t *testing.T) {
  4. r := &BatchRunner{eng: &Engine{sampleRate: 4000000}, streamState: make(map[int64]*ExtractStreamState)}
  5. job := StreamingExtractJob{
  6. SignalID: 1,
  7. OffsetHz: 12500,
  8. Bandwidth: 20000,
  9. OutRate: 200000,
  10. NumTaps: 65,
  11. ConfigHash: 777,
  12. }
  13. iq := makeDeterministicIQ(1000)
  14. results, err := r.StreamingExtractGPU(iq, []StreamingExtractJob{job})
  15. if err != nil {
  16. t.Fatalf("expected safe production default path, got error: %v", err)
  17. }
  18. if len(results) != 1 {
  19. t.Fatalf("expected 1 result, got %d", len(results))
  20. }
  21. if results[0].NOut == 0 {
  22. t.Fatalf("expected non-zero output count from safe production path")
  23. }
  24. }
  25. func TestStreamingGPUHostOracleAdvancesState(t *testing.T) {
  26. r := &BatchRunner{eng: &Engine{sampleRate: 4000000}, streamState: make(map[int64]*ExtractStreamState)}
  27. job := StreamingExtractJob{
  28. SignalID: 1,
  29. OffsetHz: 12500,
  30. Bandwidth: 20000,
  31. OutRate: 200000,
  32. NumTaps: 65,
  33. ConfigHash: 777,
  34. }
  35. iq := makeDeterministicIQ(1000)
  36. results, err := r.StreamingExtractGPUHostOracle(iq, []StreamingExtractJob{job})
  37. if err != nil {
  38. t.Fatalf("unexpected host-oracle error: %v", err)
  39. }
  40. if len(results) != 1 {
  41. t.Fatalf("expected 1 result, got %d", len(results))
  42. }
  43. state := r.streamState[1]
  44. if state == nil {
  45. t.Fatalf("expected state to be initialized")
  46. }
  47. if state.NCOPhase == 0 {
  48. t.Fatalf("expected phase to advance")
  49. }
  50. if len(state.ShiftedHistory) == 0 {
  51. t.Fatalf("expected shifted history to be updated")
  52. }
  53. if results[0].NOut == 0 {
  54. t.Fatalf("expected non-zero output count from host oracle path")
  55. }
  56. }