aboutsummaryrefslogtreecommitdiff
path: root/meta/torrent_test.go
blob: 4965b87253f4ca6b8ae1252c3fcd40ee7c484083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package meta

import "testing"

var tors = map[string]string{
	"bsd": "OpenBSD_5.9_amd64_install59.iso-2016-03-29-0449.torrent",
	"ogg": "OpenBSD_songs_ogg-2016-03-25-0127.torrent",
	"deb": "debian-8.5.0-amd64-netinst.iso.torrent",
}

func TestPieces(t *testing.T) {
	tor, err := New("../examples/" + tors["ogg"])
	if err != nil {
		t.Error(err)
	}
	for i := 0; i < tor.Info.NPieces(); i++ {
		n, off, span := tor.Info.FileOffset(i)
		t.Log(n, off, span)
	}
}