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

46 строки
2.2KB

  1. package pipeline
  2. import "testing"
  3. func TestLevelRoleClassification(t *testing.T) {
  4. primary := AnalysisLevel{Name: "surveillance", Role: RoleSurveillancePrimary, Truth: "surveillance"}
  5. derived := AnalysisLevel{Name: "surveillance-lowres", Role: RoleSurveillanceDerived, Truth: "surveillance"}
  6. support := AnalysisLevel{Name: "surveillance-lowres", Role: RoleSurveillanceSupport, Truth: "surveillance"}
  7. presentation := AnalysisLevel{Name: "presentation", Role: RolePresentation, Truth: "presentation"}
  8. if !IsDetectionLevel(primary) || IsPresentationLevel(primary) || IsSupportLevel(primary) {
  9. t.Fatalf("primary role classification failed: %+v", primary)
  10. }
  11. if !IsDetectionLevel(derived) || IsPresentationLevel(derived) || IsSupportLevel(derived) {
  12. t.Fatalf("derived role classification failed: %+v", derived)
  13. }
  14. if IsDetectionLevel(support) || IsPresentationLevel(support) || !IsSupportLevel(support) {
  15. t.Fatalf("support role classification failed: %+v", support)
  16. }
  17. if IsDetectionLevel(presentation) || !IsPresentationLevel(presentation) || IsSupportLevel(presentation) {
  18. t.Fatalf("presentation role classification failed: %+v", presentation)
  19. }
  20. }
  21. func TestCandidateEvidenceStateTracksSupportLevels(t *testing.T) {
  22. candidate := Candidate{
  23. ID: 1,
  24. Evidence: []LevelEvidence{
  25. {Level: AnalysisLevel{Name: "surveillance", Role: RoleSurveillancePrimary, Truth: "surveillance"}, Provenance: "primary"},
  26. {Level: AnalysisLevel{Name: "surveillance-lowres", Role: RoleSurveillanceDerived, Truth: "surveillance"}, Provenance: "derived"},
  27. {Level: AnalysisLevel{Name: "surveillance-support", Role: RoleSurveillanceSupport, Truth: "surveillance"}, Provenance: "support"},
  28. {Level: AnalysisLevel{Name: "presentation", Role: RolePresentation, Truth: "presentation"}, Provenance: "display"},
  29. },
  30. }
  31. state := CandidateEvidenceStateFor(candidate)
  32. if state.DetectionLevelCount != 2 || state.PrimaryLevelCount != 1 || state.DerivedLevelCount != 1 {
  33. t.Fatalf("unexpected detection counts: %+v", state)
  34. }
  35. if state.SupportLevelCount != 1 || state.PresentationLevelCount != 1 {
  36. t.Fatalf("unexpected support/presentation counts: %+v", state)
  37. }
  38. if !state.MultiLevelConfirmed || state.DerivedOnly {
  39. t.Fatalf("unexpected confirmation flags: %+v", state)
  40. }
  41. }