notequal uint done

pull/370/head
aniket-engg 4 years ago committed by Aniket
parent 6104765574
commit a34d1bdf84
  1. 4
      libs/remix-tests/sol/tests.sol.ts
  2. 2
      libs/remix-tests/tests/examples_0/assert_equal_test.sol
  3. 12
      libs/remix-tests/tests/examples_0/assert_notEqual_test.sol
  4. 2
      libs/remix-tests/tests/examples_0/assert_ok_test.sol
  5. 29
      libs/remix-tests/tests/testRunner.spec.ts

@ -62,9 +62,9 @@ library Assert {
emit AssertionEvent(result, message);
}
function notEqual(uint a, uint b, string memory message) public returns (bool result) {
function notEqual(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
emit AssertionEventUint(result, message, a, b);
}
function notEqual(int a, int b, string memory message) public returns (bool result) {

@ -3,7 +3,7 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertEqualTest {
function equalUintPassTest() public {
Assert.equal(uint(1), uint(1), "equalUintPassTest fails");
Assert.equal(uint(1), uint(1), "equalUintPassTest passes");
}
function equalUintFailTest() public {

@ -0,0 +1,12 @@
import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertNotEqualTest {
function notEqualUintPassTest() public {
Assert.notEqual(uint(1), uint(2), "notEqualUintPassTest passes");
}
function notEqualUintFailTest() public {
Assert.notEqual(uint(1), uint(1), "notEqualUintFailTest fails");
}
}

@ -3,7 +3,7 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertOkTest {
function okPassTest() public {
Assert.ok(true, "okPassTest fails");
Assert.ok(true, "okPassTest passes");
}
function okFailTest() public {

@ -160,6 +160,35 @@ describe('testRunner', () => {
})
})
describe('assert library NOTEQUAL method tests', () => {
const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
afterAll(() => { tests = [] })
it('should have 1 passing test', () => {
assert.equal(results.passingNum, 1)
})
it('should have 1 failing test', () => {
assert.equal(results.failureNum, 1)
})
it('should return', () => {
deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' },
{ type: 'testPass', value: 'Not equal uint pass test', context: 'AssertNotEqualTest' },
{ type: 'testFailure', value: 'Not equal uint fail test', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', expected: '1', returned: '1'}
], ['time'])
})
})
describe('test with beforeAll', () => {
const filename: string = __dirname + '/examples_1/simple_storage_test.sol'

Loading…
Cancel
Save