aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-23 00:25:02 +0800
committerFabio Berger <me@fabioberger.com>2018-05-23 00:25:02 +0800
commit4a0c8d72b05152ee2fd71245873d5a70f7281058 (patch)
tree2c28ad8214aaaa10913a621509d0ae4020ee4d3d /packages/sol-cov
parentd460c0e8b9c6f4081803fff4e2d2347be8cd5ce3 (diff)
parentab9cfd293b3ccc2aacb4238aebe2b033e55b7935 (diff)
downloaddexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.gz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.bz2
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.lz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.xz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.zst
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.zip
merge development
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/test/collect_coverage_entries_test.ts3
-rw-r--r--packages/sol-cov/test/instructions_test.ts1
2 files changed, 4 insertions, 0 deletions
diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts
index 82012edfa..a03be19cd 100644
--- a/packages/sol-cov/test/collect_coverage_entries_test.ts
+++ b/packages/sol-cov/test/collect_coverage_entries_test.ts
@@ -40,12 +40,14 @@ describe('Collect coverage entries', () => {
const coverageEntries = collectCoverageEntries(simpleStorageContract);
const fnIds = _.keys(coverageEntries.fnMap);
expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set');
+ // tslint:disable-next-line:custom-no-magic-numbers
expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(5);
const setFunction = `function set(uint x) {
storedData = x;
}`;
expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get');
+ // tslint:disable-next-line:custom-no-magic-numbers
expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8);
const getFunction = `function get() constant returns (uint retVal) {
return storedData;
@@ -122,6 +124,7 @@ describe('Collect coverage entries', () => {
const branchDescriptions = _.values(coverageEntries.branchMap);
const branchLines = _.map(branchDescriptions, branchDescription => branchDescription.line);
+ // tslint:disable-next-line:custom-no-magic-numbers
expect(branchLines).to.be.deep.equal([94, 115, 119, 130, 151, 187]);
const branchTypes = _.map(branchDescriptions, branchDescription => branchDescription.type);
expect(branchTypes).to.be.deep.equal(['if', 'if', 'if', 'if', 'binary-expr', 'if']);
diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts
index f66612f5f..8012674f5 100644
--- a/packages/sol-cov/test/instructions_test.ts
+++ b/packages/sol-cov/test/instructions_test.ts
@@ -12,6 +12,7 @@ const expect = chai.expect;
describe('instructions', () => {
describe('#getPcToInstructionIndexMapping', () => {
it('correctly maps pcs to instruction indexed', () => {
+ // tslint:disable-next-line:custom-no-magic-numbers
const bytecode = new Uint8Array([constants.PUSH1, 42, constants.PUSH2, 1, 2, constants.TIMESTAMP]);
const pcToInstruction = getPcToInstructionIndexMapping(bytecode);
const expectedPcToInstruction = { '0': 0, '2': 1, '5': 2 };