Search in sources :

Example 6 with ProgramResult

use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.

the class ProgramTest method returnDataSizeTests.

@Test
public void returnDataSizeTests() {
    ProgramResult result = TestContract.returnDataTest().executeFunction("testSize", BigInteger.ZERO);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
}
Also used : ProgramResult(org.ethereum.vm.program.ProgramResult) Test(org.junit.Test)

Example 7 with ProgramResult

use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.

the class ProgramTest method childContractDoesntInheritMsgValue.

@Test
public void childContractDoesntInheritMsgValue() {
    ProgramResult result = TestContract.parent().executeFunction("createChild", BigInteger.TEN);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
}
Also used : ProgramResult(org.ethereum.vm.program.ProgramResult) Test(org.junit.Test)

Example 8 with ProgramResult

use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.

the class ProgramTest method childContractGetsStipend.

@Test
public void childContractGetsStipend() {
    ProgramResult result = TestContract.bankTest().executeFunction("test", BigInteger.TEN);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
    Assert.assertArrayEquals(new Object[] { BigInteger.valueOf(43) }, TestContract.bankTest().functions.get("test").decodeResult(result.getHReturn()));
}
Also used : ProgramResult(org.ethereum.vm.program.ProgramResult) Test(org.junit.Test)

Example 9 with ProgramResult

use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.

the class ProgramTest method helloContract.

@Test
public void helloContract() {
    ProgramResult result = TestContract.hello().executeFunction("hello", BigInteger.ZERO);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
    Assert.assertArrayEquals(new String[] { "chinchilla" }, TestContract.hello().functions.get("hello").decodeResult(result.getHReturn()));
}
Also used : ProgramResult(org.ethereum.vm.program.ProgramResult) Test(org.junit.Test)

Example 10 with ProgramResult

use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.

the class ProgramTest method returnDataCopyTest.

@Test
public void returnDataCopyTest() {
    TestContract contract = TestContract.returnDataTest();
    ProgramResult result = contract.executeFunction("testCopy", BigInteger.ZERO);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
    Assert.assertArrayEquals(new Object[] { LOREM_IPSUM }, contract.functions.get("testCopy").decodeResult(result.getHReturn()));
}
Also used : TestContract(co.rsk.util.TestContract) ProgramResult(org.ethereum.vm.program.ProgramResult) Test(org.junit.Test)

Aggregations

ProgramResult (org.ethereum.vm.program.ProgramResult)23 Test (org.junit.Test)19 Block (org.ethereum.core.Block)6 TestContract (co.rsk.util.TestContract)5 CallTransaction (org.ethereum.core.CallTransaction)4 ContractDetails (org.ethereum.db.ContractDetails)4 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)2 BigInteger (java.math.BigInteger)2 BlockStoreDummy (org.ethereum.db.BlockStoreDummy)2 StateTestSuite (org.ethereum.jsontestsuite.StateTestSuite)2 StateTestRunner (org.ethereum.jsontestsuite.runners.StateTestRunner)2 ReversibleTransactionExecutor (co.rsk.core.ReversibleTransactionExecutor)1 RskAddress (co.rsk.core.RskAddress)1 BlockChainImpl (co.rsk.core.bc.BlockChainImpl)1 MinerClient (co.rsk.mine.MinerClient)1 Web3RskImpl (co.rsk.rpc.Web3RskImpl)1 EthModule (co.rsk.rpc.modules.eth.EthModule)1 EthModuleSolidityDisabled (co.rsk.rpc.modules.eth.EthModuleSolidityDisabled)1 EthModuleWalletEnabled (co.rsk.rpc.modules.eth.EthModuleWalletEnabled)1 PersonalModuleWalletEnabled (co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled)1