aboutsummaryrefslogtreecommitdiff
path: root/meta/torrent_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-07-05 03:58:17 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-07-05 03:58:17 +0200
commitf32fa29a71224dbe65ef57b7d4dd1a09ed0e7310 (patch)
treeaebeec944d271c4d6ab37a575ee26023103293a3 /meta/torrent_test.go
parentcefe5a6680a3dbf4d9e8231ac17b0385cfa984c5 (diff)
wip
Diffstat (limited to 'meta/torrent_test.go')
-rw-r--r--meta/torrent_test.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/meta/torrent_test.go b/meta/torrent_test.go
index b2443af..c3e960c 100644
--- a/meta/torrent_test.go
+++ b/meta/torrent_test.go
@@ -33,8 +33,9 @@ func TestPieces(t *testing.T) {
t.Error(err)
}
for i := 0; i < tor.Info.NPieces(); i++ {
- n, off := tor.Info.FileOffset(i)
- t.Log(n, off)
+ off := i * tor.Info.PieceLength
+ n, foff := tor.Info.FindFile(off)
+ t.Log(off, n, foff)
}
}
@@ -47,3 +48,20 @@ func TestPieces2(t *testing.T) {
t.Logf("%d %x\n", i, p)
}
}
+
+func TestReadAt(t *testing.T) {
+ t.Skip()
+ tor, err := Open("../examples/" + tors["bsd"])
+ if err != nil {
+ t.Error(err)
+ }
+ buf := make([]byte, tor.Info.PieceLength)
+ n, err := tor.Info.ReadAt(buf, 0)
+ if err != nil {
+ t.Log(err)
+ }
+ if n != len(buf) {
+ t.Error("expected", len(buf), "got", n)
+ }
+ //t.Logf("% x\n", buf)
+}