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/if.js

44 lines
1.8 KiB

8 years ago
var solc = require('solc');
var getInstrumentedVersion = require('./../instrumentSolidity.js');
var util = require('./util/util.js')
/**
* NB: passing '1' to solc as an option activates the optimiser
*/
describe('if, else, and else if statements', function(){
it('should compile after instrumenting else statements with brackets',function(){
var contract = util.getCode('if/else-with-brackets.sol');
var info = getInstrumentedVersion(contract, "test.sol", true);
var output = solc.compile(info.contract, 1);
util.report(output.errors);
})
it('should compile after instrumenting else statements without brackets',function(){
var contract = util.getCode('if/else-without-brackets.sol');
var info = getInstrumentedVersion(contract, "test.sol", true);
var output = solc.compile(info.contract, 1);
util.report(output.errors);
})
it('should compile after instrumenting if statements with no brackets',function(){
var contract = util.getCode('if/if-no-brackets.sol');
var info = getInstrumentedVersion(contract, "test.sol", true);
var output = solc.compile(info.contract, 1);
util.report(output.errors);
})
it('should compile after instrumenting if statements with brackets',function(){
var contract = util.getCode('if/if-with-brackets.sol');
var info = getInstrumentedVersion(contract, "test.sol", true);
var output = solc.compile(info.contract, 1);
util.report(output.errors);
})
it('should compile after instrumenting nested if statements with missing else statements',function(){
var contract = util.getCode('if/nested-if-missing-else.sol');
var info = getInstrumentedVersion(contract, "test.sol", true);
var output = solc.compile(info.contract, 1);
util.report(output.errors);
})
})