seen_files.size
end
+ def files_size
+ # Return the total size of all files in this manifest.
+ files.reduce(0) { |total, (_, _, size)| total + size }
+ end
+
def exact_file_count?(want_count)
files_count(want_count + 1) == want_count
end
assert_equal(0, Keep::Manifest.new("").files_count)
end
+ def test_empty_files_size
+ assert_equal(0, Keep::Manifest.new("").files_size)
+ end
+
def test_empty_has_file?
refute(Keep::Manifest.new("").has_file?(""))
end
refute(manifest.exact_file_count?(6), "+1 file count true")
end
+ def test_files_size_multiblock
+ assert_equal(22, Keep::Manifest.new(MULTIBLOCK_FILE_MANIFEST).files_size)
+ end
+
+ def test_files_size_with_skipped_overlapping_data
+ manifest = Keep::Manifest.new(". #{random_block(9)} 3:3:f1 5:3:f2\n")
+ assert_equal(6, manifest.files_size)
+ end
+
def test_has_file
manifest = Keep::Manifest.new(MULTIBLOCK_FILE_MANIFEST)
assert(manifest.has_file?("./repfile"), "one-arg repfile not found")