def random_block(size=nil)
sprintf("%032x+%d", rand(16 ** 32), size || rand(64 * 1024 * 1024))
end
+
+ def random_blocks(count, size=nil)
+ (0...count).map { |_| random_block(size) }
+ end
end
extend StaticMethods
NONNORMALIZED_MANIFEST =
["./dir2 #{random_block} 0:0:z 0:0:y 0:0:x",
"./dir1 #{random_block} 0:0:p 0:0:o 0:0:n\n"].join("\n")
+ MANIFEST_WITH_DIRS_IN_FILENAMES =
+ [". #{random_block(10)} 0:3:file1 3:3:dir1/file1 6:3:dir1/dir2/file1\n"].join("")
+ MULTILEVEL_MANIFEST_WITH_DIRS_IN_FILENAMES =
+ [". #{random_block(10)} 0:3:file1 3:3:dir1/file1 6:4:dir1/dir2/file1\n",
+ "./dir1 #{random_block(10)} 0:3:file1 3:7:dir2/file1\n"].join("")
+
+ ### Non-tree manifests
+ # These manifests follow the spec, but they express a structure that can't
+ # can't be represented by a POSIX filesystem tree. For example, there's a
+ # name conflict between a stream and a filename.
+ NAME_CONFLICT_MANIFEST =
+ [". #{random_block(9)} 0:9:conflict",
+ "./conflict #{random_block} 0:0:name\n"].join("\n")
end