Unverified Commit 67a412b9 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1336 from ethereum/addSampleTest

add ballot_test
parents 46f4feb1 baa121cf
...@@ -629,6 +629,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -629,6 +629,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if (Object.keys(filesList).length === 0) { if (Object.keys(filesList).length === 0) {
if (!filesProviders['browser'].set(examples.ballot.name, examples.ballot.content)) { if (!filesProviders['browser'].set(examples.ballot.name, examples.ballot.content)) {
modalDialogCustom.alert('Failed to store example contract in browser. Remix will not work properly. Please ensure Remix has access to LocalStorage. Safari in Private mode is known not to work.') modalDialogCustom.alert('Failed to store example contract in browser. Remix will not work properly. Please ensure Remix has access to LocalStorage. Safari in Private mode is known not to work.')
} else {
filesProviders['browser'].set(examples.ballot_test.name, examples.ballot_test.content)
} }
} }
}) })
......
...@@ -66,6 +66,31 @@ contract Ballot { ...@@ -66,6 +66,31 @@ contract Ballot {
} }
}` }`
var ballotTest = `pragma solidity ^0.4.7;
import "./remix_tests.sol"; // this import is automatically injected by Remix.
import "./ballot.sol";
contract test3 {
Ballot ballotToTest;
function beforeAll () {
bytes32[] proposals;
proposals.push(0xabcd);
ballotToTest = new Ballot(proposals);
}
function checkWinningProposal () public {
ballotToTest.vote(1);
Assert.equal(ballotToTest.winningProposal(), uint(1), "1 should be the winning proposal");
}
function checkWinninProposalWithReturnValue () public constant returns (bool) {
return ballotToTest.winningProposal() == 1;
}
}
`
module.exports = { module.exports = {
ballot: { name: 'ballot.sol', content: ballot } ballot: { name: 'ballot.sol', content: ballot },
ballot_test: { name: 'ballot_test.sol', content: ballotTest }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment