(t *testing.T)
| 380 | } |
| 381 | |
| 382 | func TestHexStringToSpanID(t *testing.T) { |
| 383 | tc := []struct { |
| 384 | id string |
| 385 | expected []byte |
| 386 | expectError error |
| 387 | }{ |
| 388 | { |
| 389 | id: "000eda96db732100", |
| 390 | expected: []byte{0x0e, 0xda, 0x96, 0xdb, 0x73, 0x21, 0x00}, |
| 391 | }, |
| 392 | { |
| 393 | id: "0000000000000002", |
| 394 | expected: []byte{0x02}, |
| 395 | }, |
| 396 | { |
| 397 | id: "1234567890abcdef", // 64 bit |
| 398 | expected: []byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}, |
| 399 | }, |
| 400 | } |
| 401 | |
| 402 | for _, tt := range tc { |
| 403 | t.Run(tt.id, func(t *testing.T) { |
| 404 | actual, err := HexStringToSpanID(tt.id) |
| 405 | |
| 406 | if tt.expectError != nil { |
| 407 | assert.Equal(t, tt.expectError, err) |
| 408 | assert.Nil(t, actual) |
| 409 | return |
| 410 | } |
| 411 | |
| 412 | assert.NoError(t, err) |
| 413 | assert.Equal(t, tt.expected, actual) |
| 414 | }) |
| 415 | } |
| 416 | } |
nothing calls this directly
no test coverage detected