]> Sergey Matveev's repositories - btrtrc.git/blob - peerid_test.go
Use peerID type more, and make its Stringer output nicer
[btrtrc.git] / peerid_test.go
1 package torrent
2
3 import (
4         "testing"
5
6         "github.com/anacrolix/missinggo"
7         "github.com/stretchr/testify/assert"
8 )
9
10 func TestPeerIdString(t *testing.T) {
11         for _, _case := range []struct {
12                 id string
13                 s  string
14         }{
15                 {"\x1cNJ}\x9c\xc7\xc4o\x94<\x9b\x8c\xc2!I\x1c\a\xec\x98n", "1c4e4a7d9cc7c46f943c9b8cc221491c07ec986e"},
16                 {"-FD51W\xe4-LaZMk0N8ZLA7", "-FD51W\xe4-4c615a4d6b304e385a4c4137"},
17         } {
18                 var pi peerID
19                 missinggo.CopyExact(&pi, _case.id)
20                 assert.EqualValues(t, _case.s, pi.String())
21         }
22 }