Code coverage for Solidity smart-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
solidity-coverage/test/zeppelin.js

190 lines
7.5 KiB

/* eslint-env node, mocha */
8 years ago
const solc = require('solc');
const getInstrumentedVersion = require('./../instrumentSolidity.js');
const util = require('./util/util.js');
8 years ago
describe('Battery test of production contracts: OpenZeppelin', () => {
it('should compile after instrumenting zeppelin-solidity/Bounty.sol', () => {
const contract = util.getCode('zeppelin/Bounty.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'PullPayment.sol': util.getCode('zeppelin/PullPayment.sol'),
'Killable.sol': util.getCode('zeppelin/Killable.sol'),
'Bounty.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/Claimable.sol', () => {
const contract = util.getCode('zeppelin/Claimable.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Ownable.sol': util.getCode('zeppelin/Ownable.sol'),
'Claimable.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/DayLimit.sol', () => {
const contract = util.getCode('zeppelin/DayLimit.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Ownable.sol': util.getCode('zeppelin/Shareable.sol'),
'DayLimit.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/Killable.sol', () => {
const contract = util.getCode('zeppelin/Killable.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Ownable.sol': util.getCode('zeppelin/Ownable.sol'),
'Killable.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/LimitBalance.sol', () => {
const contract = util.getCode('zeppelin/LimitBalance.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/Migrations.sol', () => {
const contract = util.getCode('zeppelin/Migrations.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Ownable.sol': util.getCode('zeppelin/Ownable.sol'),
'Migrations.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/Multisig.sol', () => {
const contract = util.getCode('zeppelin/Multisig.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/MultisigWallet.sol', () => {
const contract = util.getCode('zeppelin/MultisigWallet.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Multisig.sol': util.getCode('zeppelin/Multisig.sol'),
'Shareable.sol': util.getCode('zeppelin/Shareable.sol'),
'DayLimit.sol': util.getCode('zeppelin/DayLimit.sol'),
'MultisigWallet.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/Ownable.sol', () => {
const contract = util.getCode('zeppelin/Ownable.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/PullPayment.sol', () => {
const contract = util.getCode('zeppelin/PullPayment.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/SafeMath.sol', () => {
const contract = util.getCode('zeppelin/SafeMath.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/Shareable.sol', () => {
const contract = util.getCode('zeppelin/Shareable.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/Stoppable.sol', () => {
const contract = util.getCode('zeppelin/Stoppable.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'Ownable.sol': util.getCode('zeppelin/Ownable.sol'),
'Stoppable.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
util.report(output.errors);
});
// --- Tokens ---
it('should compile after instrumenting zeppelin-solidity/BasicToken.sol', () => {
const contract = util.getCode('zeppelin/token/BasicToken.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'ERC20Basic.sol': util.getCode('zeppelin/token/ERC20Basic.sol'),
'SafeMath.sol': util.getCode('zeppelin/SafeMath.sol'),
'BasicToken.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
8 years ago
it('should compile after instrumenting zeppelin-solidity/CrowdsaleToken.sol', () => {
const contract = util.getCode('zeppelin/token/CrowdsaleToken.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'StandardToken.sol': util.getCode('zeppelin/token/StandardToken.sol'),
'CrowdsaleToken.sol': info.contract,
};
const output = solc.compile(inputs, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/ERC20.sol', () => {
const contract = util.getCode('zeppelin/token/ERC20.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/ERC20Basic.sol', () => {
const contract = util.getCode('zeppelin/token/ERC20Basic.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const output = solc.compile(info.contract, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/SimpleToken.sol', () => {
const contract = util.getCode('zeppelin/token/SimpleToken.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'StandardToken.sol': util.getCode('zeppelin/token/StandardToken.sol'),
'SimpleToken.sol': info.contract,
};
const output = solc.compile(inputs, 1);
util.report(output.errors);
});
it('should compile after instrumenting zeppelin-solidity/StandardToken.sol', () => {
const contract = util.getCode('zeppelin/token/StandardToken.sol');
const info = getInstrumentedVersion(contract, 'test.sol');
const inputs = {
8 years ago
'ERC20Basic.sol': util.getCode('zeppelin/token/ERC20Basic.sol'),
'SafeMath.sol': util.getCode('zeppelin/SafeMath.sol'),
'StandardToken.sol': info.contract,
8 years ago
};
const output = solc.compile(inputs, 1);
8 years ago
util.report(output.errors);
});
});