Finally...
This commit is contained in:
+1
-10
@@ -339,7 +339,7 @@ id_serialization() ->
|
||||
Lines = [io_lib:format("~b|~ts", [Tag, bin_to_hex(B)]) || {Tag, B} <- Cases],
|
||||
ok = filelib:ensure_dir(TestFile),
|
||||
ok = file:write_file(TestFile, unicode:characters_to_binary([[L, "\n"] || L <- Lines])),
|
||||
Expected = [bin_to_hex(gmser_id:encode(gmser_id:create(tag_to_erl(T), B))) || {T, B} <- Cases],
|
||||
Expected = [bin_to_hex(gmser_id:encode(gmser_id:decode(<<T:8, B/binary>>))) || {T, B} <- Cases],
|
||||
Run = "bin/run id_serialization " ++ Temp,
|
||||
Out = trim(os:cmd(Run)),
|
||||
{ok, JOutContent} = file:read_file(trim(Out)),
|
||||
@@ -495,15 +495,6 @@ pack_p(V) ->
|
||||
Size = byte_size(Enc),
|
||||
if Size < 32 -> <<Enc/binary, 0:(8*(32-Size))>>; true -> Enc end.
|
||||
|
||||
tag_to_erl(1) -> account;
|
||||
tag_to_erl(2) -> name;
|
||||
tag_to_erl(3) -> commitment;
|
||||
tag_to_erl(5) -> contract;
|
||||
tag_to_erl(6) -> channel;
|
||||
tag_to_erl(7) -> associate_chain;
|
||||
tag_to_erl(8) -> native_token;
|
||||
tag_to_erl(9) -> entry.
|
||||
|
||||
bin_to_hex(Bin) ->
|
||||
lists:flatten([io_lib:format("~2.16.0b", [X]) || X <- binary_to_list(Bin)]).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user