forked from datarhei/gosrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_test.go
65 lines (57 loc) · 1.63 KB
/
config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package srt
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestDefaultConfig(t *testing.T) {
config := DefaultConfig()
err := config.Validate()
if err != nil {
require.NoError(t, err, "Failed to verify the default configuration: %s", err)
}
}
func TestMarshalUnmarshal(t *testing.T) {
wantConfig := Config{
Congestion: "xxx",
ConnectionTimeout: 42 * time.Second,
DriftTracer: false,
EnforcedEncryption: false,
FC: 42,
GroupConnect: true,
GroupStabilityTimeout: 42 * time.Second,
InputBW: 42,
IPTOS: 42,
IPTTL: 42,
IPv6Only: 42,
KMPreAnnounce: 42,
KMRefreshRate: 42,
Latency: 42 * time.Second,
LossMaxTTL: 42,
MaxBW: 42,
MessageAPI: true,
MinInputBW: 42,
MSS: 42,
NAKReport: false,
OverheadBW: 42,
PacketFilter: "FEC",
Passphrase: "foobar",
PayloadSize: 42,
PBKeylen: 42,
PeerIdleTimeout: 42 * time.Second,
PeerLatency: 42 * time.Second,
ReceiverBufferSize: 42,
ReceiverLatency: 42 * time.Second,
SendBufferSize: 42,
SendDropDelay: 42 * time.Second,
StreamId: "foobaz",
TooLatePacketDrop: false,
TransmissionType: "yyy",
TSBPDMode: false,
Logger: nil,
}
url := wantConfig.MarshalURL("localhost:6000")
config := Config{}
config.UnmarshalURL(url)
require.Equal(t, wantConfig, config)
}