MCPcopy Create free account
hub / github.com/distributed/sers / TestModestringStringMethod

Function TestModestringStringMethod

modestring_test.go:65–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestModestringStringMethod(t *testing.T) {
66 cases := []struct {
67 Mode Mode
68 Str string
69 }{
70 {Mode{2400, 5, E, 2, RTSCTS_HANDSHAKE}, "2400,5e2,rtscts"},
71 {Mode{1200, 6, 20, 1, NO_HANDSHAKE}, "invalid_mode(1200,6,20,1,0)"},
72 {Mode{4800, 6, N, 1, NO_HANDSHAKE}, "4800,6n1,none"},
73 {Mode{9600, 7, O, 2, RTSCTS_HANDSHAKE}, "9600,7o2,rtscts"},
74 {Mode{19200, 8, N, 1, NO_HANDSHAKE}, "19200,8n1,none"},
75 }
76
77 for i, c := range cases {
78 act := c.Mode.String()
79 exp := c.Str
80 if act != exp {
81 t.Errorf("case %d: got %q, expected %q", i, act, exp)
82 continue
83 }
84 }
85}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected