Skip to content

Instantly share code, notes, and snippets.

@maheshmurthy
Created April 19, 2018 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshmurthy/567e53f89762d7d4c713b8d9114631ef to your computer and use it in GitHub Desktop.
Save maheshmurthy/567e53f89762d7d4c713b8d9114631ef to your computer and use it in GitHub Desktop.
Failing test
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];
}
}
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