change create_calldata function to also take fun name and arguments

This commit is contained in:
Ulf Norell
2019-02-26 15:01:27 +01:00
parent cc3e322179
commit 5a4a84805f
2 changed files with 31 additions and 32 deletions
+5 -7
View File
@@ -70,15 +70,13 @@ encode_decode_sophia_test() ->
encode_decode_sophia_string(SophiaType, String) ->
io:format("String ~p~n", [String]),
TypeDefs = [" type an_alias('a) = (string, 'a)\n",
" record r = {x : an_alias(int), y : variant}\n"
" datatype variant = Red | Blue(map(string, int))\n"],
Code = [ "contract MakeCall =\n"
, " type arg_type = ", SophiaType, "\n"
, TypeDefs
, " function foo : arg_type => arg_type\n"
, " function __call() = foo(", String, ")\n" ],
case aeso_compiler:check_call(lists:flatten(Code), []) of
, " type an_alias('a) = (string, 'a)\n"
, " record r = {x : an_alias(int), y : variant}\n"
, " datatype variant = Red | Blue(map(string, int))\n"
, " function foo : arg_type => arg_type\n" ],
case aeso_compiler:check_call(lists:flatten(Code), "foo", [String], []) of
{ok, _, {[Type], _}, [Arg]} ->
io:format("Type ~p~n", [Type]),
Data = encode(Arg),