Skip to content
Snippets Groups Projects
Commit ba1ad77b authored by François Grand's avatar François Grand
Browse files

refactor(test): rework CreateTestNub() with switch case

refs #325
parent e6052ff4
No related branches found
No related tags found
No related merge requests found
......@@ -225,38 +225,49 @@ function CreateTestNub(iCalType: number): Nub {
if (nubsWithPressureLossLaw.includes(iCalType)) {
setRandomPressureLossLaw(n as PressureLoss);
}
if (iCalType === CalculatorType.CourbeRemous) {
n.setPropValue(
"methodeResolution",
Math.floor(Math.random() * 3) // Euler, RK4, Trapèzes
);
}
if (iCalType === CalculatorType.Pab) {
setPab(n as Pab, fuzzyCfg.Pab.poolMax, fuzzyCfg.Pab.structureMax);
}
if (iCalType === CalculatorType.MacroRugoCompound) {
setMacrorugoCompound(n as MacrorugoCompound);
}
if (iCalType === CalculatorType.Grille) {
setGrille(n as Grille);
}
if (iCalType === CalculatorType.Bief) {
setRandomSection(n as SectionNub);
}
if (iCalType === CalculatorType.Trigo) {
setRandomTrigoOperation(n as Trigo);
setRandomTrigoUnit(n as Trigo);
}
if (iCalType === CalculatorType.SPP) {
addRandomYAXNs(n as SPP);
setRandomSppOperation(n as SPP);
}
if (iCalType === CalculatorType.Par) {
setRandomParType(n as Par);
}
if (iCalType === CalculatorType.ParSimulation) {
setRandomParType(n as ParSimulation);
switch (iCalType) {
case CalculatorType.CourbeRemous:
n.setPropValue(
"methodeResolution",
Math.floor(Math.random() * 3) // Euler, RK4, Trapèzes
);
break;
case CalculatorType.Pab:
setPab(n as Pab, fuzzyCfg.Pab.poolMax, fuzzyCfg.Pab.structureMax);
break;
case CalculatorType.MacroRugoCompound:
setMacrorugoCompound(n as MacrorugoCompound);
break;
case CalculatorType.Grille:
setGrille(n as Grille);
break;
case CalculatorType.Bief:
setRandomSection(n as SectionNub);
break;
case CalculatorType.Trigo:
setRandomTrigoOperation(n as Trigo);
setRandomTrigoUnit(n as Trigo);
break;
case CalculatorType.SPP:
addRandomYAXNs(n as SPP);
setRandomSppOperation(n as SPP);
break;
case CalculatorType.Par:
setRandomParType(n as Par);
break;
case CalculatorType.ParSimulation:
setRandomParType(n as ParSimulation);
break;
}
for (const p of n.parameterIterator) {
if (p.visible) {
randomizeParameter(p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment