forked from premiere/premiere-libtorrent
fix test_piece_picker to work with recently added speed_affinity flag
This commit is contained in:
parent
6b379c7137
commit
0703054079
|
@ -659,7 +659,7 @@ int test_main()
|
||||||
p = setup_picker("1111111", " ", "", "");
|
p = setup_picker("1111111", " ", "", "");
|
||||||
p->mark_as_downloading(piece_block(2,2), &tmp1, piece_picker::slow);
|
p->mark_as_downloading(piece_block(2,2), &tmp1, piece_picker::slow);
|
||||||
picked = pick_pieces(p, "*******", 7 * blocks_per_piece - 1, 0, &tmp2
|
picked = pick_pieces(p, "*******", 7 * blocks_per_piece - 1, 0, &tmp2
|
||||||
, piece_picker::fast, options, empty_vector);
|
, piece_picker::fast, options | piece_picker::speed_affinity, empty_vector);
|
||||||
TEST_CHECK(picked.size() == 7 * blocks_per_piece - 1);
|
TEST_CHECK(picked.size() == 7 * blocks_per_piece - 1);
|
||||||
TEST_CHECK(std::find(picked.begin(), picked.end(), piece_block(2,2)) == picked.end());
|
TEST_CHECK(std::find(picked.begin(), picked.end(), piece_block(2,2)) == picked.end());
|
||||||
// piece 2 sould be the last one (least matching piece to pick)
|
// piece 2 sould be the last one (least matching piece to pick)
|
||||||
|
@ -673,7 +673,8 @@ int test_main()
|
||||||
p->mark_as_downloading(piece_block(2,2), &tmp1, piece_picker::medium);
|
p->mark_as_downloading(piece_block(2,2), &tmp1, piece_picker::medium);
|
||||||
p->mark_as_downloading(piece_block(4,2), &tmp1, piece_picker::fast);
|
p->mark_as_downloading(piece_block(4,2), &tmp1, piece_picker::fast);
|
||||||
picked = pick_pieces(p, "*******", 2 * blocks_per_piece, 0, 0
|
picked = pick_pieces(p, "*******", 2 * blocks_per_piece, 0, 0
|
||||||
, piece_picker::fast, piece_picker::prioritize_partials, empty_vector);
|
, piece_picker::fast, piece_picker::prioritize_partials | piece_picker::speed_affinity
|
||||||
|
, empty_vector);
|
||||||
TEST_CHECK(picked.size() == 2 * blocks_per_piece);
|
TEST_CHECK(picked.size() == 2 * blocks_per_piece);
|
||||||
TEST_CHECK(picked[0].piece_index == 4);
|
TEST_CHECK(picked[0].piece_index == 4);
|
||||||
TEST_CHECK(picked[blocks_per_piece - 1].piece_index == 2);
|
TEST_CHECK(picked[blocks_per_piece - 1].piece_index == 2);
|
||||||
|
|
Loading…
Reference in New Issue