Skip to content

Instantly share code, notes, and snippets.

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