Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ballot_test #1336

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!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.')
} else {
filesProviders['browser'].set(examples.ballot_test.name, examples.ballot_test.content)
}
}
})
Expand Down
27 changes: 26 additions & 1 deletion src/app/editor/example-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
ballot: { name: 'ballot.sol', content: ballot }
ballot: { name: 'ballot.sol', content: ballot },
ballot_test: { name: 'ballot_test.sol', content: ballotTest }
}