Created
April 19, 2018 18:38
-
-
Save maheshmurthy/567e53f89762d7d4c713b8d9114631ef to your computer and use it in GitHub Desktop.
Failing test
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.18; | |
contract MyContract { | |
mapping(address => uint) totalTokens; | |
function buy() payable public { | |
totalTokens[msg.sender] = msg.value; | |
} | |
function tokenCount(address addr) public view returns (uint) { | |
return totalTokens[addr]; | |
} | |
} |
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.18; | |
import "truffle/Assert.sol"; | |
import "truffle/DeployedAddresses.sol"; | |
import "../contracts/MyContract.sol"; | |
contract TestMyContract { | |
function testBuyTokens() public { | |
MyContract c = MyContract(DeployedAddresses.MyContract()); | |
c.buy.value(1 ether)(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment