Commit e45e7fbe authored by Dorchies David's avatar Dorchies David
Browse files

#105 Vannes levantes - Calculation tests OK

Showing with 55 additions and 13 deletions
+55 -13
import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params";
import { StructureVanLevLarinier, StructureVanLevParams } from "../../src/structure/structure_vanlev";
import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev";
import { MessageCode } from "../../src/util/message";
function getStructTest(bFente: boolean = false): StructureVanLevLarinier | StructureVanLevVillemonte {
const structPrm = new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.6, 0.4, 0.217, 73.5, 74);
if (bFente) {
return new StructureVanLevLarinier(structPrm, false);
} else {
return new StructureVanLevVillemonte(structPrm, false);
}
}
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", () => {
expect(getStructTest().Calc("Z1").vCalc).toBeCloseTo(75.077, 3);
expect(getStructTest().Calc("Z1").extraResults.ZDV).toBeCloseTo(73.95, 2);
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);
});
});
......@@ -68,7 +68,7 @@ function CalcVanneLevante(
const r2: Result = s.superCalc("Z1", rInit);
r2.extraResults.ZDV = s.prms.ZDV.v;
if (m !== undefined) {
r2.addMessage(m);
r2.resultElements[0].addMessage(m);
}
return r2;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment