Skip to content

Commit

Permalink
test for decoding output that matches signature
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 committed Sep 11, 2024
1 parent f5ab1ac commit f1cf640
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/abi/type_decoder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,22 @@ defmodule ABI.TypeDecoderTest do
TypeDecoder.decode(data, selector)
end
end

test "decodes output that matches signature" do
selector = %FunctionSelector{
function: "baz",
method_id: <<199, 158, 242, 32>>,
types: [
{:int, 8},
{:int, 256}
],
returns: [{:bytes, 4}]
}

result_to_decode = TypeEncoder.encode([selector.method_id], [{:bytes, 4}])

assert TypeDecoder.decode(result_to_decode, selector, :output) == [selector.method_id]
end
end

describe "with examples from solidity docs" do
Expand Down

0 comments on commit f1cf640

Please sign in to comment.