Created
January 20, 2019 20:57
-
-
Save nobodyzxc/19e0c625562b994afe0046b3b0646e42 to your computer and use it in GitHub Desktop.
Remix Unit Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◼ MyTest | |
[02:35:23] payload method is eth_gasPrice | |
[02:35:23] payload method is eth_sendTransaction | |
[02:35:23] payload method is eth_getTransactionReceipt | |
[02:35:23] payload method is eth_gasPrice | |
[02:35:23] payload method is eth_sendTransaction | |
[02:35:23] payload method is eth_getTransactionReceipt | |
[02:35:23] payload method is eth_gasPrice | |
[02:35:23] payload method is eth_sendTransaction | |
[02:35:23] payload method is eth_getTransactionReceipt | |
✓ Initial value should be100 | |
[02:35:23] payload method is eth_gasPrice | |
[02:35:23] payload method is eth_sendTransaction | |
[02:35:23] payload method is eth_getTransactionReceipt | |
[02:35:23] payload method is eth_call | |
✓ Initial value should be200 | |
2 passing (1s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract SimpleStorage { | |
uint public storedData; | |
constructor() public { | |
storedData = 100; | |
} | |
function set(uint x) public { | |
storedData = x; | |
} | |
function get() public view returns (uint retVal) { | |
return storedData; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
import "./simple_storage.sol"; | |
contract MyTest { | |
SimpleStorage foo; | |
uint i = 0; | |
function beforeAll() public { | |
foo = new SimpleStorage(); | |
} | |
function beforeEach() public { | |
if (i == 1) { | |
foo.set(200); | |
} | |
i += 1; | |
} | |
function initialValueShouldBe100() public { | |
Assert.equal(foo.get(), 100, "initial value is not correct"); | |
} | |
function initialValueShouldBe200() public view returns (bool) { | |
return foo.get() == 200; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment