Wideband autonomous SDR analysis engine forked from sdr-visual-suite
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

31 wiersze
1.1KB

  1. package main
  2. import (
  3. "testing"
  4. "time"
  5. "sdr-wideband-suite/internal/pipeline"
  6. )
  7. func TestEnforceDecisionBudgets(t *testing.T) {
  8. decisions := []pipeline.SignalDecision{
  9. {Candidate: pipeline.Candidate{ID: 1, SNRDb: 5}, ShouldRecord: true, ShouldAutoDecode: true},
  10. {Candidate: pipeline.Candidate{ID: 2, SNRDb: 15}, ShouldRecord: true, ShouldAutoDecode: true},
  11. {Candidate: pipeline.Candidate{ID: 3, SNRDb: 10}, ShouldRecord: true, ShouldAutoDecode: false},
  12. }
  13. q := newDecisionQueues()
  14. stats := q.Apply(decisions, 1, 1, time.Now())
  15. if stats.RecordSelected != 1 || stats.DecodeSelected != 1 {
  16. t.Fatalf("unexpected counts: record=%d decode=%d", stats.RecordSelected, stats.DecodeSelected)
  17. }
  18. if !decisions[1].ShouldRecord || !decisions[1].ShouldAutoDecode {
  19. t.Fatalf("expected highest SNR decision to remain allowed")
  20. }
  21. if decisions[0].ShouldRecord || decisions[0].ShouldAutoDecode {
  22. t.Fatalf("expected lowest SNR decision to be budgeted off")
  23. }
  24. if decisions[2].ShouldRecord {
  25. t.Fatalf("expected mid SNR decision to be budgeted off by record budget")
  26. }
  27. }