MCPcopy Create free account
hub / github.com/facebook/time / TestProbeMsgType

Function TestProbeMsgType

ptp/protocol/types_test.go:34–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestProbeMsgType(t *testing.T) {
35 tests := []struct {
36 in []byte
37 want MessageType
38 wantErr bool
39 }{
40 {
41 in: []byte{},
42 wantErr: true,
43 },
44 {
45 in: []byte{0x0},
46 want: MessageSync,
47 },
48 {
49 in: []byte{0xC},
50 want: MessageSignaling,
51 },
52 {
53 in: []byte{0xBC},
54 want: MessageSignaling,
55 },
56 }
57 for _, tt := range tests {
58 t.Run(fmt.Sprintf("ProbeMsgType in=%d", tt.in), func(t *testing.T) {
59 got, err := ProbeMsgType(tt.in)
60 if tt.wantErr {
61 require.Error(t, err)
62 } else {
63 require.NoError(t, err)
64 require.Equal(t, tt.want, got)
65 }
66 })
67 }
68}
69
70func TestMessageTypeString(t *testing.T) {
71 require.Equal(t, "SYNC", MessageSync.String())

Callers

nothing calls this directly

Calls 3

ProbeMsgTypeFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…