MCPcopy
hub / github.com/grafana/tempo / TestSpanIDToUint64

Function TestSpanIDToUint64

pkg/util/traceid_test.go:133–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestSpanIDToUint64(t *testing.T) {
134 tc := []struct {
135 spanID []byte
136 expected uint64
137 }{
138 {
139 spanID: []byte{0x60, 0xd8, 0xa9, 0xbd},
140 expected: 0xbd_a9_d8_60,
141 },
142 {
143 spanID: []byte{0x8e, 0xf6, 0x37, 0x90, 0x22, 0x57, 0xb7, 0x43},
144 expected: 0x43_b7_57_22_90_37_f6_8e,
145 },
146 {
147 spanID: []byte{0x18, 0xcc, 0xd9, 0x6d, 0x70, 0xc1, 0xbd, 0xf9},
148 expected: 0xf9_bd_c1_70_6d_d9_cc_18,
149 },
150 {
151 spanID: []byte{0x8e, 0xf6, 0x37, 0x90, 0x22, 0x57, 0xb7, 0x43, 0xff},
152 expected: 0x43_b7_57_22_90_37_f6_8e,
153 },
154 }
155
156 for _, tt := range tc {
157 token := SpanIDToUint64(tt.spanID)
158 assert.Equalf(t, tt.expected, token, "SpanIDToToken(%v) reurned 0x%x but 0x%x was expected", tt.spanID, token, tt.expected)
159 }
160}
161
162func TestSpanIDAndKindToToken(t *testing.T) {
163 tc := []struct {

Callers

nothing calls this directly

Calls 1

SpanIDToUint64Function · 0.85

Tested by

no test coverage detected