make clientID tests pass
This commit is contained in:
parent
ddd5cbef2c
commit
66f76a7d48
1 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
||||||
package bittorrent
|
package bittorrent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,9 +43,10 @@ func TestClientID(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range clientTable {
|
for _, tt := range clientTable {
|
||||||
clientID := ClientID([]byte(tt.clientID))
|
var clientID ClientID
|
||||||
parsedID := NewClientID(PeerIDFromBytes([]byte(tt.peerID)))
|
copy(clientID[:], []byte(tt.clientID))
|
||||||
if !bytes.Equal([]byte(parsedID), []byte(clientID)) {
|
parsedID := NewClientID(PeerIDFromString(tt.peerID))
|
||||||
|
if parsedID != clientID {
|
||||||
t.Error("Incorrectly parsed peer ID", tt.peerID, "as", parsedID)
|
t.Error("Incorrectly parsed peer ID", tt.peerID, "as", parsedID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue