Skip to content

Commit

Permalink
get rid of my home directory for writing tree files
Browse files Browse the repository at this point in the history
  • Loading branch information
Cliff Moon committed May 31, 2010
1 parent c8a27ca commit 354247b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions apps/luwak/test/luwak_io_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ simple_get_range_test() ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,2},{tree_order,3}], dict:new()),
{ok, Written, File1} = luwak_io:put_range(Riak, File, 0, <<"fuckyourcouch">>),
Blocks = luwak_io:get_range(Riak, File1, 3, 5),
ok = file:write_file("/Users/cliff/tree4.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
ok = file:write_file("tree4.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
?assertEqual(<<"kyour">>, iolist_to_binary(Blocks))
end).

Expand All @@ -32,15 +32,15 @@ multilevel_get_range_test() ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, Written, File1} = luwak_io:put_range(Riak, File, 0, <<"wontyoupleasetouchmymonkey">>),
Blocks = luwak_io:get_range(Riak, File1, 4, 9),
ok = file:write_file("/Users/cliff/tree5.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
ok = file:write_file("tree5.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
?assertEqual(<<"youplease">>, iolist_to_binary(Blocks))
end).

eof_get_range_test() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, Written, File1} = luwak_io:put_range(Riak, File, 0, <<"wontyoupleasetouchmymonkey">>),
ok = file:write_file("/Users/cliff/tree6.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
ok = file:write_file("tree6.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
Blocks = luwak_io:get_range(Riak, File1, 20, 20),
?assertEqual(<<"monkey">>, iolist_to_binary(Blocks))
end).
Expand All @@ -50,7 +50,7 @@ truncate_test() ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, Written, File1} = luwak_io:put_range(Riak, File, 0, <<"wontyoupleasetouchmymonkey">>),
{ok, File2} = luwak_io:truncate(Riak, File1, 7),
ok = file:write_file("/Users/cliff/tree7.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
ok = file:write_file("tree7.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
Blocks = luwak_io:get_range(Riak, File2, 0, 7),
?assertEqual(<<"wontyou">>, iolist_to_binary(Blocks))
end).
4 changes: 2 additions & 2 deletions apps/luwak/test/luwak_put_stream_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ unaligned_put_stream_test() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _, File1} = luwak_io:put_range(Riak, File, 0, <<"heywhyareyoudrp">>),
ok = file:write_file("/Users/cliff/tree8.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
ok = file:write_file("tree8.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
PutStream = luwak_put_stream:start(Riak, File1, 4, 1000),
Input = [<<"her">>, <<"pdr">>, <<"p">>],
lists:foreach(fun(B) -> luwak_put_stream:send(PutStream, B) end, Input),
luwak_put_stream:close(PutStream),
{ok, File2} = luwak_put_stream:status(PutStream, 1000),
ok = file:write_file("/Users/cliff/tree9.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
ok = file:write_file("tree9.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
Blocks = luwak_io:get_range(Riak, File2, 0, 15),
timer:sleep(100),
?assertEqual(<<"heywherpdrpudrp">>, iolist_to_binary(Blocks))
Expand Down
4 changes: 2 additions & 2 deletions apps/luwak/test/luwak_tree_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ create_and_overwrite_multilevel_tree_test() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,5},{block_size,1}], dict:new()),
{ok, Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"fuckyourcouch">>),
% ok = file:write_file("/Users/cliff/tree1.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
% ok = file:write_file("tree1.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File2, root))),
{ok, Written2, File3} = luwak_io:put_range(Riak, File2, 1, <<"ballstoyou">>),
Blocks = [ {skerl:hexhash(512, list_to_binary([C])), 1} || C <- binary_to_list(<<"fballstoyouch">>) ],
{FirstNodeChildren, Tail1} = lists:split(5, Blocks),
Expand All @@ -73,7 +73,7 @@ create_and_overwrite_multilevel_tree_test() ->
Node3 = skerl:hexhash(512, term_to_binary(ThirdNodeChildren)),
RootChildren = [{Node1,5}, {Node2,5}, {Node3,3}],
Root1 = skerl:hexhash(512, term_to_binary(RootChildren)),
ok = file:write_file("/Users/cliff/tree2.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File3, root))),
ok = file:write_file("tree2.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File3, root))),
?assertEqual(Root1, luwak_file:get_property(File3, root)),
{ok, RootNode} = luwak_tree:get(Riak, Root1),
?assertEqual(RootChildren, RootNode#n.children),
Expand Down

0 comments on commit 354247b

Please sign in to comment.