/** * 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, xit } from "../mock_jasmine"; import { ConduiteDistribParams, ConduiteDistrib } from "../../src/cond_distri"; import { ParallelStructureParams } from "../../src/structure/parallel_structure_params"; import { ParallelStructure } from "../../src/structure/parallel_structure"; import { Structure } from "../../src/structure/structure"; import { CreateStructure } from "../../src/structure/factory_structure"; import { StructureType, LoiDebit } from "../../src/structure/structure_props"; import { IParamDefinitionIterator } from "../../src/param/params-equation"; function checkParams(pdi: IParamDefinitionIterator, symbols: string[], values: number[]) { let n = 0; for (const p of pdi) { expect(p.symbol === symbols[n]); if (n < values.length) expect(p.v === values[n]); n++; } expect(n === symbols.length).toBeTruthy(); } describe("iterator : ", () => { it("ConduiteDistribParams", () => { const peq: ConduiteDistribParams = new ConduiteDistribParams(1, 2, 3, 4, 5); const symbs = ["Q", "D", "J", "Lg", "Nu"]; const vals = [1, 2, 3, 4, 5]; checkParams(peq.iterator, symbs, vals); }); it("ParallelStructureParams 1", () => { const peq: ParallelStructureParams = new ParallelStructureParams(1, 2, 3); const symbs = ["Q", "Z1", "Z2"]; const vals = [1, 2, 3]; checkParams(peq.iterator, symbs, vals); }); it("ParallelStructureParams 2", () => { const psp: ParallelStructureParams = new ParallelStructureParams(1, 2, 3); const pst = new ParallelStructure(psp); const st: Structure = CreateStructure(StructureType.SeuilRectangulaire, LoiDebit.Cem88d); pst.addStructure(st); const symbs = ["Q", "Z1", "Z2", "Cd", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"]; const vals = [1, 2, 3]; checkParams(pst.parameterIterator, symbs, vals); }); });