@syntest/search
Advanced tools
Comparing version 0.4.0-beta.25 to 0.4.0-beta.26
@@ -53,3 +53,7 @@ "use strict"; | ||
// find the corresponding node inside the cfg | ||
const function_ = this._subject.cfg.functions.find((function_) => function_.graph.getNodeById(this._id) !== undefined); | ||
const functions_ = this._subject.cfg.functions.filter((function_) => function_.graph.getNodeById(this._id) !== undefined); | ||
if (functions_.length !== 1) { | ||
throw new Error((0, diagnostics_1.shouldNeverHappen)("BranchObjectiveFunction")); | ||
} | ||
const function_ = functions_[0]; | ||
const targetNode = function_.graph.getNodeById(this._id); | ||
@@ -68,7 +72,7 @@ if (!targetNode) { | ||
// weird | ||
throw new Error((0, diagnostics_1.shouldNeverHappen)("BranchObjectiveFunction")); | ||
throw new Error((0, diagnostics_1.lessThanTwoOutgoingEdges)(closestCoveredNode.id, this._id)); | ||
} | ||
if (outgoingEdges.length > 2) { | ||
// weird | ||
throw new Error((0, diagnostics_1.shouldNeverHappen)("BranchObjectiveFunction")); | ||
throw new Error((0, diagnostics_1.moreThanTwoOutgoingEdges)(closestCoveredNode.id, this._id)); | ||
} | ||
@@ -75,0 +79,0 @@ const trueEdge = outgoingEdges.find((edge) => edge.type === cfg_1.EdgeType.CONDITIONAL_TRUE); |
@@ -22,2 +22,3 @@ "use strict"; | ||
const cfg_1 = require("@syntest/cfg"); | ||
const diagnostics_1 = require("../../util/diagnostics"); | ||
class ApproachLevel { | ||
@@ -40,2 +41,5 @@ calculate(cfg, node, traces) { | ||
const closestCoveredBranchTrace = idsTraceMap.get(closestCoveredBranch.id); | ||
if (!closestCoveredBranchTrace) { | ||
throw new Error((0, diagnostics_1.cannotFindTraceThatIsCovered)()); | ||
} | ||
return { | ||
@@ -42,0 +46,0 @@ approachLevel, |
@@ -0,1 +1,2 @@ | ||
import { Location } from "@syntest/cfg"; | ||
/** | ||
@@ -8,3 +9,3 @@ * @author Dimitri Stallenberg | ||
path: string; | ||
line: number; | ||
location: Location; | ||
hits: number; | ||
@@ -11,0 +12,0 @@ condition_ast?: string; |
@@ -10,2 +10,5 @@ /** | ||
export declare const emptyArray: (variableName: string) => string; | ||
export declare const lessThanTwoOutgoingEdges: (nodeId: string, branchObjectiveFunctionId: string) => string; | ||
export declare const moreThanTwoOutgoingEdges: (nodeId: string, branchObjectiveFunctionId: string) => string; | ||
export declare const cannotFindTraceThatIsCovered: () => string; | ||
//# sourceMappingURL=diagnostics.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.emptyArray = exports.singletonAlreadySet = exports.singletonNotSet = exports.maximumValue = exports.minimumValue = exports.shouldNeverHappen = void 0; | ||
exports.cannotFindTraceThatIsCovered = exports.moreThanTwoOutgoingEdges = exports.lessThanTwoOutgoingEdges = exports.emptyArray = exports.singletonAlreadySet = exports.singletonNotSet = exports.maximumValue = exports.minimumValue = exports.shouldNeverHappen = void 0; | ||
/** | ||
@@ -37,2 +37,8 @@ * This file is meant to provide consistent error messages throughout the tool. | ||
exports.emptyArray = emptyArray; | ||
const lessThanTwoOutgoingEdges = (nodeId, branchObjectiveFunctionId) => `This should never happen.\nNode has less than two outgoing edges! \nNode id: ${nodeId}\nBranch objective function id: ${branchObjectiveFunctionId}`; | ||
exports.lessThanTwoOutgoingEdges = lessThanTwoOutgoingEdges; | ||
const moreThanTwoOutgoingEdges = (nodeId, branchObjectiveFunctionId) => `This should never happen.\nNode has more than two outgoing edges! \nNode id: ${nodeId}\nBranch objective function id: ${branchObjectiveFunctionId}`; | ||
exports.moreThanTwoOutgoingEdges = moreThanTwoOutgoingEdges; | ||
const cannotFindTraceThatIsCovered = () => `Cannot find the branch trace that is covered`; | ||
exports.cannotFindTraceThatIsCovered = cannotFindTraceThatIsCovered; | ||
//# sourceMappingURL=diagnostics.js.map |
{ | ||
"name": "@syntest/search", | ||
"version": "0.4.0-beta.25", | ||
"version": "0.4.0-beta.26", | ||
"description": "The common core of the SynTest Framework", | ||
@@ -65,3 +65,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "e3473628ae0deaea1c22ecb333204bbcaffeb5e0" | ||
"gitHead": "016a9e08ca891e4aef3ceddbe9e1cb05cab371ab" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279399
4907