-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhal_test.go
85 lines (80 loc) · 1.94 KB
/
hal_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
package hal
import (
"testing"
)
func TestPowerState_String(t *testing.T) {
tests := []struct {
name string
p PowerState
want string
}{
{name: "ON", p: PowerOnState, want: "ON"},
{name: "OF", p: PowerOffState, want: "OFF"},
{name: "UNKNOWN", p: PowerUnknownState, want: "UNKNOWN"},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
if got := tt.p.String(); got != tt.want {
t.Errorf("PowerState.String() = %v, want %v", got, tt.want)
}
})
}
}
func TestBootTarget_String(t *testing.T) {
tests := []struct {
name string
b BootTarget
want string
}{
{name: "BIOS", b: BootTargetBIOS, want: "BIOS"},
{name: "DISK", b: BootTargetDisk, want: "DISK"},
{name: "PXE", b: BootTargetPXE, want: "PXE"},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
if got := tt.b.String(); got != tt.want {
t.Errorf("BootTarget.String() = %v, want %v", got, tt.want)
}
})
}
}
func TestIdentifyLEDState_String(t *testing.T) {
tests := []struct {
name string
i IdentifyLEDState
want string
}{
{name: "ON", i: IdentifyLEDStateOn, want: "ON"},
{name: "OFF", i: IdentifyLEDStateOff, want: "OFF"},
{name: "UNKNOWN", i: IdentifyLEDStateUnknown, want: "UNKNOWN"},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
if got := tt.i.String(); got != tt.want {
t.Errorf("IdentifyLEDState.String() = %v, want %v", got, tt.want)
}
})
}
}
func TestFirmwareMode_String(t *testing.T) {
tests := []struct {
name string
f FirmwareMode
want string
}{
{name: "LEGACY", f: FirmwareModeLegacy, want: "LEGACY"},
{name: "UEFI", f: FirmwareModeUEFI, want: "UEFI"},
{name: "UNKNOWN", f: FirmwareModeUnknown, want: "UNKNOWN"},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
if got := tt.f.String(); got != tt.want {
t.Errorf("FirmwareMode.String() = %v, want %v", got, tt.want)
}
})
}
}