anchor.diff:                                        insert(V, H)
                                 end, new(P), generate_unique(Cardinality))
             end,
  -
  -    Report = lists:map(
  -               fun (Card) ->
  -                       CardString = string:left(integer_to_list(Card), 10, $ ),
  -
  -                       Estimate = trunc(card(Run(Card, 14))),
  -                       io_lib:format("~s ~p~n", [CardString, Estimate])
  -               end, lists:seq(0, 50000, 1000)),
  -    error_logger:info_msg("~s~n", [Report]).
  +    ExpectedError = 0.02,
  +    P = 14,
  +
  +    lists:foreach(fun (Card) ->
  +                          Estimate = trunc(card(Run(Card, P))),
  +                          ?assert(abs(Estimate - Card) < Card * ExpectedError)
  +                  end, lists:seq(1000, 50000, 1000)).
  +
   
   
   many_union_test() ->
  
positive.code:     UnionHyper = union(LeftHyper, RightHyper),
      Intersection = card(LeftHyper) + card(RightHyper) - card(UnionHyper),
  
      error_logger:info_msg("left distinct: ~p~n"
                            "right distinct: ~p~n"
                            "true union: ~p~n"
                            "true intersection: ~p~n"
                            "estimated union: ~p~n"
                            "estimated intersection: ~p~n",
                            [sets:size(LeftDistinct),
                             sets:size(RightDistinct),
                             sets:size(
                               sets:union(LeftDistinct, RightDistinct)),
                             sets:size(
                               sets:intersection(LeftDistinct, RightDistinct)),
                             card(UnionHyper),
                             Intersection
                            ]).
  
  intersect_card_test() ->
      random:seed(1, 2, 3),
  
negative.code:     Sets = [sets:from_list(generate_unique(Card)) || _ <- lists:seq(1, NumSets)],
      Filters = lists:map(fun (S) -> insert_many(sets:to_list(S), new(14)) end,
                          Sets),
      ?assert(abs(sets:size(sets:union(Sets)) - card(union(Filters)))
              < (Card * NumSets) * 0.1).
  
  