Commit 3abf81c0 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Tests on ParallelStructures: replaced Calc() with CalcSerie(), lots of errors

Showing with 15 additions and 12 deletions
+15 -12
...@@ -57,7 +57,7 @@ export function testStructure( ...@@ -57,7 +57,7 @@ export function testStructure(
) { ) {
for (const prm of st.prms) { for (const prm of st.prms) {
if ([ParamCalculability.DICHO, ParamCalculability.EQUATION].includes(prm.calculability)) { if ([ParamCalculability.DICHO, ParamCalculability.EQUATION].includes(prm.calculability)) {
if (prm.symbol === "W" && prm.v === Infinity) { if (prm.symbol === "W" && prm.currentValue === Infinity) {
// Le calcul de l'ouverture sur les seuils doit renvoyer une exception (cas impossible) // Le calcul de l'ouverture sur les seuils doit renvoyer une exception (cas impossible)
it(`Calc(${prm.symbol}) should return exception`, () => { it(`Calc(${prm.symbol}) should return exception`, () => {
expect( expect(
...@@ -65,7 +65,7 @@ export function testStructure( ...@@ -65,7 +65,7 @@ export function testStructure(
).toThrow(new Error("Structure:Calc : Calcul de W impossible sur un seuil")); ).toThrow(new Error("Structure:Calc : Calcul de W impossible sur un seuil"));
}); });
} else { } else {
const ref: number = prm.v; const ref: number = prm.currentValue;
const res: Result = st.Calc(prm.symbol); const res: Result = st.Calc(prm.symbol);
if (bNotZDV) { if (bNotZDV) {
// Les lois CEM88D et CUNGE80 ne font pas intervenir ZDV dans le calcul d'un orifice noyé // Les lois CEM88D et CUNGE80 ne font pas intervenir ZDV dans le calcul d'un orifice noyé
...@@ -80,7 +80,7 @@ export function testStructure( ...@@ -80,7 +80,7 @@ export function testStructure(
checkResult(res, ref); checkResult(res, ref);
}); });
} }
prm.v = ref; // Go back to initial value for following tests // prm.v = ref; // Go back to initial value for following tests
} }
} }
} }
...@@ -121,12 +121,11 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe ...@@ -121,12 +121,11 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe
// Tests de calcul des paramètres des ouvrages // Tests de calcul des paramètres des ouvrages
for (const prm of st.prms) { for (const prm of st.prms) {
if ( if (
prm.calculability === ParamCalculability.DICHO &&
prm.symbol !== "Z1" && prm.symbol !== "Z2" prm.symbol !== "Z1" && prm.symbol !== "Z2"
) { ) {
const ref: number = prm.currentValue; const ref: number = prm.currentValue;
prm.v += 100; // Pour éviter de donner la bonne solution en valeur initiale prm.v += 100; // Pour éviter de donner la bonne solution en valeur initiale
if (prm.symbol === "W" && prm.v === Infinity) { if (prm.symbol === "W" && prm.currentValue === Infinity) {
// Le calcul de l'ouverture sur les seuils doit renvoyer une exception (cas impossible) // Le calcul de l'ouverture sur les seuils doit renvoyer une exception (cas impossible)
it(`Calc(${prm.symbol}) should return exception`, () => { it(`Calc(${prm.symbol}) should return exception`, () => {
expect( expect(
...@@ -141,7 +140,7 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe ...@@ -141,7 +140,7 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe
!oPS.structures[i].isZDVcalculable && !oPS.structures[i].isZDVcalculable &&
prm.symbol === "ZDV" prm.symbol === "ZDV"
) { ) {
// Les lois CEM88D et CUNGE80 ne font pas intervenir ZDV dans le calcul d'un orifice noyé // Les lois GateCEM88D et CUNGE80 ne font pas intervenir ZDV dans le calcul d'un orifice noyé
it(`Calc(${prm.symbol}) should return an error`, () => { it(`Calc(${prm.symbol}) should return an error`, () => {
expect( expect(
oPS.Calc({ oPS.Calc({
...@@ -163,12 +162,16 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe ...@@ -163,12 +162,16 @@ export function testParallelStructures(oPS: ParallelStructure, iLoiDebits: numbe
}); });
} else { } else {
// Cas normal : On teste la valeur calculée // Cas normal : On teste la valeur calculée
it(`Calc(${prm.symbol}) should return ${ref}`, () => { if (ParamCalculability.DICHO === prm.calculability) {
checkResult(oPS.Calc({ it(`Calc(${prm.symbol}) should return ${ref}`, () => {
uid: oPS.structures[i].uid, oPS.calculatedParam = prm;
symbol: prm.symbol checkResult(oPS.CalcSerie(), ref);
}), ref); /* checkResult(oPS.Calc({
}); uid: oPS.structures[i].uid,
symbol: prm.symbol
}), ref); */
});
}
} }
prm.v = ref; // Go back to initial value for following tests prm.v = ref; // Go back to initial value for following tests
} }
......
Supports Markdown
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