How do I test a contract with that has construction parameters? For example what if I had slightly modified the metacoin example contract to include an initial_balance
contract MetaCoin {
mapping (address => uint) balances;
function MetaCoin(uint initial_balance) {
balances[tx.origin] = initial_balance;
}
...
How do I modify the example TestMetacoin.sol
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/MetaCoin.sol";
contract TestMetacoin {
function testInitialBalanceUsingDeployedContract() {
MetaCoin meta = MetaCoin(DeployedAddresses.MetaCoin());
uint expected = 10000;
Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially");
}
...
AFAIK the truffle test
runner deploys the contracts and the Metacoin(DeployedAddresses.Metacoin())
gets the deployed contract to test. But I don't see any way to pass in the initial_balance
to test it.