Commit a34d1bdf authored by aniket-engg's avatar aniket-engg Committed by Aniket

notequal uint done

parent 61047655
...@@ -62,9 +62,9 @@ library Assert { ...@@ -62,9 +62,9 @@ library Assert {
emit AssertionEvent(result, message); 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); 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) { 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. ...@@ -3,7 +3,7 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertEqualTest { contract AssertEqualTest {
function equalUintPassTest() public { function equalUintPassTest() public {
Assert.equal(uint(1), uint(1), "equalUintPassTest fails"); Assert.equal(uint(1), uint(1), "equalUintPassTest passes");
} }
function equalUintFailTest() public { function equalUintFailTest() public {
......
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");
}
}
\ No newline at end of file
...@@ -3,7 +3,7 @@ import "remix_tests.sol"; // this import is automatically injected by Remix. ...@@ -3,7 +3,7 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertOkTest { contract AssertOkTest {
function okPassTest() public { function okPassTest() public {
Assert.ok(true, "okPassTest fails"); Assert.ok(true, "okPassTest passes");
} }
function okFailTest() public { function okFailTest() public {
......
...@@ -160,6 +160,35 @@ describe('testRunner', () => { ...@@ -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', () => { describe('test with beforeAll', () => {
const filename: string = __dirname + '/examples_1/simple_storage_test.sol' const filename: string = __dirname + '/examples_1/simple_storage_test.sol'
......
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