gmserialization/test/gmser_contract_code_tests.erl
Craig Everett 4b5cfcb67a
All checks were successful
Gajumaru Serialization Tests / tests (push) Successful in -4m21s
Remove old type references, update naming, add license notices (#43)
Removed the oracle type references and updated the dependency list to point to git.qpq.swiss.

Reviewed-on: #43
Co-authored-by: Craig Everett <zxq9@zxq9.com>
Co-committed-by: Craig Everett <zxq9@zxq9.com>
2025-01-22 13:22:03 +09:00

40 lines
1.3 KiB
Erlang

%%%-------------------------------------------------------------------
%%% @copyright (C) 2025, QPQ AG
%%%-------------------------------------------------------------------
-module(gmser_contract_code_tests).
-include_lib("eunit/include/eunit.hrl").
-include("gmser_contract_code.hrl").
-define(DUMMY_CODE_MAP_1,
#{ byte_code => <<"DUMMY CODE">>
, type_info => [{<<>>, <<>>, <<>>, <<>>}]
, contract_source => "contract Foo = ..." }).
-define(DUMMY_CODE_MAP_2,
#{ byte_code => <<"DUMMY CODE">>
, type_info => [{<<>>, <<>>, <<>>, <<>>}]
, compiler_version => <<"3.1.4">>
, source_hash => <<1, 2, 3, 4>> }).
-define(DUMMY_CODE_MAP_3,
#{ byte_code => <<"DUMMY CODE">>
, type_info => [{<<>>, <<>>, false, <<>>, <<>>}]
, compiler_version => <<"3.1.4">>
, contract_source => "contract Foo = ..."
, payable => true} ).
vsn_1_test() ->
gmser_contract_code:deserialize(
gmser_contract_code:serialize(?DUMMY_CODE_MAP_1, ?SOPHIA_CONTRACT_VSN_1)).
vsn_2_test() ->
gmser_contract_code:deserialize(
gmser_contract_code:serialize(?DUMMY_CODE_MAP_2, ?SOPHIA_CONTRACT_VSN_2)).
vsn_3_test() ->
gmser_contract_code:deserialize(
gmser_contract_code:serialize(?DUMMY_CODE_MAP_3, ?SOPHIA_CONTRACT_VSN_3)).