mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-18 07:01:05 +00:00
integration: add function pointer integration test (#205)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": true,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "FunctionPointer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "26121ff0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
contract FunctionPointer {
|
||||||
|
bool public flag = false;
|
||||||
|
|
||||||
|
function f0() public {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f() public returns (bool) {
|
||||||
|
function() internal x = f0;
|
||||||
|
x();
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,6 +54,7 @@ test_spec!(coinbase, "Coinbase", "Coinbase.sol");
|
|||||||
test_spec!(create2, "CreateB", "Create2.sol");
|
test_spec!(create2, "CreateB", "Create2.sol");
|
||||||
test_spec!(transfer, "Transfer", "Transfer.sol");
|
test_spec!(transfer, "Transfer", "Transfer.sol");
|
||||||
test_spec!(send, "Send", "Send.sol");
|
test_spec!(send, "Send", "Send.sol");
|
||||||
|
test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol");
|
||||||
|
|
||||||
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
||||||
vec![Instantiate {
|
vec![Instantiate {
|
||||||
|
|||||||
Reference in New Issue
Block a user