From 38eacc60ccacd063357d78ea1cd6bd9b2d1aa535 Mon Sep 17 00:00:00 2001 From: Mathias Chouet <mathias.chouet@irstea.fr> Date: Fri, 15 May 2020 15:25:34 +0200 Subject: [PATCH] Fix #214 (2) update test --- .../regime_uniforme/regime_uniforme_circ.spec.ts | 2 +- src/open-channel/regime_uniforme.ts | 6 +++++- src/util/message.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/open-channel/regime_uniforme/regime_uniforme_circ.spec.ts b/spec/open-channel/regime_uniforme/regime_uniforme_circ.spec.ts index 7ace4990..11acb873 100644 --- a/spec/open-channel/regime_uniforme/regime_uniforme_circ.spec.ts +++ b/spec/open-channel/regime_uniforme/regime_uniforme_circ.spec.ts @@ -162,7 +162,7 @@ describe("Class RegimeUniforme / section circulaire :", () => { }); describe("en charge −", () => { - it("an error should be thrown if Y > D", () => { // @TODO or >= ? + it("an error should be thrown if sectionis circular, Y > D and YB >= D", () => { const paramSection = new ParamsSectionCirc( 2, // diamètre 2.1, // tirant d'eau diff --git a/src/open-channel/regime_uniforme.ts b/src/open-channel/regime_uniforme.ts index d94eda82..d6c19271 100644 --- a/src/open-channel/regime_uniforme.ts +++ b/src/open-channel/regime_uniforme.ts @@ -67,7 +67,11 @@ export class RegimeUniforme extends SectionNub { } // Est-ce qu'on est en charge sur une section circulaire ? @see #214 - if (this.section instanceof cSnCirc && isGreaterThan(this.section.prms.Y.v, this.section.prms.D.v, 1e-3)) { + if ( + this.section instanceof cSnCirc + && this.section.prms.YB.v >= this.section.prms.D.v + && isGreaterThan(this.section.prms.Y.v, this.section.prms.D.v, 1e-3) + ) { this.currentResult = new Result(new Message(MessageCode.ERROR_RU_CIRC_LEVEL_TOO_HIGH)); return this.result; } diff --git a/src/util/message.ts b/src/util/message.ts index db170d84..02dda078 100644 --- a/src/util/message.ts +++ b/src/util/message.ts @@ -240,7 +240,7 @@ export enum MessageCode { */ ERROR_REMOUS_PAS_CALCUL, - /** RegimeUniforme : en charge (le tirant d'eau dépasse le diamètre de la section circulaire) */ + /** RegimeUniforme : impossible de calculer avec uen conduite en charge (section circulaire) */ ERROR_RU_CIRC_LEVEL_TOO_HIGH, /** -- GitLab