An error occurred while loading the file. Please try again.
-
Dorchies David authoredb4cd8397
/**
* IMPORTANT !
* Décommenter temporairement la ligne suivante (import { } from "./mock_jasmine")
* Pour exécuter ce code dans le débugger.
* Faire de même avec le fichier test_func.ts
*/
// import { describe, expect, it, xdescribe } from "../mock_jasmine";
import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure";
import { checkResult } from "../test_func";
import { structTest } from "./structure_test";
describe("Class Structure: ", () => {
describe("getFlowMode()", () => {
it("Flow Mode should be WEIR", () => {
expect(structTest.testGetFlowMode()).toBe(StructureFlowMode.WEIR);
});
it("Flow Mode should be ORIFICE", () => {
structTest.prms.W.v = 10;
expect(structTest.testGetFlowMode()).toBe(StructureFlowMode.ORIFICE);
structTest.prms.W.v = Infinity;
});
});
describe("getFlowRegime()", () => {
it("Flow Regime should be FREE", () => {
expect(structTest.testGetFlowRegime()).toBe(StructureFlowRegime.FREE);
});
it("Flow Regime should be SUBMERGED (WEIR)", () => {
structTest.prms.Z2.v = 21;
expect(structTest.testGetFlowRegime()).toBe(StructureFlowRegime.SUBMERGED);
});
it("Flow Regime should be PARTIAL (ORIFICE)", () => {
structTest.prms.Z2.v = 21;
structTest.prms.W.v = 15;
expect(structTest.testGetFlowRegime()).toBe(StructureFlowRegime.PARTIAL);
});
it("Flow Regime should be SUBMERGED (ORIFICE)", () => {
structTest.prms.Z2.v = 25;
structTest.prms.W.v = 15;
expect(structTest.testGetFlowRegime()).toBe(StructureFlowRegime.SUBMERGED);
});
structTest.prms.Z2.v = 15;
structTest.prms.W.v = Infinity;
});
describe("Calc()", () => {
const flagsNull = { Mode: StructureFlowMode.NULL, Regime: StructureFlowRegime.NULL };
it("Z1=Z2 => Q=0", () => {
structTest.prms.Z2.v = structTest.prms.Z1.v;
checkResult(structTest.Calc("Q"), 0);
expect(structTest.Calc("Q").extraResults).toEqual(flagsNull);
structTest.prms.Z2.v = 15;
});
it("W=0 => Q=0", () => {
structTest.prms.W.v = 0;
checkResult(structTest.Calc("Q"), 0);
expect(structTest.Calc("Q").extraResults).toEqual(flagsNull);
structTest.prms.W.v = Infinity;
});
it("Q=0 => Z1=Z2", () => {
structTest.prms.Q.v = 0;
checkResult(structTest.Calc("Z1"), structTest.prms.h2.v);
expect(structTest.Calc("Z1").extraResults).toEqual(flagsNull);
structTest.prms.Q.v = 1;
});
it("Q=0 => W=0", () => {
structTest.prms.Q.v = 0;
structTest.prms.W.v = 1; // Sinon, W = Infinity => Structure = Seuil => Throw Error
7172737475767778
checkResult(structTest.Calc("W"), 0);
expect(structTest.Calc("W").extraResults).toEqual(flagsNull);
structTest.prms.Q.v = 1;
});
// TODO Test inversion de débit
});
});