Wideband autonomous SDR analysis engine forked from sdr-visual-suite
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

65 строки
1.5KB

  1. package pipeline
  2. import "testing"
  3. func TestFuseCandidatesDedup(t *testing.T) {
  4. primary := []Candidate{
  5. {
  6. ID: 1,
  7. CenterHz: 100.0e6,
  8. BandwidthHz: 20000,
  9. Evidence: []LevelEvidence{
  10. {Level: AnalysisLevel{Name: "surveillance"}},
  11. },
  12. },
  13. }
  14. derived := []Candidate{
  15. {
  16. ID: -1,
  17. CenterHz: 100.0e6 + 2000,
  18. BandwidthHz: 25000,
  19. Evidence: []LevelEvidence{
  20. {Level: AnalysisLevel{Name: "surveillance-lowres"}},
  21. },
  22. },
  23. }
  24. fused := FuseCandidates(primary, derived)
  25. if len(fused) != 1 {
  26. t.Fatalf("expected 1 fused candidate, got %d", len(fused))
  27. }
  28. if got := CandidateEvidenceLevelCount(fused[0]); got != 2 {
  29. t.Fatalf("expected 2 evidence levels after fuse, got %d", got)
  30. }
  31. }
  32. func TestFuseCandidatesSingleVsMultiResolution(t *testing.T) {
  33. primary := []Candidate{
  34. {
  35. ID: 1,
  36. CenterHz: 101.0e6,
  37. BandwidthHz: 12000,
  38. Evidence: []LevelEvidence{
  39. {Level: AnalysisLevel{Name: "surveillance"}},
  40. },
  41. },
  42. }
  43. single := FuseCandidates(primary, nil)
  44. if len(single) != 1 {
  45. t.Fatalf("expected single-resolution to keep 1 candidate, got %d", len(single))
  46. }
  47. derived := []Candidate{
  48. {
  49. ID: -2,
  50. CenterHz: 101.3e6,
  51. BandwidthHz: 15000,
  52. Evidence: []LevelEvidence{
  53. {Level: AnalysisLevel{Name: "surveillance-lowres"}},
  54. },
  55. },
  56. }
  57. multi := FuseCandidates(primary, derived)
  58. if len(multi) != 2 {
  59. t.Fatalf("expected multi-resolution to keep 2 candidates, got %d", len(multi))
  60. }
  61. }