<commit_before>-module(ring_bytecode_aevm_SUITE).

%% common_test exports
-export(
   [
    all/0
   ]).

%% test case exports
-export(
   [ execute_identy_fun_from_ring_file/1
   ]).

-include_lib("common_test/include/ct.hrl").

all() ->
    [ execute_identy_fun_from_ring_file ].

execute_identy_fun_from_ring_file(_Cfg) ->
    CodeDir = code:lib_dir(aering, test),
    FileName = filename:join(CodeDir, "contracts/identity.aer"),
    {ok, ContractBin} = file:read_file(FileName),
    Contract = binary_to_list(ContractBin),
    Code = aer_compiler:from_string(Contract,
                                    [pp_icode,
                                     pp_assembler,
                                     pp_bytecode]),
    Res = 
        aevm_eeevm:eval(
          aevm_eeevm_state:init(
            #{ exec => #{ code => Code,
                          address => 0,
                          caller => 0,
                          data => <<0:256, 42:256>>,
                          gas => 1000000,
                          gasPrice => 1,
                          origin => 0,
                          value => 0 },
               env => #{currentCoinbase => 0,
                        currentDifficulty => 0,
                        currentGasLimit => 10000,
                        currentNumber => 0,
                        currentTimestamp => 0},
               pre => #{}},
            #{trace => true})
         ),
    #{ out := << RetVal:256 >> } = Res,
    42 = RetVal,
    ok.

<commit_msg>Update test case to new dispatcher<commit_after>-module(ring_bytecode_aevm_SUITE).

%% common_test exports
-export(
   [
    all/0
   ]).

%% test case exports
-export(
   [ execute_identy_fun_from_ring_file/1
   ]).

-include_lib("common_test/include/ct.hrl").

all() ->
    [ execute_identy_fun_from_ring_file ].

execute_identy_fun_from_ring_file(_Cfg) ->
    CodeDir = code:lib_dir(aering, test),
    FileName = filename:join(CodeDir, "contracts/identity.aer"),
    {ok, ContractBin} = file:read_file(FileName),
    Contract = binary_to_list(ContractBin),
    Code = aer_compiler:from_string(Contract,
                                    [pp_icode,
                                     pp_assembler,
                                     pp_bytecode]),
    ok = aeb_disassemble:pp(Code),

    %% Create the call data
    Call = {<<"main">>, 42},
    {0, Data} = aer_data:to_binary(Call),
    Res =
        aevm_eeevm:eval(
          aevm_eeevm_state:init(
            #{ exec => #{ code => Code,
                          address => 0,
                          caller => 0,
                          data => Data,
                          gas => 1000000,
                          gasPrice => 1,
                          origin => 0,
                          value => 0 },
               env => #{currentCoinbase => 0,
                        currentDifficulty => 0,
                        currentGasLimit => 10000,
                        currentNumber => 0,
                        currentTimestamp => 0},
               pre => #{}},
            #{trace => true})
         ),
    #{ stack := [RetVal] } = Res,
    42 = RetVal,
    ok.


{'fraction_non_alphanumeric': 0.11660329531051965, 'fraction_numerical': 0.020595690747782003, 'mean_word_length': 1.306062819576333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1191386', 'n_tokens_mistral': 974, 'n_tokens_neox': 899, 'n_words': 158}