Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Good General Cauchy Matrices #2

Merged
merged 14 commits into from
Jan 7, 2019
Prev Previous commit
Next Next commit
Add test for higer w than default
  • Loading branch information
vihu committed Jan 3, 2019
commit d6d7083f81f110fe624d45b8c98ee98028631da6
19 changes: 17 additions & 2 deletions test/erasure_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

-export([
simple_test/1,
cauchy_test/1
cauchy_test/1,
cauchy_higher_w_test/1
]).

all() ->
[
simple_test,
cauchy_test
cauchy_test,
cauchy_higher_w_test
].


Expand Down Expand Up @@ -58,3 +60,16 @@ cauchy_test(Config) ->
?assertMatch({error, _}, erasure:decode_gc(K, M, W, lists:sublist(Shards, K - 1))),
?assertMatch({error, _}, erasure:decode_gc(K, M, W, lists:sublist(Shards, K - 1) ++ [hd(Shards)])),
ok.

cauchy_higher_w_test(Config) ->
K = proplists:get_value(k, Config),
M = proplists:get_value(m, Config),
W = proplists:get_value(w, Config) + 5,
Data = proplists:get_value(data, Config),
{ok, Shards} = erasure:encode_gc(K, M, W, Data),
?assertEqual({ok, Data}, erasure:decode_gc(K, M, W, Shards)),
?assertEqual({ok, Data}, erasure:decode_gc(K, M, W, lists:sublist(Shards, K))),
?assertEqual({ok, Data}, erasure:decode_gc(K, M, W, lists:reverse(lists:sublist(Shards, K)))),
?assertMatch({error, _}, erasure:decode_gc(K, M, W, lists:sublist(Shards, K - 1))),
?assertMatch({error, _}, erasure:decode_gc(K, M, W, lists:sublist(Shards, K - 1) ++ [hd(Shards)])),
ok.