-
Notifications
You must be signed in to change notification settings - Fork 11
/
fanuc_test.go
41 lines (37 loc) · 972 Bytes
/
fanuc_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
package fanuc
import (
"testing"
)
func TestFanucStrings(t *testing.T) {
tests := []struct {
Type
Exp string
Verbose string
}{
{Numreg, "R", "Numeric Register"},
{Posreg, "PR", "Position Register"},
{Sreg, "SR", "String Register"},
{Ualm, "UALM", "User Alarm"},
{Ain, "AI", "Analog Input"},
{Aout, "AO", "Analog Output"},
{Din, "DI", "Digital Input"},
{Dout, "DO", "Digital Output"},
{Flag, "F", "Flag"},
{Gin, "GI", "Group Input"},
{Gout, "GO", "Group Output"},
{Rin, "RI", "Robot Input"},
{Rout, "RO", "Robot Output"},
{Sin, "SI", "SOP Input"},
{Sout, "SO", "SOP Output"},
{Uin, "UI", "UOP Input"},
{Uout, "UO", "UOP Output"},
}
for _, test := range tests {
if test.Type.String() != test.Exp {
t.Errorf("Bad string. Got %q, want %q", test.Type.String(), test.Exp)
}
if test.Type.VerboseName() != test.Verbose {
t.Errorf("Bad verbose name. Got %q, want %q", test.Type.VerboseName(), test.Verbose)
}
}
}