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

63 行
2.4KB

  1. package pipeline
  2. import "testing"
  3. func TestSurveillanceDetectionPolicyAuto(t *testing.T) {
  4. policy := Policy{
  5. Mode: "wideband-balanced",
  6. Profile: "wideband-balanced",
  7. Intent: "wideband-surveillance",
  8. SurveillanceStrategy: "multi-resolution",
  9. }
  10. policy.SurveillanceDerivedDetection = "auto"
  11. got := SurveillanceDetectionPolicyFromPolicy(policy)
  12. if !got.DerivedDetectionEnabled {
  13. t.Fatalf("expected auto policy to enable derived detection, got %+v", got)
  14. }
  15. if got.DerivedDetectionMode != "detection" {
  16. t.Fatalf("expected detection mode, got %+v", got)
  17. }
  18. policy.Profile = "archive"
  19. policy.Intent = "archive-and-triage"
  20. got = SurveillanceDetectionPolicyFromPolicy(policy)
  21. if got.DerivedDetectionEnabled {
  22. t.Fatalf("expected archive policy to disable derived detection, got %+v", got)
  23. }
  24. if got.DerivedDetectionMode != "support" {
  25. t.Fatalf("expected support mode for archive policy, got %+v", got)
  26. }
  27. policy = Policy{SurveillanceStrategy: "single-resolution", SurveillanceDerivedDetection: "auto"}
  28. got = SurveillanceDetectionPolicyFromPolicy(policy)
  29. if got.DerivedDetectionEnabled {
  30. t.Fatalf("expected single-resolution to disable derived detection, got %+v", got)
  31. }
  32. if got.DerivedDetectionMode != "disabled" {
  33. t.Fatalf("expected disabled mode for single-resolution, got %+v", got)
  34. }
  35. }
  36. func TestSurveillanceDetectionPolicyOverrides(t *testing.T) {
  37. policy := Policy{SurveillanceStrategy: "single-resolution", SurveillanceDerivedDetection: "on"}
  38. got := SurveillanceDetectionPolicyFromPolicy(policy)
  39. if got.DerivedDetectionEnabled {
  40. t.Fatalf("expected single-resolution to force derived detection off, got %+v", got)
  41. }
  42. if got.DerivedDetectionReason != "strategy" || got.DerivedDetectionMode != "disabled" {
  43. t.Fatalf("expected strategy-based disable, got %+v", got)
  44. }
  45. policy = Policy{SurveillanceStrategy: "multi-resolution", SurveillanceDerivedDetection: "off"}
  46. got = SurveillanceDetectionPolicyFromPolicy(policy)
  47. if got.DerivedDetectionEnabled || got.DerivedDetectionMode != "support" {
  48. t.Fatalf("expected off to yield support mode, got %+v", got)
  49. }
  50. policy = Policy{SurveillanceStrategy: "multi-resolution", SurveillanceDerivedDetection: "on", Profile: "archive"}
  51. got = SurveillanceDetectionPolicyFromPolicy(policy)
  52. if !got.DerivedDetectionEnabled || got.DerivedDetectionReason != "config" || got.DerivedDetectionMode != "detection" {
  53. t.Fatalf("expected config on to override archive, got %+v", got)
  54. }
  55. }