anchor.diff:      avg_open_count_per_day_parameter_should_be_bounded_by_custom_value/1,
       changing_max_avg_open_count_per_day_limit_should_reindex_the_file/1,
       changing_last_open_weight_should_reindex_the_file/1,
  -    changing_avg_open_count_weight_should_reindex_the_file/1
  +    changing_avg_open_count_weight_should_reindex_the_file/1,
  +    time_warp_test/1
   ]).
   
   %% view_traverse callbacks
  
positive.code:     Case == query_should_return_files_sorted_by_increasing_last_open_timestamp;
      Case == file_should_have_correct_popularity_value;
      Case == file_should_have_correct_popularity_value2;
      Case == file_should_have_correct_popularity_value3
  ->
      clock_freezer_mock:setup_on_nodes(?config(op_worker_nodes, Config), [file_popularity]),
      init_per_testcase(default, Config);
  
negative.code:     {ok, FileId3} = file_id:guid_to_objectid(G3),
  
      ?assertMatch([{FileId1, _}, {FileId2, _}, {FileId3, _}], query(W, ?SPACE_ID, #{}), ?ATTEMPTS).
  
  time_warp_test(Config) ->
      [W | _] = ?config(op_worker_nodes, Config),
      ok = enable_file_popularity(W, ?SPACE_ID),
      FileName1 = <<"file1">>,
      FileName2 = <<"file2">>,
      FileName3 = <<"file3">>,
      FilePath1 = ?FILE_PATH(FileName1),
      FilePath2 = ?FILE_PATH(FileName2),
      FilePath3 = ?FILE_PATH(FileName3),
  
      % simulate each next file being opened one hour BEFORE the previous one (due to a time warp)
      {ok, G1} = lfm_proxy:create(W, ?SESSION(W, Config), FilePath1, 8#664),
      {ok, H1} = lfm_proxy:open(W, ?SESSION(W, Config), {guid, G1}, read), % 1 hour before query
      ok = lfm_proxy:close(W, H1),
      clock_freezer_mock:simulate_seconds_passing(-3600),
  
      {ok, G2} = lfm_proxy:create(W, ?SESSION(W, Config), FilePath2, 8#664),
      {ok, H2} = lfm_proxy:open(W, ?SESSION(W, Config), {guid, G2}, read), % 2 hours before query
      ok = lfm_proxy:close(W, H2),
      clock_freezer_mock:simulate_seconds_passing(-3600),
  
      {ok, G3} = lfm_proxy:create(W, ?SESSION(W, Config), FilePath3, 8#664),
      {ok, H3} = lfm_proxy:open(W, ?SESSION(W, Config), {guid, G3}, read), % 3 hour before query
      ok = lfm_proxy:close(W, H3),
      clock_freezer_mock:simulate_seconds_passing(-3600),
  
      {ok, FileId1} = file_id:guid_to_objectid(G1),
      {ok, FileId2} = file_id:guid_to_objectid(G2),
      {ok, FileId3} = file_id:guid_to_objectid(G3),
  
      ?assertMatch([{FileId3, _}, {FileId2, _}, {FileId1, _}], query(W, ?SPACE_ID, #{}), ?ATTEMPTS).
  
  %%%===================================================================
  %%% Test base functions
  