Created
October 29, 2018 21:55
-
-
Save 0mkara/f0e9caeb69b7c55b1246c5895f0769ab to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
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.4.7; | |
import "remix_tests.sol"; | |
contract SimpleStorage { | |
uint public storedData; | |
function SimpleStorage() 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.4.7; | |
import "./SimpleStorage.sol"; | |
contract SimpleStorageTest { | |
SimpleStorage foo; | |
uint i = 0; | |
function beforeAll() { | |
foo = new SimpleStorage(); | |
} | |
function beforeEach() { | |
if (i == 1) { | |
foo.set(200); | |
} | |
i += 1; | |
} | |
function initialValueShouldBe100() public { | |
Assert.equal(foo.get(), 100, "initial value is not correct"); | |
} | |
function initialValueShouldBe200() public { | |
Assert.equal(foo.get(), 200, "initial value is not correct"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment