anchor.diff:      include_doc,
       collect_changes,
       changes_feed_callback,
  -    heartbeat_collect_change
  +    heartbeat_collect_change,
  +    multiple_put
     ].
   
   init_per_suite(Config) ->
  
positive.code:   include_doc/1,
    collect_changes/1,
    changes_feed_callback/1,
    heartbeat_collect_change/1
  ]).
  
  -export([
  
negative.code:   [#{ <<"seq">> := 1, <<"id">> := <<"aa">>}] = barrel_httpc_changes:changes(Pid),
    [] = barrel_httpc_changes:changes(Pid),
    ok = barrel_httpc_changes:stop(Pid).
  
  multiple_put(Config) ->
    Self = self(),
    
    %% spawn a change listener
    spawn(
      fun() ->
        ChangePid = self(),
        Callback =
        fun(Change) ->
          ChangePid ! {change, Change}
        end,
        Options = #{since => 0, mode => sse, changes_cb => Callback },
        {ok, _Pid} = barrel_httpc_changes:start_link(db(Config), Options),
        Changes = collect_changes(1000, queue:new()),
        Self ! {changes, Changes}
      end
    ),
  
    %% write docs
    Pids = lists:foldl(
      fun(I, Acc) ->
        DocId = << "doc", (integer_to_binary(I))/binary >>,
        Doc = #{ <<"id">> => DocId, <<"val">> => I},
        Pid = spawn_link(
          fun() ->
            {ok, DocId, _} = barrel_httpc:put(db(Config), Doc, []),
            Self ! {ok, self()},
            timer:sleep(100)
          end
        ),
        [Pid | Acc]
      end,
      [],
      lists:seq(1, 1000)
    ),
  
    ok = wait_pids(Pids),
  
    #{ <<"docs_count">> := 1000 } = barrel_httpc:database_infos(?DB_URL),
    receive
      {changes, Changes} ->
        case length(Changes) of
          1000 -> ok;
          _ -> erlang:error(bad_changes_count)
        end
    end,
    ok.
  
    
  collect_changes(0, Q) ->
    queue:to_list(Q);
  