diff --git a/spec/fuzzing.spec.ts b/spec/fuzzing.spec.ts index 6642d0c07ca2363d1510da182fc08f2a14cecbcd..bcb03bbfdf56ba4dd6811e437caa917bf70adbb4 100644 --- a/spec/fuzzing.spec.ts +++ b/spec/fuzzing.spec.ts @@ -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);