-
Notifications
You must be signed in to change notification settings - Fork 158
/
cipher_suite_go114_test.go
55 lines (43 loc) · 1.19 KB
/
cipher_suite_go114_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
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
//go:build go1.14
// +build go1.14
package dtls
import (
"testing"
)
func TestInsecureCipherSuites(t *testing.T) {
r := InsecureCipherSuites()
if len(r) != 0 {
t.Fatalf("Expected no insecure ciphersuites, got %d", len(r))
}
}
func TestCipherSuites(t *testing.T) {
ours := allCipherSuites()
theirs := CipherSuites()
if len(ours) != len(theirs) {
t.Fatalf("Expected %d CipherSuites, got %d", len(ours), len(theirs))
}
for i, s := range ours {
i := i
s := s
t.Run(s.String(), func(t *testing.T) {
c := theirs[i]
if c.ID != uint16(s.ID()) {
t.Fatalf("Expected ID: 0x%04X, got 0x%04X", s.ID(), c.ID)
}
if c.Name != s.String() {
t.Fatalf("Expected Name: %s, got %s", s.String(), c.Name)
}
if len(c.SupportedVersions) != 1 {
t.Fatalf("Expected %d SupportedVersion, got %d", 1, len(c.SupportedVersions))
}
if c.SupportedVersions[0] != VersionDTLS12 {
t.Fatalf("Expected SupportedVersions 0x%04X, got 0x%04X", VersionDTLS12, c.SupportedVersions[0])
}
if c.Insecure {
t.Fatalf("Expected Insecure %t, got %t", false, c.Insecure)
}
})
}
}