Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

39 řádky
885B

  1. package offline
  2. import (
  3. "os"
  4. "path/filepath"
  5. "testing"
  6. "time"
  7. cfgpkg "github.com/jan/fm-rds-tx/internal/config"
  8. )
  9. func TestGenerateFrame(t *testing.T) {
  10. g := NewGenerator(cfgpkg.Default())
  11. frame := g.GenerateFrame(50 * time.Millisecond)
  12. if frame == nil {
  13. t.Fatal("expected frame")
  14. }
  15. if len(frame.Samples) == 0 {
  16. t.Fatal("expected samples")
  17. }
  18. }
  19. func TestWriteFile(t *testing.T) {
  20. cfg := cfgpkg.Default()
  21. out := filepath.Join(t.TempDir(), "test.iqf32")
  22. cfg.Backend.OutputPath = out
  23. g := NewGenerator(cfg)
  24. if err := g.WriteFile(out, 20*time.Millisecond); err != nil {
  25. t.Fatalf("WriteFile failed: %v", err)
  26. }
  27. info, err := os.Stat(out)
  28. if err != nil {
  29. t.Fatalf("expected output file: %v", err)
  30. }
  31. if info.Size() == 0 {
  32. t.Fatal("expected non-empty file")
  33. }
  34. }