more storage state machine fixes, added test to storage unit test and fix in file::set_size

This commit is contained in:
Arvid Norberg
2007-05-31 23:35:48 +00:00
parent 61f9315e34
commit aea4e503c5
3 changed files with 43 additions and 36 deletions

View File

@@ -16,7 +16,7 @@ using namespace boost::filesystem;
const int piece_size = 16;
void run_storage_tests(torrent_info& info)
void run_storage_tests(torrent_info& info, bool compact_allocation = true)
{
const int half = piece_size / 2;
@@ -81,7 +81,8 @@ void run_storage_tests(torrent_info& info)
std::vector<bool> pieces;
num_pieces = 0;
TEST_CHECK(pm.check_fastresume(d, pieces, num_pieces, true) == false);
TEST_CHECK(pm.check_fastresume(d, pieces, num_pieces
, compact_allocation) == false);
bool finished = false;
float progress;
num_pieces = 0;
@@ -142,6 +143,15 @@ int test_main()
TEST_CHECK(file_size(initial_path() / "temp_storage" / "test1.tmp") == 48);
remove_all(initial_path() / "temp_storage");
// make sure full allocation mode actually allocates the files
// and creates the directories
run_storage_tests(info, false);
std::cerr << file_size(initial_path() / "temp_storage" / "test1.tmp") << std::endl;
TEST_CHECK(file_size(initial_path() / "temp_storage" / "test1.tmp") == 17 + 612 + 1);
remove_all(initial_path() / "temp_storage");
return 0;
}