-
Notifications
You must be signed in to change notification settings - Fork 7
/
qos_test.go
107 lines (101 loc) · 1.71 KB
/
qos_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC
// SPDX-License-Identifier: Apache-2.0
package wrp
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
func TestQOSLevel(t *testing.T) {
for _, v := range []QOSLevel{QOSLow, QOSMedium, QOSHigh, QOSCritical} {
t.Run(strconv.Itoa(int(v)), func(t *testing.T) {
assert.NotEmpty(t, v.String())
})
}
}
func TestQOSValue(t *testing.T) {
t.Run("Level", func(t *testing.T) {
testCases := []struct {
value QOSValue
expected QOSLevel
}{
{
value: QOSLowValue,
expected: QOSLow,
},
{
value: QOSMediumValue,
expected: QOSMedium,
},
{
value: QOSHighValue,
expected: QOSHigh,
},
{
value: QOSCriticalValue,
expected: QOSCritical,
},
{
value: -1,
expected: QOSLow,
},
{
value: 0,
expected: QOSLow,
},
{
value: 9,
expected: QOSLow,
},
{
value: 24,
expected: QOSLow,
},
{
value: 25,
expected: QOSMedium,
},
{
value: 32,
expected: QOSMedium,
},
{
value: 49,
expected: QOSMedium,
},
{
value: 50,
expected: QOSHigh,
},
{
value: 61,
expected: QOSHigh,
},
{
value: 74,
expected: QOSHigh,
},
{
value: 75,
expected: QOSCritical,
},
{
value: 84,
expected: QOSCritical,
},
{
value: 99,
expected: QOSCritical,
},
{
value: 34876123,
expected: QOSCritical,
},
}
for _, testCase := range testCases {
t.Run(strconv.Itoa(int(testCase.value)), func(t *testing.T) {
assert.Equal(t, testCase.expected, testCase.value.Level())
})
}
})
}