param_equation.spec.ts 1.83 KB
Newer Older
1
2
import { ConduiteDistribParams } from "../../src/cond_distri_params";
import { IParamDefinitionIterator } from "../../src/param/param_definition_iterator";
Mathias Chouet's avatar
Mathias Chouet committed
3
import { CreateStructure } from "../../src/structure/factory_structure";
4
import { ParallelStructure } from "../../src/structure/parallel_structure";
Mathias Chouet's avatar
Mathias Chouet committed
5
import { ParallelStructureParams } from "../../src/structure/parallel_structure_params";
6
import { Structure } from "../../src/structure/structure";
Mathias Chouet's avatar
Mathias Chouet committed
7
import { LoiDebit } from "../../src/structure/structure_props";
8

9
10
11
function checkParams(pdi: IParamDefinitionIterator, symbols: string[], values: number[]) {
    let n = 0;
    for (const p of pdi) {
12
13
        expect(p.symbol).toBeDefined();
        expect(p.singleValue).toBeDefined();
14
15
        n++;
    }
16
    expect(n).toEqual(symbols.length);
17
}
18

19
20
21
describe("iterator  : ", () => {
    it("ConduiteDistribParams", () => {
        const peq: ConduiteDistribParams = new ConduiteDistribParams(1, 2, 3, 4, 5);
22
23
        const symbs = ["Q", "D", "J", "Lg", "Nu"];
        const vals = [1, 2, 3, 4, 5];
24
        checkParams(peq.iterator, symbs, vals);
25
26
    });

27
28
    it("ParallelStructureParams 1", () => {
        const peq: ParallelStructureParams = new ParallelStructureParams(1, 2, 3);
29
30
        const symbs = ["Q", "Z1", "Z2"];
        const vals = [1, 2, 3];
31
32
        checkParams(peq.iterator, symbs, vals);
    });
33

34
35
36
37
    it("ParallelStructureParams 2", () => {
        const psp: ParallelStructureParams = new ParallelStructureParams(1, 2, 3);
        const pst = new ParallelStructure(psp);

Mathias Chouet's avatar
Mathias Chouet committed
38
39
        const st: Structure = CreateStructure(LoiDebit.WeirCem88d, pst);
        pst.addChild(st);
40

41
        const symbs = [
42
            "Q", "Z1", "Z2", "CdWR", "CdGR", "CdWSL", "CdWS", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"
43
        ];
44
        const vals = [1, 2, 3];
45
        checkParams(pst.parameterIterator, symbs, vals);
46
47
    });
});