gmserialization/test/gmser_contract_code_tests.erl
Craig Everett a6f09d24c0
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in -4m28s
41-types (#44)
Reviewed-on: #44
Co-authored-by: Craig Everett <zxq9@zxq9.com>
Co-committed-by: Craig Everett <zxq9@zxq9.com>
2025-01-21 14:21:38 +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)).