6 "github.com/stretchr/testify/require"
8 "github.com/anacrolix/torrent/metainfo"
11 func testMarkedCompleteMissingOnRead(t *testing.T, csf func(string) ClientImplCloser) {
16 info := &metainfo.Info{
18 Files: []metainfo.FileInfo{{Path: []string{"a"}, Length: 1}},
20 ts, err := cs.OpenTorrent(info, metainfo.Hash{})
21 require.NoError(t, err)
22 p := ts.Piece(info.Piece(0))
23 require.NoError(t, p.MarkComplete())
24 // require.False(t, p.GetIsComplete())
25 n, err := p.ReadAt(make([]byte, 1), 0)
27 require.EqualValues(t, 0, n)
28 require.False(t, p.Completion().Complete)
31 func TestMarkedCompleteMissingOnReadFile(t *testing.T) {
32 testMarkedCompleteMissingOnRead(t, NewFile)
35 func TestMarkedCompleteMissingOnReadFileBoltDB(t *testing.T) {
36 testMarkedCompleteMissingOnRead(t, NewBoltDB)