Newer
Older
import { StructureVanLevLarinier, StructureVanLevParams } from "../../src/structure/structure_vanlev";
import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev";
import { MessageCode } from "../../src/util/message";
let vlv: StructureVanLevVillemonte;
describe("class StructureVanLevVillemonte", () => {
beforeEach( () => {
vlv = new StructureVanLevVillemonte(
new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.6, 0.4, 0.217, 73.5, 74)
, false);
});
it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.95", () => {
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
expect(vlv.Calc("Z1").vCalc).toBeCloseTo(75.077, 3);
expect(vlv.Calc("Z1").extraResults.ZDV).toBeCloseTo(73.95, 2);
});
it("ZDV min bound Calc(Z1) should return 75.059 and extraResults.ZDV should be 73.9", () => {
const s = vlv;
s.prms.maxZDV.v = 73.90;
const r = s.Calc("Z1");
expect(r.vCalc).toBeCloseTo(75.059, 3);
expect(r.extraResults.ZDV).toBeCloseTo(73.9, 2);
expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
});
it("ZDV max bound Calc(Z1) should return 75.096 and extraResults.ZDV should be 74", () => {
const s = vlv;
s.prms.minZDV.v = 74;
const r = s.Calc("Z1");
expect(r.vCalc).toBeCloseTo(75.096, 3);
expect(r.extraResults.ZDV).toBeCloseTo(74, 2);
expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
});
});
let vll: StructureVanLevLarinier;
describe("class StructureVanLevLarinier", () => {
beforeEach( () => {
vll = new StructureVanLevLarinier(
new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.35, 0.65, 0.217, 73.3, 73.5)
, false);
});
it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.431", () => {
expect(vll.Calc("Z1").vCalc).toBeCloseTo(75.077, 3);
expect(vll.Calc("Z1").extraResults.ZDV).toBeCloseTo(73.431, 2);
});
it("ZDV min bound Calc(Z1) should return 75.071 and extraResults.ZDV should be 73.4", () => {
const s = vll;
s.prms.maxZDV.v = 73.40;
const r = s.Calc("Z1");
expect(r.vCalc).toBeCloseTo(75.071, 3);
expect(r.extraResults.ZDV).toBeCloseTo(73.4, 2);
expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
});
it("ZDV max bound Calc(Z1) should return 75.092 and extraResults.ZDV should be 73.5", () => {
const s = vll;
s.prms.minZDV.v = 73.5;
const r = s.Calc("Z1");
expect(r.vCalc).toBeCloseTo(75.092, 3);
expect(r.extraResults.ZDV).toBeCloseTo(73.5, 2);
expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);