anchor.diff:      binary_skip_bytes(B, L, 0, []).
   
   %% @private
  +-spec binary_skip_bytes(binary(), [non_neg_integer()], non_neg_integer(), iolist()) -> binary().
   binary_skip_bytes(B, [], _N, Acc) ->
       iolist_to_binary(lists:reverse([B | Acc]));
   binary_skip_bytes(<<_, RestB/binary>>, [N | RestL], N, Acc) ->
  
positive.code: binary_skip_bytes(<<C, RestB/binary>>, L, N, Acc) ->
      binary_skip_bytes(RestB, L, 1 + N, [C | Acc]).
  
  %% @spec invalid_utf8_indexes(B::binary()) -> [integer()]
  %% @doc Return the 0-based indexes in B that are not valid UTF-8.
  invalid_utf8_indexes(B) ->
      invalid_utf8_indexes(B, 0, []).
  
  %% @private.
  invalid_utf8_indexes(<<C, Rest/binary>>, N, Acc) when C < 16#80 ->
      %% U+0000 - U+007F - 7 bits
      invalid_utf8_indexes(Rest, 1 + N, Acc);
  
negative.code:        codepoint_to_bytes(16#10ffff)),
      ok.
  
  bytes_foldl_test() ->
      ?assertEqual(
         <<"abc">>,
         bytes_foldl(fun (B, Acc) -> <<Acc/binary, B/binary>> end, <<>>, <<"abc">>)),
      ?assertEqual(
         <<"abc", 226, 152, 131, 228, 184, 173, 194, 133, 244,143,191,191>>,
         bytes_foldl(fun (B, Acc) -> <<Acc/binary, B/binary>> end, <<>>,
                     <<"abc", 226, 152, 131, 228, 184, 173, 194, 133, 244,143,191,191>>)),
      ok.
  
  bytes_to_codepoints_test() ->
      ?assertEqual(
         "abc" ++ [16#2603, 16#4e2d, 16#85, 16#10ffff],
         bytes_to_codepoints(<<"abc", 226, 152, 131, 228, 184, 173, 194, 133, 244,143,191,191>>)),
      ok.
  
  codepoint_foldl_test() ->
      ?assertEqual(
         "cba",
         codepoint_foldl(fun (C, Acc) -> [C | Acc] end, [], <<"abc">>)),
      ?assertEqual(
         [16#10ffff, 16#85, 16#4e2d, 16#2603 | "cba"],
         codepoint_foldl(fun (C, Acc) -> [C | Acc] end, [],
                         <<"abc", 226, 152, 131, 228, 184, 173, 194, 133, 244,143,191,191>>)),
      ok.
  
  len_test() ->
      ?assertEqual(
         29,
         len(<<"unicode snowman for you: ", 226, 152, 131, 228, 184, 173, 194, 133, 244, 143, 191, 191>>)),
      ok.
  
  codepoints_to_bytes_test() ->
      ?assertEqual(
         iolist_to_binary(lists:map(fun codepoint_to_bytes/1, lists:seq(1, 1000))),
         codepoints_to_bytes(lists:seq(1, 1000))),
      ok.
  
  valid_utf8_bytes_test() ->
      ?assertEqual(
         <<"invalid U+11ffff: ">>,
  