Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
944B

  1. package main
  2. import (
  3. "testing"
  4. apppkg "github.com/jan/fm-rds-tx/internal/app"
  5. cfgpkg "github.com/jan/fm-rds-tx/internal/config"
  6. "github.com/jan/fm-rds-tx/internal/output"
  7. "github.com/jan/fm-rds-tx/internal/platform"
  8. )
  9. func TestTxBridgeExportsQueueStats(t *testing.T) {
  10. cfg := cfgpkg.Default()
  11. driver := platform.NewSimulatedDriver(nil)
  12. engine := apppkg.NewEngine(cfg, driver)
  13. bridge := &txBridge{engine: engine}
  14. stats := bridge.TXStats()
  15. raw, ok := stats["queue"]
  16. if !ok {
  17. t.Fatalf("expected queue stats in tx stats")
  18. }
  19. queue, ok := raw.(output.QueueStats)
  20. if !ok {
  21. t.Fatalf("queue stats type mismatch: %T", raw)
  22. }
  23. if queue.Capacity != cfg.Runtime.FrameQueueCapacity {
  24. t.Fatalf("unexpected queue capacity: want %d got %d", cfg.Runtime.FrameQueueCapacity, queue.Capacity)
  25. }
  26. if queue.Health != output.QueueHealthCritical {
  27. t.Fatalf("queue health should be critical with empty queue, got %s", queue.Health)
  28. }
  29. }