Last active
February 22, 2020 07:23
-
-
Save pavoltravnik/f6d7d08c7948fe25bbe2eeaae9aa2831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.7.0; | |
import "remix_tests.sol"; // this import is automatically injected by Remix. | |
import "./schelling.sol"; | |
contract test3 { | |
Arbitrust arbitrustToTest; | |
function beforeAll () public { | |
arbitrustToTest = new Arbitrust(); | |
} | |
function generatePoolArrayTest () public { | |
uint[] memory output = arbitrustToTest.generatePoolArray(10); | |
Assert.equal(output[0], 1, "First in pool."); | |
Assert.equal(output[9], 10, "Last in pool."); | |
Assert.equal(output.length, 10, "Length of pool."); | |
} | |
function chosenArbitersTest () public { | |
uint[] memory input = new uint[](3); | |
input[0] = 0; | |
input[1] = 0; | |
input[2] = 0; | |
uint[] memory output = arbitrustToTest.chosenArbiters(input); | |
Assert.equal(output[0], 1, "First arbiter."); | |
Assert.equal(output[1], 2, "Second arbiter."); | |
Assert.equal(output[2], 3, "Third arbiter."); | |
} | |
function clearedArrayTest () public { | |
uint[] memory input = new uint[](5); | |
input[0] = 1; | |
input[1] = 2; | |
input[2] = 3; | |
input[3] = 4; | |
input[4] = 5; | |
delete input[0]; | |
delete input[4]; | |
uint[] memory output = arbitrustToTest.clearedArray(input, 3); | |
Assert.equal(output[0], 2, "Is equal to 2."); | |
Assert.equal(output[1], 3, "Is equal to 3."); | |
Assert.equal(output[2], 4, "Is equal to 4."); | |
Assert.equal(output.length, 3, "Length is equal to 3."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment