Skip to content

Instantly share code, notes, and snippets.

@Albert-W
Created October 15, 2018 09:00
Show Gist options
  • Save Albert-W/c51177c335408f525eb93d37490eaa29 to your computer and use it in GitHub Desktop.
Save Albert-W/c51177c335408f525eb93d37490eaa29 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.0;
// import ""
contract Test {
int a =10;
int b = 15;
function add(a, b )public constant returns(int) {
return a+b;
}
}
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 () {
ballotToTest = new Ballot(2);
}
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;
}
}
pragma solidity ^0.4.0;
// import ""
contract Test {
int a =10;
int b = 15;
function add()public constant returns(int) {
return a+b;
}
}
pragma solidity ^0.4.16;
contract ArrayTest {
uint[] public u = [1,2,3,4];
string s = "12345678";
function h() public constant returns (uint) {
return bytes(s).length;
}
function f() public view returns (byte){
return bytes(s)[3];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment