Skip to content

Commit

Permalink
Frequency distribution counts gotta sum up to sample size
Browse files Browse the repository at this point in the history
New property 🎉

I think now it's harder to write an implementation that is wrong
that passes the property than the other way around.
  • Loading branch information
PragTob committed Jul 4, 2019
1 parent 9a73091 commit 7fcb588
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/statistex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ defmodule Statistex.StatistexTest do
assert value >= 1
assert is_integer(value)
end)

# counts some up to sample_size
count_sum =
stats.frequency_distribution
|> Map.values()
|> Enum.sum()

assert count_sum == stats.sample_size
end

defp big_list_big_floats do
Expand Down

0 comments on commit 7fcb588

Please sign in to comment.