File |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Errors |
Total detected |
Total undetected |
Total mutants |
|
---|---|---|---|---|---|---|---|---|---|---|
RemoveConditionalsMutator.js |
|
16/16 | 16 | 0 | 0 | 0 | 0 | 16 | 0 | 16 |
"use strict";
var esprima_1 = require('esprima');
/**
* Represents a mutator which can remove the conditional clause from statements.
*/
var RemoveConditionalsMutator = (function () 0{
}{
function RemoveConditionalsMutator() 1{
}{
this.name = 'RemoveConditionals';
this.types = [esprima_1.Syntax.DoWhileStatement, esprima_1.Syntax.IfStatement, esprima_1.Syntax.ForStatement, esprima_1.Syntax.WhileStatement, esprima_1.Syntax.ConditionalExpression];
}
RemoveConditionalsMutator.prototype.applyMutations = function (node, copy) 2{
}{
if (3true4falsethis.canMutate(node)) 5{
}{
var nodes = [];
nodes.push(this.booleanLiteralNode(node.test.nodeID, false));
if (6true7false8node.type === esprima_1.Syntax.IfStatement && node.type === esprima_1.Syntax.ConditionalExpression9node.type !== esprima_1.Syntax.IfStatementnode.type === esprima_1.Syntax.IfStatement || 10node.type !== esprima_1.Syntax.ConditionalExpressionnode.type === esprima_1.Syntax.ConditionalExpression) 11{
}{
nodes.push(this.booleanLiteralNode(node.test.nodeID, true));
}
return nodes;
}
};
RemoveConditionalsMutator.prototype.booleanLiteralNode = function (nodeID, value) 12{
}{
return {
nodeID: nodeID,
type: esprima_1.Syntax.Literal,
value: value,
raw: value.toString()
};
};
RemoveConditionalsMutator.prototype.canMutate = function (node) 13{
}{
return 14this.types.indexOf(node.type) < 015this.types.indexOf(node.type) > 0this.types.indexOf(node.type) >= 0;
};
;
return RemoveConditionalsMutator;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = RemoveConditionalsMutator;
//# sourceMappingURL=RemoveConditionalsMutator.js.map