Commit 11a9ac1a authored by Dorchies David's avatar Dorchies David
Browse files

test: improve checkResultConsistency function to explore children results

Refs #276
parent 22207cba
......@@ -232,14 +232,29 @@ export function compareTwoResults(rTest: Result, rRef: Result, prec: number = Ma
}
export function checkResultConsistency(nub: Nub, r?: Result) {
let bExploreChildren: boolean = false;
if (r === undefined) {
r = nub.result;
bExploreChildren = true;
}
check1ResultConsistency(r, nub.calcType !== CalculatorType.SectionParametree && nub.calcType !== CalculatorType.Grille);
if(bExploreChildren) {
checkChildrenResultConsistency(nub);
}
}
function checkChildrenResultConsistency(nub: Nub) {
if(nub.getChildren().length > 0) {
for(const child of nub.getChildren()) {
check1ResultConsistency(child.result);
checkChildrenResultConsistency(child);
}
}
}
function check1ResultConsistency(r: Result, bTestvCalc: boolean = false) {
if (r.ok) {
if (
nub.calcType !== CalculatorType.SectionParametree
&& nub.calcType !== CalculatorType.Grille
) {
if (bTestvCalc) {
// Pas de vCalc sur les sections paramétrées ni sur les grilles
expect(isFiniteNumber(r.vCalc))
.toBe(true, `vCalc = ${r.vCalc} isn't a finite number`);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment