From 66f76a7d486cc7d7383a176ef4b49d90577caa6d Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 16 Aug 2016 23:41:59 -0400 Subject: [PATCH] make clientID tests pass --- bittorrent/client_id_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bittorrent/client_id_test.go b/bittorrent/client_id_test.go index ce760fa..991bde1 100644 --- a/bittorrent/client_id_test.go +++ b/bittorrent/client_id_test.go @@ -1,7 +1,6 @@ package bittorrent import ( - "bytes" "testing" ) @@ -44,9 +43,10 @@ func TestClientID(t *testing.T) { } for _, tt := range clientTable { - clientID := ClientID([]byte(tt.clientID)) - parsedID := NewClientID(PeerIDFromBytes([]byte(tt.peerID))) - if !bytes.Equal([]byte(parsedID), []byte(clientID)) { + var clientID ClientID + copy(clientID[:], []byte(tt.clientID)) + parsedID := NewClientID(PeerIDFromString(tt.peerID)) + if parsedID != clientID { t.Error("Incorrectly parsed peer ID", tt.peerID, "as", parsedID) } }