anchor.diff:                   catch file:close(FH),
                    File = integer_to_list(Moment rem S0#slide.window),
                    {ok, FH2} = file:open(filename:join(Dir, File),
  -                                       [write, raw, binary, delayed_write]),
  +                                       file_write_options()),
                    S0#slide{readings_m = Moment,
                             readings_fh = FH2,
                             oldest = if Oldest == undefined ->
  
positive.code:     S3 = slide:update(S2, 7, 5),
      ?assertEqual({3, 15}, % three points (two concurrent), sum = 15
                   slide:sum(S3, 9, 10)),
      S4 = slide:update(S3, 11, 14),
      ?assertEqual({3, 23}, % ignoring first reading, sum = 23
                   slide:sum(S4, 14, 10)),
      ?assertEqual({1, 11}, % shifted window
                   slide:sum(S4, 18, 10)),
      S5 = slide:update(S4, 13, 22),
      ?assertEqual({1, 11}, % pruned early readings
                   slide:sum(S5, 14, 10)),
      ?assertEqual({2, 24}, % shifted window
                   slide:sum(S5, 22, 10)).
  
  mean_test() ->
      S0 = slide:fresh(10),
      ?assertEqual({0, undefined}, % no points, no average
                   slide:mean(S0)),
  
negative.code: %% Test
  %%
  
  setup_eunit_proc_dict() ->
      erlang:put({?MODULE, eunit}, true).
  
  file_write_options() ->
      case erlang:get({?MODULE, eunit}) of
          true ->
              [write, raw, binary];
          _ ->
              [write, raw, binary, delayed_write]
      end.
  
  -ifdef(TEST).
  
  auto_prune_test() ->
      S0 = slide:fresh(10),
      S1 = slide:update(S0, 5, 3),
      S1b = idle_time_passing(S1, 4, 13),
      S2 = slide:update(S1b, 6, 14),
      S2b = idle_time_passing(S2, 15, 15),
      ?assertEqual(6, element(2, slide:sum(S2b, 15, 10))).
  
  sum_test() ->
      setup_eunit_proc_dict(),
      S0 = slide:fresh(10),
      ?assertEqual({0, 0}, % no points, sum = 0
                   slide:sum(S0, 9, 10)),
  