]> Sergey Matveev's repositories - btrtrc.git/blob - client_test.go
e2b9cc3326ba23770255981cc8007bf210471905
[btrtrc.git] / client_test.go
1 package torrent
2
3 import (
4         "os"
5
6         "bitbucket.org/anacrolix/go.torrent/testutil"
7
8         "testing"
9 )
10
11 func TestAddTorrentNoSupportedTrackerSchemes(t *testing.T) {
12         t.SkipNow()
13 }
14
15 func TestAddTorrentNoUsableURLs(t *testing.T) {
16         t.SkipNow()
17 }
18
19 func TestAddPeersToUnknownTorrent(t *testing.T) {
20         t.SkipNow()
21 }
22
23 func TestPieceHashSize(t *testing.T) {
24         if PieceHash.Size() != 20 {
25                 t.FailNow()
26         }
27 }
28
29 func TestTorrentInitialState(t *testing.T) {
30         dir, mi := testutil.GreetingTestTorrent()
31         defer os.RemoveAll(dir)
32         tor, err := newTorrent(mi, dir)
33         if err != nil {
34                 t.Fatal(err)
35         }
36         if len(tor.Pieces) != 1 {
37                 t.Fatal("wrong number of pieces")
38         }
39         p := tor.Pieces[0]
40         if len(p.PendingChunkSpecs) != 1 {
41                 t.Fatalf("should only be 1 chunk: %s", p.PendingChunkSpecs)
42         }
43         if _, ok := p.PendingChunkSpecs[ChunkSpec{
44                 Length: 13,
45         }]; !ok {
46                 t.Fatal("pending chunk spec is incorrect")
47         }
48 }