anchor.diff:        [{timeout, 100, %% timeout for each test
           [{TestDescr, TestFun}]}
          || {TestDescr, TestFun} <- Tests1]}}.
  +
  +nif_encode_decode_maps_() ->
  +    ProtocCanMapfields = check_protoc_can_do_mapfields(),
  +    {Descr, Tests} =
  +        if ProtocCanMapfields ->
  +                {"Nif with map<_,_> fields",
  +                 [{"encode decode", fun nif_encode_decode_maps/0}]};
  +           true ->
  +                {"Protoc < 3.0.0, not testing nifs with map<_,_> fields", []}
  +        end,
  +    {Descr,
  +     {timeout, 300,  %% timeout for all tests
  +      [{timeout, 100, %% timeout for each test
  +        [{TestDescr, TestFun}]}
  +       || {TestDescr, TestFun} <- Tests]}}.
   
   nif_compiles() ->
       with_tmpdir(
  
positive.code: 
  format_field(#?gpb_field{name=FName, fnum=FNum, type=Type,
                           occurrence=Occurrence}) ->
      f("  ~s ~s ~s = ~w;~n", [Occurrence, format_type(Type), FName, FNum]);
  format_field(#gpb_oneof{name=FName, fields=Fields}) ->
      f("  oneof ~s {~n"
        "~s"
  
negative.code:     [EnumDef, SubMsgDef, TopMsgDef1, TopMsgDef2, TopMsgDef3, StringMsg] ++
       [OneofMsg1 || check_protoc_can_do_oneof()].
  
  mk_one_map_field_of_each_type() ->
      %% Reduced set of int types to shorten compilation times,
      %% while still cover all code paths.
      ValueTypes = [sint32, sint64, uint32, uint64,
                    bool,
                    double, string, bytes,
                    float, {enum, ee}, {msg, submsg1}],
      KeyTypes   = [T || T <- ValueTypes, gpb:is_allowed_as_key_type(T)],
      %% Enum value in map must define 0 as the first value.
      EnumDef    = {{enum, ee}, [{en0, 0}, {en1, 1}, {en2, 2}]},
      SubMsgDef  = {{msg, submsg1}, mk_fields_of_type([uint32], required)},
      MapMsg1    = {{msg, map1},  mk_map_fields_of_type(KeyTypes, ValueTypes)},
      [EnumDef, SubMsgDef, MapMsg1].
  
  mk_fields_of_type(Types, Occurrence) ->
      Types1 = [Type || Type <- Types, can_do_nif_type(Type)],
      [#?gpb_field{name=list_to_atom(lists:concat([f,I])),
  