Skip to content

Instantly share code, notes, and snippets.

@maheshmurthy
Created April 19, 2018 18:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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