MCPcopy Create free account
hub / github.com/CPChain/chain / methodMultiReturn

Function methodMultiReturn

accounts/abi/unpack_test.go:362–376  ·  view source on GitHub ↗
(require *require.Assertions)

Source from the content-addressed store, hash-verified

360}
361
362func methodMultiReturn(require *require.Assertions) (ABI, []byte, methodMultiOutput) {
363 const definition = `[
364 { "name" : "multi", "constant" : false, "outputs": [ { "name": "Int", "type": "uint256" }, { "name": "String", "type": "string" } ] }]`
365 var expected = methodMultiOutput{big.NewInt(1), "hello"}
366
367 abi, err := JSON(strings.NewReader(definition))
368 require.NoError(err)
369 // using buff to make the code readable
370 buff := new(bytes.Buffer)
371 buff.Write(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000001"))
372 buff.Write(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000040"))
373 buff.Write(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000005"))
374 buff.Write(common.RightPadBytes([]byte(expected.String), 32))
375 return abi, buff.Bytes(), expected
376}
377
378func TestMethodMultiReturn(t *testing.T) {
379 type reversed struct {

Callers 1

TestMethodMultiReturnFunction · 0.85

Calls 3

JSONFunction · 0.85
WriteMethod · 0.65
BytesMethod · 0.65

Tested by

no test coverage detected