...
1
16
17 package app
18
19 import "testing"
20
21 func TestIsValidPriorityClass(t *testing.T) {
22 testCases := []struct {
23 description string
24 priorityClassName string
25 expectedPriorityValue uint32
26 }{
27 {
28 description: "Invalid Priority Class",
29 priorityClassName: "myPriorityClass",
30 expectedPriorityValue: 0,
31 },
32 {
33 description: "Valid Priority Class",
34 priorityClassName: "IDLE_PRIORITY_CLASS",
35 expectedPriorityValue: uint32(64),
36 },
37 }
38 for _, test := range testCases {
39 actualPriorityValue := getPriorityValue(test.priorityClassName)
40 if test.expectedPriorityValue != actualPriorityValue {
41 t.Fatalf("unexpected error for %s", test.description)
42 }
43 }
44 }
45
View as plain text