Fixed a type error and test, definitely WIP

This commit is contained in:
Robert Virding 2019-04-25 12:19:49 +02:00
parent 2d3e6ab6e0
commit 5455d0fcd7
2 changed files with 4 additions and 4 deletions

View File

@ -383,7 +383,7 @@ do_decode_args(As) ->
Das = [ do_decode_arg(A) || A <- As ], Das = [ do_decode_arg(A) || A <- As ],
[$(,lists:join(", ", Das),$)]. [$(,lists:join(", ", Das),$)].
do_decode_arg(#{<<"type">> := [T]}) -> do_decode_type(T). do_decode_arg(#{<<"type">> := T}) -> do_decode_type(T).
do_decode_types(Ets) -> do_decode_types(Ets) ->
[ do_decode_type(Et) || Et <- Ets ]. [ do_decode_type(Et) || Et <- Ets ].

View File

@ -24,7 +24,7 @@ test_cases(1) ->
[#{<<"name">> => <<"a">>, [#{<<"name">> => <<"a">>,
<<"arguments">> => <<"arguments">> =>
[#{<<"name">> => <<"i">>, [#{<<"name">> => <<"i">>,
<<"type">> => [<<"int">>]}], <<"type">> => <<"int">>}],
<<"returns">> => <<"int">>, <<"returns">> => <<"int">>,
<<"stateful">> => false}]}}, <<"stateful">> => false}]}},
DecACI = <<"contract C =\n" DecACI = <<"contract C =\n"
@ -44,7 +44,7 @@ test_cases(2) ->
<<"functions">> => <<"functions">> =>
[#{<<"arguments">> => [#{<<"arguments">> =>
[#{<<"name">> => <<"i">>, [#{<<"name">> => <<"i">>,
<<"type">> => [<<"int">>]}], <<"type">> => <<"int">>}],
<<"name">> => <<"a">>, <<"name">> => <<"a">>,
<<"returns">> => <<"int">>, <<"returns">> => <<"int">>,
<<"stateful">> => false}]}}, <<"stateful">> => false}]}},
@ -60,7 +60,7 @@ test_cases(3) ->
[#{<<"arguments">> => [#{<<"arguments">> =>
[#{<<"name">> => <<"i">>, [#{<<"name">> => <<"i">>,
<<"type">> => <<"type">> =>
[#{<<"C.bert">> => [<<"string">>]}]}], #{<<"C.bert">> => [<<"string">>]}}],
<<"name">> => <<"a">>,<<"returns">> => <<"int">>, <<"name">> => <<"a">>,<<"returns">> => <<"int">>,
<<"stateful">> => false}], <<"stateful">> => false}],
<<"name">> => <<"C">>, <<"name">> => <<"C">>,