Skip to content
Permalink
Browse files
Added unit tests for stats_subset
  • Loading branch information
uwiger committed Nov 4, 2013
1 parent 9a61504 commit d278aae0be7f1288bb94e7bc8edae92af1ec2071
Showing 2 changed files with 26 additions and 0 deletions.
@@ -532,3 +532,4 @@ test_values() ->
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
9,9,9,9,9,9,9].

@@ -235,3 +235,28 @@ tied_rank_worker_test() ->
?assertEqual([{2.0,5},{2.0,5},{2.0,5},{2.0,5}], bear:tied_rank_worker([], [{2.0,5}], {[1,2,3], 5})),
?assertEqual([{2.0,5},{2.0,5},{2.0,5},{2.0,5},{2.0,5},{2.0,5}],
bear:tied_rank_worker([{2.0,5},{2.0,5}], [{2.0,5}], {[1,2,3], 5})).

subset_test() ->
Stats = bear:get_statistics(bear:test_values()),
match_values(Stats).

full_subset_test() ->
Stats = bear:get_statistics(bear:test_values()),
match_values2(Stats).

match_values([H|T]) ->
Res = bear:get_statistics_subset(bear:test_values(), [mk_item(H)]),
Res = [H],
match_values(T);
match_values([]) ->
ok.

mk_item({percentile, Ps}) ->
{percentile, [P || {P,_} <- Ps]};
mk_item({K, _}) ->
K.

match_values2(Stats) ->
Items = [mk_item(I) || I <- Stats],
Stats = bear:get_statistics_subset(bear:test_values(), Items),
ok.

0 comments on commit d278aae

Please sign in to comment.