anchor.diff:                              [],
                               Interval,
                               MaxNum),
  -    ?equals_w_note(lists:sort(ScrubbedData), lists:sort(AllFold), "test_foldl1"),
  -    ?equals_w_note(lists:sort(ExpInInterval), lists:sort(IntervalFold), "test_foldl2"),
  -    ?equals_w_note(lists:sort(ExpInIntervalCounted),
  -                   lists:sort(IntervalCountFold), "test_foldl3"),
  +    %% we expect all data from fold to be in reversed order because of list
  +    %% accumulation. we need to reverse ScrubbedData, ExpInInterval and
  +    %% ExpInIntervalCounted.
  +    ?equals_w_note(lists:reverse(ScrubbedData), AllFold, "test_foldl1"),
  +    ?equals_w_note(lists:reverse(ExpInInterval), IntervalFold, "test_foldl2"),
  +    ?equals_w_note(lists:reverse(ExpInIntervalCounted), IntervalCountFold, "test_foldl3"),
       ?TEST_DB:close(DB1),
       true.
   
  
positive.code:                             MaxNum),
      %% ct:pal("ExpInInterval: ~p~nIntervalFold: ~p~nInterval: ~p~n", [ExpInInterval,
      %%                                                  IntervalFold, Interval]),
      ?equals_w_note(lists:sort(ScrubbedData), lists:sort(AllFold), "test_foldr1"),
      ?equals_w_note(lists:sort(ExpInInterval), lists:sort(IntervalFold), "test_foldr2"),
      ?equals_w_note(lists:sort(ExpInIntervalCounted),
                     lists:sort(IntervalCountFold), "test_foldr3"),
      ?TEST_DB:close(DB1),
      true.
  
  
negative.code:     %% Entries should be unique
      SortFun = fun(A, B) -> (element(1, A) < element(1, B)) orelse
                             (element(1, A) ?EQ element(1, B)) end,
      lists:usort(SortFun, Data).
  
  check_db(DB, ExpData, Note) ->
      InDb = ?TEST_DB:foldl(DB, fun(E, AIn) -> [E | AIn] end, []),
  