Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

23 строки
507B

  1. package mpx
  2. import (
  3. "math"
  4. "testing"
  5. )
  6. func TestDefaultCombinerCombine(t *testing.T) {
  7. comb := NewDefaultCombiner()
  8. value := comb.Combine(1, 0.5, 0.2, -0.1)
  9. if math.Abs(value-1.6) > 1e-9 {
  10. t.Fatalf("unexpected combined value: %v", value)
  11. }
  12. }
  13. func TestCustomGains(t *testing.T) {
  14. comb := DefaultCombiner{MonoGain: 0.5, StereoGain: 2, PilotGain: 0, RDSGain: -1}
  15. result := comb.Combine(1, 1, 1, 1)
  16. if math.Abs(result-(0.5+2+0-1)) > 1e-9 {
  17. t.Fatalf("custom gains not applied: %v", result)
  18. }
  19. }