mirror of
https://github.com/ZizzyDizzyMC/linx-server.git
synced 2026-01-23 02:14:33 +00:00
add torrent test for binary data
This commit is contained in:
parent
baca561f06
commit
31aa0d666b
1 changed files with 15 additions and 0 deletions
|
|
@ -44,4 +44,19 @@ func TestCreateTorrent(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCreateTorrentWithImage(t *testing.T) {
|
||||
var decoded Torrent
|
||||
|
||||
encoded, err := CreateTorrent("test.jpg", "static/images/404.jpg")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
bencode.DecodeBytes(encoded, &decoded)
|
||||
|
||||
if decoded.Info.Pieces != "r\x01\x80j\x99\x84\n\xd3dZ;1NX\xec;\x9d$+f" {
|
||||
t.Fatal("Torrent pieces did not match expected pieces for image")
|
||||
}
|
||||
}
|
||||
|
||||
// vim:set ts=8 sw=8 noet:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue