     [encode_value(name), <<ptr :: 32-signed>>, type_to_int(type)]
   end
 
+  # Encodes a value inferring its type.
+  # Made public for testing.
   @doc false
   def encode_value(value, offset \\ 0)
 
-  def encode_value({type, value}, offset) do
-    encode_type(value, type, offset)
-  end
-
-  def encode_value(value, offset) do
-    encode_type(value, infer_type(value), offset)
-  end
+  def encode_value({type, value}, offset),
+    do: encode_type(value, type, offset)
+  def encode_value(value, offset),
+    do: encode_type(value, infer_type(value), offset)
 
   defp encode_type(value, type, offset)
 


    case :small_ints.decode_zigzag_varint(data) do
      {0, rest} ->
        # Remember to return `rest` and not `data` since `rest` doesn't contain
        # the 0 byte that signals the end of the header, while `data` does.
        {Enum.reverse(acc), rest}
      {i, rest} when i < 0 ->
        case decode_property_definition(rest, i, schema) do
          {field, rest} ->
            decode_header(rest, schema, [field|acc])
          :unknown_property_id ->
            :unknown_property_id
        end
      {i, _} when i > 0 ->
        {field, rest} = decode_field_definition(data)

    [Enum.reverse(fields), 0, Enum.reverse(values)]
  end

  defp header_offset(fields) do
    # The last +1 is for the `0` that signals the end of the header.
    fields
