|
|
@ -101,33 +101,61 @@ describe('testRunner', () => { |
|
|
|
|
|
|
|
|
|
|
|
describe('#runTest', () => { |
|
|
|
describe('#runTest', () => { |
|
|
|
|
|
|
|
|
|
|
|
describe('assert library methods test', () => { |
|
|
|
describe('assert library OK method tests', () => { |
|
|
|
const filename: string = __dirname + '/examples_0/assert_test.sol' |
|
|
|
const filename: string = __dirname + '/examples_0/assert_ok_test.sol' |
|
|
|
|
|
|
|
|
|
|
|
beforeAll((done) => { |
|
|
|
beforeAll((done) => { |
|
|
|
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { |
|
|
|
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { |
|
|
|
runTest('AssertTest', contracts.AssertTest, compilationData[filename]['AssertTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) |
|
|
|
runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
afterAll(() => { tests = [] }) |
|
|
|
afterAll(() => { tests = [] }) |
|
|
|
|
|
|
|
|
|
|
|
it('should have 2 passing test', () => { |
|
|
|
it('should have 1 passing test', () => { |
|
|
|
assert.equal(results.passingNum, 2) |
|
|
|
assert.equal(results.passingNum, 1) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should have 2 failing test', () => { |
|
|
|
it('should have 1 failing test', () => { |
|
|
|
assert.equal(results.failureNum, 2) |
|
|
|
assert.equal(results.failureNum, 1) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should return', () => { |
|
|
|
|
|
|
|
deepEqualExcluding(tests, [ |
|
|
|
|
|
|
|
{ type: 'accountList', value: accounts }, |
|
|
|
|
|
|
|
{ type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, |
|
|
|
|
|
|
|
{ type: 'testPass', value: 'Ok pass test', context: 'AssertOkTest' }, |
|
|
|
|
|
|
|
{ type: 'testFailure', value: 'Ok fail test', errMsg: 'okFailTest fails', context: 'AssertOkTest', expected: 'true', returned: 'false'}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
], ['time']) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('assert library EQUAL method tests', () => { |
|
|
|
|
|
|
|
const filename: string = __dirname + '/examples_0/assert_equal_test.sol' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeAll((done) => { |
|
|
|
|
|
|
|
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { |
|
|
|
|
|
|
|
runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], 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', () => { |
|
|
|
it('should return', () => { |
|
|
|
deepEqualExcluding(tests, [ |
|
|
|
deepEqualExcluding(tests, [ |
|
|
|
{ type: 'accountList', value: accounts }, |
|
|
|
{ type: 'accountList', value: accounts }, |
|
|
|
{ type: 'contract', value: 'AssertTest', filename: __dirname + '/examples_0/assert_test.sol' }, |
|
|
|
{ type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, |
|
|
|
{ type: 'testPass', value: 'Ok pass test', context: 'AssertTest' }, |
|
|
|
{ type: 'testPass', value: 'Equal uint pass test', context: 'AssertEqualTest' }, |
|
|
|
{ type: 'testFailure', value: 'Ok fail test', errMsg: 'okFailTest fails', context: 'AssertTest', expected: 'true', returned: 'false'}, |
|
|
|
{ type: 'testFailure', value: 'Equal uint fail test', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', expected: '2', returned: '1'} |
|
|
|
{ type: 'testPass', value: 'Equal uint pass test', context: 'AssertTest' }, |
|
|
|
|
|
|
|
{ type: 'testFailure', value: 'Equal uint fail test', errMsg: 'equalUintFailTest fails', context: 'AssertTest', expected: '2', returned: '1'} |
|
|
|
|
|
|
|
], ['time']) |
|
|
|
], ['time']) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|