@kensnzk/koyu 0.5.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +43 -11
- package/README.md +51 -11
- package/dist/axo.d.ts +16 -0
- package/dist/axo.d.ts.map +1 -0
- package/dist/axo.js +211 -0
- package/dist/axo.js.map +1 -0
- package/dist/check.d.ts +109 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +957 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +410 -0
- package/dist/cli.js.map +1 -0
- package/dist/diff.d.ts +105 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +583 -0
- package/dist/diff.js.map +1 -0
- package/dist/fabric.d.ts +28 -0
- package/dist/fabric.d.ts.map +1 -0
- package/dist/fabric.js +105 -0
- package/dist/fabric.js.map +1 -0
- package/dist/graph.d.ts +118 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +627 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/light.d.ts +15 -0
- package/dist/light.d.ts.map +1 -0
- package/dist/light.js +53 -0
- package/dist/light.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +361 -0
- package/dist/mcp.js.map +1 -0
- package/dist/model.d.ts +379 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +464 -0
- package/dist/model.js.map +1 -0
- package/dist/parse-file.d.ts +9 -0
- package/dist/parse-file.d.ts.map +1 -0
- package/dist/parse-file.js +22 -0
- package/dist/parse-file.js.map +1 -0
- package/dist/parse.d.ts +16 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +1040 -0
- package/dist/parse.js.map +1 -0
- package/dist/plan.d.ts +10 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +354 -0
- package/dist/plan.js.map +1 -0
- package/dist/poly.d.ts +78 -0
- package/dist/poly.d.ts.map +1 -0
- package/dist/poly.js +277 -0
- package/dist/poly.js.map +1 -0
- package/dist/site.d.ts +24 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +54 -0
- package/dist/site.js.map +1 -0
- package/dist/vertical.d.ts +176 -0
- package/dist/vertical.d.ts.map +1 -0
- package/dist/vertical.js +669 -0
- package/dist/vertical.js.map +1 -0
- package/examples/basement/main.muro +84 -0
- package/examples/comparison/README.md +64 -1
- package/examples/comparison/gen-ifc4.ts +1 -1
- package/examples/comparison/gen-ifcx.ts +2 -2
- package/examples/comparison/two-rooms.ifcx +1 -1
- package/examples/complex/L1.muro +132 -0
- package/examples/complex/assets.muro +17 -0
- package/examples/complex/basement.muro +40 -0
- package/examples/complex/core.muro +40 -0
- package/examples/complex/hotel.muro +117 -0
- package/examples/complex/main.muro +67 -0
- package/examples/complex/office.muro +41 -0
- package/examples/complex/plant.muro +34 -0
- package/examples/complex/podium.muro +140 -0
- package/examples/complex/site.muro +18 -0
- package/examples/house/L1.muro +16 -0
- package/examples/house/L2.muro +19 -0
- package/examples/house/assets.muro +9 -0
- package/examples/house/main.muro +27 -0
- package/examples/house/site.muro +31 -0
- package/examples/house.muro +3 -3
- package/examples/mansion.muro +18 -13
- package/examples/office.muro +1 -1
- package/examples/steps/01-one-room.muro +4 -0
- package/examples/steps/02-two-rooms.muro +5 -0
- package/examples/steps/03-door.muro +9 -0
- package/examples/steps/04-exterior.muro +15 -0
- package/examples/steps/05-two-storeys.muro +27 -0
- package/examples/steps/06-finished.muro +30 -0
- package/examples/steps/README.md +25 -0
- package/examples/tower/L1.muro +80 -0
- package/examples/tower/L11.muro +49 -0
- package/examples/tower/L2.muro +71 -0
- package/examples/tower/L3.muro +31 -0
- package/examples/tower/assets.muro +14 -0
- package/examples/tower/main.muro +37 -0
- package/examples/tower/site-geometry.muro +7 -0
- package/examples/tower/site.muro +33 -0
- package/examples/tower/typical.muro +131 -0
- package/examples/two-rooms.canonical.json +30 -3
- package/examples/two-rooms.muro +11 -7
- package/package.json +29 -2
- package/src/axo.ts +258 -0
- package/src/check.ts +948 -122
- package/src/cli.ts +175 -12
- package/src/diff.ts +676 -0
- package/src/fabric.ts +123 -0
- package/src/graph.ts +451 -61
- package/src/index.ts +38 -2
- package/src/light.ts +4 -7
- package/src/mcp.ts +397 -0
- package/src/model.ts +462 -67
- package/src/parse-file.ts +28 -0
- package/src/parse.ts +682 -45
- package/src/plan.ts +152 -14
- package/src/poly.ts +295 -0
- package/src/site.ts +19 -11
- package/src/vertical.ts +884 -0
- package/.github/workflows/ci.yml +0 -16
- package/.zenodo.json +0 -20
- package/CITATION.cff +0 -26
- package/docs/decisions/0001-notation-v0.md +0 -29
- package/docs/decisions/0002-height-and-offsets.md +0 -27
- package/docs/decisions/0003-uncounted-divisions.md +0 -36
- package/docs/decisions/0004-typical-floors.md +0 -21
- package/docs/decisions/0005-zones-and-unions.md +0 -23
- package/docs/decisions/0006-voids-and-light.md +0 -31
- package/docs/decisions/0007-semi-outdoor-air.md +0 -27
- package/docs/decisions/0008-vocabulary-and-level-attr.md +0 -23
- package/docs/decisions/0009-site-and-exterior.md +0 -29
- package/docs/ifc-coverage.md +0 -82
- package/docs/ifcx-notes.md +0 -25
- package/docs/img/house-L1.svg +0 -80
- package/docs/img/house-L2.svg +0 -53
- package/docs/img/mansion-L1.svg +0 -113
- package/docs/img/mansion-L10.svg +0 -111
- package/docs/img/mansion-L5.svg +0 -160
- package/docs/img/office-L1.svg +0 -116
- package/docs/img/office-L2.svg +0 -109
- package/docs/img/two-rooms.svg +0 -39
- package/docs/log/2026-07-22.md +0 -13
- package/docs/log/2026-07-23.md +0 -51
- package/docs/roadmap.md +0 -55
- package/docs/writing-architecture.md +0 -119
- package/spec/notation-v0.md +0 -164
- package/spec/vocabulary.md +0 -62
- package/test/core.test.ts +0 -171
- package/test/design2.test.ts +0 -97
- package/test/house.test.ts +0 -74
- package/test/mansion.test.ts +0 -99
- package/test/office.test.ts +0 -71
- package/test/uncounted.test.ts +0 -120
- package/test/vertical.test.ts +0 -75
- package/tsconfig.json +0 -13
package/test/mansion.test.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// 10階建て内廊下型集合住宅 — 基準階の反復 (スパン展開とstack) の検証
|
|
2
|
-
|
|
3
|
-
import assert from "node:assert/strict";
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
5
|
-
import { test } from "node:test";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { check } from "../src/check.js";
|
|
8
|
-
import { doorsBetween } from "../src/graph.js";
|
|
9
|
-
import { areaM2, effectiveUse, isSemiOutdoor, zoneAreaM2 } from "../src/model.js";
|
|
10
|
-
import { parse } from "../src/parse.js";
|
|
11
|
-
|
|
12
|
-
const src = readFileSync(
|
|
13
|
-
fileURLToPath(new URL("../examples/mansion.muro", import.meta.url)),
|
|
14
|
-
"utf8",
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
test("200行たらずのテキストが10フロア122空間に展開される", () => {
|
|
18
|
-
const m = parse(src);
|
|
19
|
-
assert.ok(src.split("\n").length < 200);
|
|
20
|
-
assert.equal(m.spaces.size, 122);
|
|
21
|
-
assert.equal(m.boundaries.length, 332);
|
|
22
|
-
assert.equal(Object.keys(m.levels).length, 11); // L1..L10 + R (範囲宣言L3..L9は7レベル)
|
|
23
|
-
assert.equal(m.zones.size, 8); // Aタイプのゾーン × L2..L9
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test("基準階の展開: どの階も同じ割付、レベルのzはpitchで積まれる", () => {
|
|
27
|
-
const m = parse(src);
|
|
28
|
-
assert.deepEqual(m.spaces.get("/L5/A/ldk")!.rects, m.spaces.get("/L2/A/ldk")!.rects);
|
|
29
|
-
assert.deepEqual(m.spaces.get("/L9/E")!.rects, m.spaces.get("/L3/E")!.rects);
|
|
30
|
-
assert.equal(m.levels["L5"]!.z, 12500); // 6700 + 2900×2
|
|
31
|
-
assert.equal(m.levels["L9"]!.z, 24100);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test("stackの展開: EVシャフト9本・階段9本の垂直境界", () => {
|
|
35
|
-
const m = parse(src);
|
|
36
|
-
assert.equal(m.boundaries.filter((b) => b.kind === "shaft").length, 9);
|
|
37
|
-
assert.equal(m.boundaries.filter((b) => b.kind === "stair").length, 9);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test("整合チェックが警告ゼロで通る (10フロアぶんの高さ不変量含む)", () => {
|
|
41
|
-
const m = parse(src);
|
|
42
|
-
const r = check(m);
|
|
43
|
-
assert.deepEqual(r.errors, []);
|
|
44
|
-
assert.deepEqual(r.warnings, []);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("避難の問い: 9階のLDKから地上まで扉3枚 (室内扉・玄関・階段防火戸)", () => {
|
|
48
|
-
const m = parse(src);
|
|
49
|
-
const route = doorsBetween(m, "/L9/A/ldk", "/out")!;
|
|
50
|
-
assert.equal(route.doors, 3);
|
|
51
|
-
assert.equal(route.path.at(-2), "/L1/stair"); // 屋外階段で地上へ、最後は開放
|
|
52
|
-
// EVシャフトは通れないので、EVからも階段迂回
|
|
53
|
-
const ev = doorsBetween(m, "/L5/ev", "/out")!;
|
|
54
|
-
assert.ok(ev.path.includes("/L5/corridor"));
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test("2階の洋室から9階の洋室へは扉8枚", () => {
|
|
58
|
-
const m = parse(src);
|
|
59
|
-
assert.equal(doorsBetween(m, "/L2/A/bedroom", "/L9/A/bedroom")!.doors, 8);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test("面積: 専有1704㎡ — 間取りに割っても、バルコニーが付いても不変", () => {
|
|
63
|
-
const m = parse(src);
|
|
64
|
-
const exclusive = [...m.spaces.values()]
|
|
65
|
-
.filter((s) => effectiveUse(m, s) === "exclusive" && !isSemiOutdoor(m, s))
|
|
66
|
-
.reduce((sum, s) => sum + (areaM2(s) ?? 0), 0);
|
|
67
|
-
assert.equal(Math.round(exclusive * 100) / 100, 1704);
|
|
68
|
-
assert.equal(zoneAreaM2(m, "/L5/A"), 34.8); // 住戸=ゾーンの面積は室の合計 (半屋外は数えない)
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("半屋外は導出される: バルコニー・屋外階段は半屋外、内廊下は違う", () => {
|
|
72
|
-
const m = parse(src);
|
|
73
|
-
assert.equal(isSemiOutdoor(m, m.spaces.get("/L5/A/balcony")!), true);
|
|
74
|
-
assert.equal(isSemiOutdoor(m, m.spaces.get("/L5/stair")!), true);
|
|
75
|
-
assert.equal(isSemiOutdoor(m, m.spaces.get("/L10/terrace")!), true);
|
|
76
|
-
assert.equal(isSemiOutdoor(m, m.spaces.get("/L5/corridor")!), false); // 内廊下
|
|
77
|
-
assert.equal(isSemiOutdoor(m, m.spaces.get("/L5/A/ldk")!), false); // バルコニーの内側
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("一行の中で異なるレベル範囲は使えない", () => {
|
|
81
|
-
assert.throws(
|
|
82
|
-
() =>
|
|
83
|
-
parse(`
|
|
84
|
-
grid X 0 3600 7200
|
|
85
|
-
grid Y 0 4500
|
|
86
|
-
level L1 0 h:2700
|
|
87
|
-
level L2 3000 h:2400 slab:600
|
|
88
|
-
level L3 6000 h:2400 slab:600
|
|
89
|
-
space /L1..L2/a room X1..X2 Y1..Y2
|
|
90
|
-
space /L2..L3/b room X2..X3 Y1..Y2
|
|
91
|
-
boundary /L1..L2/a /L2..L3/b t:120
|
|
92
|
-
`),
|
|
93
|
-
/レベル範囲は揃えます/,
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("レベル範囲の宣言には pitch が要る", () => {
|
|
98
|
-
assert.throws(() => parse("level L2..L5 3000 h:2400"), /pitch/);
|
|
99
|
-
});
|
package/test/office.test.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { test } from "node:test";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { check } from "../src/check.js";
|
|
6
|
-
import { doorsBetween } from "../src/graph.js";
|
|
7
|
-
import { areaM2 } from "../src/model.js";
|
|
8
|
-
import { parse } from "../src/parse.js";
|
|
9
|
-
import { svgPlan } from "../src/plan.js";
|
|
10
|
-
|
|
11
|
-
const src = readFileSync(
|
|
12
|
-
fileURLToPath(new URL("../examples/office.muro", import.meta.url)),
|
|
13
|
-
"utf8",
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
test("オフィス2フロアが読める", () => {
|
|
17
|
-
const m = parse(src);
|
|
18
|
-
assert.equal(m.spaces.size, 17);
|
|
19
|
-
assert.equal(m.boundaries.length, 43);
|
|
20
|
-
assert.equal(Object.keys(m.levels).length, 3);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("通り芯からのオフセットが解決される", () => {
|
|
24
|
-
const m = parse(src);
|
|
25
|
-
// X1+3200 / X2+3000 のオフセット壁
|
|
26
|
-
assert.deepEqual(m.spaces.get("/L1/stair")!.rects, [
|
|
27
|
-
{ x1: 0, y1: 8000, x2: 3200, y2: 12000 },
|
|
28
|
-
]);
|
|
29
|
-
assert.deepEqual(m.spaces.get("/L1/wc-w")!.rects, [
|
|
30
|
-
{ x1: 9400, y1: 8000, x2: 12800, y2: 12000 },
|
|
31
|
-
]);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test("整合チェックが警告ゼロで通る (高さの不変量含む)", () => {
|
|
35
|
-
const m = parse(src);
|
|
36
|
-
const r = check(m);
|
|
37
|
-
assert.deepEqual(r.errors, []);
|
|
38
|
-
assert.deepEqual(r.warnings, []);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test("避難の問い: 2階の執務室から外へ扉4枚、階段経由", () => {
|
|
42
|
-
const m = parse(src);
|
|
43
|
-
const route = doorsBetween(m, "/L2/office", "/out")!;
|
|
44
|
-
assert.equal(route.doors, 4);
|
|
45
|
-
assert.ok(route.path.includes("/L2/stair"));
|
|
46
|
-
assert.ok(route.path.includes("/L1/stair"));
|
|
47
|
-
// 1階の事務室からは2枚 (廊下→ホールはopenで0)
|
|
48
|
-
assert.equal(doorsBetween(m, "/L1/office", "/out")!.doors, 2);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("EVシャフトは繋がるが通れない — 経路は階段に迂回する", () => {
|
|
52
|
-
const m = parse(src);
|
|
53
|
-
const route = doorsBetween(m, "/L1/ev", "/L2/ev")!;
|
|
54
|
-
assert.equal(route.doors, 4);
|
|
55
|
-
assert.ok(route.path.includes("/L1/stair")); // shaft直行 (扉0) ではなく階段経由
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("面積: フロア230.4㎡×2", () => {
|
|
59
|
-
const m = parse(src);
|
|
60
|
-
const total = [...m.spaces.values()]
|
|
61
|
-
.map((s) => areaM2(s) ?? 0)
|
|
62
|
-
.reduce((a, b) => a + b, 0);
|
|
63
|
-
assert.equal(Math.round(total * 100) / 100, 460.8);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("レベル別の平面図が出る", () => {
|
|
67
|
-
const m = parse(src);
|
|
68
|
-
const l2 = svgPlan(m, { level: "L2" });
|
|
69
|
-
assert.ok(l2.includes("執務室"));
|
|
70
|
-
assert.ok(!l2.includes("エントランスホール")); // L1の室はL2平面に出ない
|
|
71
|
-
});
|
package/test/uncounted.test.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// 数えない分節 (area / seg) — ADR-0003
|
|
2
|
-
// 隔離則: 面積・室数・グラフに一切影響しないことをここで保証する
|
|
3
|
-
|
|
4
|
-
import assert from "node:assert/strict";
|
|
5
|
-
import { readFileSync } from "node:fs";
|
|
6
|
-
import { test } from "node:test";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { check } from "../src/check.js";
|
|
9
|
-
import { doorsBetween } from "../src/graph.js";
|
|
10
|
-
import { areaM2, toCanonical } from "../src/model.js";
|
|
11
|
-
import { parse } from "../src/parse.js";
|
|
12
|
-
import { svgPlan } from "../src/plan.js";
|
|
13
|
-
|
|
14
|
-
const src = readFileSync(
|
|
15
|
-
fileURLToPath(new URL("../examples/office.muro", import.meta.url)),
|
|
16
|
-
"utf8",
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const BASE = `
|
|
20
|
-
grid X 0 3600 7200
|
|
21
|
-
grid Y 0 4500
|
|
22
|
-
level L1 0 h:2700
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
test("area/segが読める", () => {
|
|
26
|
-
const m = parse(src);
|
|
27
|
-
const hall = m.spaces.get("/L1/hall")!;
|
|
28
|
-
assert.equal(hall.areas.length, 1);
|
|
29
|
-
assert.deepEqual(hall.areas[0]!.rect, { x1: 0, y1: 0, x2: 1800, y2: 6400 });
|
|
30
|
-
assert.equal(hall.areas[0]!.attrs["floor"], "モルタル");
|
|
31
|
-
const oc = m.boundaries.find((b) => b.a === "/L1/office" && b.b === "/L1/corridor")!;
|
|
32
|
-
assert.equal(oc.segs.length, 1);
|
|
33
|
-
assert.equal(oc.segs[0]!.attrs["spec"], "ガラスパーティション");
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("隔離則: 面積は変わらない — 室は割れていない", () => {
|
|
37
|
-
const m = parse(src);
|
|
38
|
-
assert.equal(areaM2(m.spaces.get("/L1/hall")!), 40.96); // 土間があってもホールは40.96のまま
|
|
39
|
-
assert.equal(areaM2(m.spaces.get("/L2/office")!), 102.4);
|
|
40
|
-
assert.equal(m.spaces.size, 17); // 室数も変わらない
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("隔離則: グラフも変わらない", () => {
|
|
44
|
-
const m = parse(src);
|
|
45
|
-
assert.equal(doorsBetween(m, "/L2/office", "/out")!.doors, 4);
|
|
46
|
-
assert.equal(doorsBetween(m, "/L1/office", "/out")!.doors, 2);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test("checkは警告ゼロのまま", () => {
|
|
50
|
-
const m = parse(src);
|
|
51
|
-
const r = check(m);
|
|
52
|
-
assert.deepEqual(r.errors, []);
|
|
53
|
-
assert.deepEqual(r.warnings, []);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("平面図に土間とガラス区間が現れる", () => {
|
|
57
|
-
const m = parse(src);
|
|
58
|
-
const l1 = svgPlan(m, { level: "L1" });
|
|
59
|
-
assert.ok(l1.includes("土間"));
|
|
60
|
-
assert.ok(l1.includes("ガラスパーティション"));
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("正準JSONにareasとsegsが乗る", () => {
|
|
64
|
-
const j = toCanonical(parse(src));
|
|
65
|
-
assert.ok(j.includes('"areas"'));
|
|
66
|
-
assert.ok(j.includes('"segs"'));
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test("親からはみ出したareaは警告", () => {
|
|
70
|
-
const m = parse(`${BASE}
|
|
71
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
72
|
-
area X1..X3 Y1..Y2 floor:畳
|
|
73
|
-
`);
|
|
74
|
-
const r = check(m);
|
|
75
|
-
assert.ok(r.warnings.some((w) => w.includes("はみ出し")));
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("領域を持たない空間のareaはエラー", () => {
|
|
79
|
-
const m = parse(`${BASE}
|
|
80
|
-
space /out exterior
|
|
81
|
-
area X1..X2 Y1..Y2 floor:砂利
|
|
82
|
-
`);
|
|
83
|
-
const r = check(m);
|
|
84
|
-
assert.ok(r.errors.some((e) => e.includes("area は書けません")));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("線分より広いsegはエラー", () => {
|
|
88
|
-
const m = parse(`${BASE}
|
|
89
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
90
|
-
space /L1/b room X2..X3 Y1..Y2
|
|
91
|
-
boundary /L1/a /L1/b t:120
|
|
92
|
-
seg w:99999 spec:RC
|
|
93
|
-
`);
|
|
94
|
-
const r = check(m);
|
|
95
|
-
assert.ok(r.errors.some((e) => e.includes("超えて")));
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test("open境界のsegは警告", () => {
|
|
99
|
-
const m = parse(`${BASE}
|
|
100
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
101
|
-
space /L1/b room X2..X3 Y1..Y2
|
|
102
|
-
boundary /L1/a /L1/b type:open
|
|
103
|
-
seg w:1000 spec:RC
|
|
104
|
-
`);
|
|
105
|
-
const r = check(m);
|
|
106
|
-
assert.ok(r.warnings.some((w) => w.includes("open境界")));
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test("spaceの直下でないareaはエラー", () => {
|
|
110
|
-
assert.throws(
|
|
111
|
-
() =>
|
|
112
|
-
parse(`${BASE}
|
|
113
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
114
|
-
space /L1/b room X2..X3 Y1..Y2
|
|
115
|
-
boundary /L1/a /L1/b t:120
|
|
116
|
-
area X1..X2 Y1..Y2 floor:畳
|
|
117
|
-
`),
|
|
118
|
-
/space の直下/,
|
|
119
|
-
);
|
|
120
|
-
});
|
package/test/vertical.test.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import { test } from "node:test";
|
|
3
|
-
import { check } from "../src/check.js";
|
|
4
|
-
import { doorsBetween } from "../src/graph.js";
|
|
5
|
-
import { parse } from "../src/parse.js";
|
|
6
|
-
|
|
7
|
-
const BASE = `
|
|
8
|
-
grid X 0 3600 7200
|
|
9
|
-
grid Y 0 4500
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
test("天井高 + 上階slab > 階高 は食い込みエラー", () => {
|
|
13
|
-
const m = parse(`${BASE}
|
|
14
|
-
level L1 0 h:2700
|
|
15
|
-
level L2 3000 slab:1300
|
|
16
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
17
|
-
space /L2/b room X1..X2 Y1..Y2
|
|
18
|
-
`);
|
|
19
|
-
const r = check(m);
|
|
20
|
-
assert.ok(r.errors.some((e) => e.includes("食い込み")));
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("上階のslab未宣言は高さ検査不能の警告", () => {
|
|
24
|
-
const m = parse(`${BASE}
|
|
25
|
-
level L1 0 h:2700
|
|
26
|
-
level L2 4000
|
|
27
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
28
|
-
space /L2/b room X1..X2 Y1..Y2
|
|
29
|
-
`);
|
|
30
|
-
const r = check(m);
|
|
31
|
-
assert.ok(r.warnings.some((w) => w.includes("slab")));
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test("異なるレベル間に壁境界は書けない", () => {
|
|
35
|
-
const m = parse(`${BASE}
|
|
36
|
-
level L1 0 h:2700
|
|
37
|
-
level L2 4000 slab:1300
|
|
38
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
39
|
-
space /L2/b room X1..X2 Y1..Y2
|
|
40
|
-
boundary /L1/a /L2/b t:120
|
|
41
|
-
`);
|
|
42
|
-
const r = check(m);
|
|
43
|
-
assert.ok(r.errors.some((e) => e.includes("異なるレベル")));
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("stair境界は平面で重なっていなければエラー", () => {
|
|
47
|
-
const m = parse(`${BASE}
|
|
48
|
-
level L1 0 h:2700
|
|
49
|
-
level L2 4000 slab:1300
|
|
50
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
51
|
-
space /L2/b room X2..X3 Y1..Y2
|
|
52
|
-
boundary /L1/a /L2/b type:stair
|
|
53
|
-
`);
|
|
54
|
-
const r = check(m);
|
|
55
|
-
assert.ok(r.errors.some((e) => e.includes("重なって")));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("stairは扉0枚で階をまたぐ", () => {
|
|
59
|
-
const m = parse(`${BASE}
|
|
60
|
-
level L1 0 h:2700
|
|
61
|
-
level L2 4000 slab:1300
|
|
62
|
-
space /L1/a room X1..X2 Y1..Y2
|
|
63
|
-
space /L2/b room X1..X2 Y1..Y2
|
|
64
|
-
boundary /L1/a /L2/b type:stair
|
|
65
|
-
`);
|
|
66
|
-
assert.equal(doorsBetween(m, "/L1/a", "/L2/b")!.doors, 0);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test("負のオフセットも書ける", () => {
|
|
70
|
-
const m = parse(`${BASE}
|
|
71
|
-
level L1 0 h:2700
|
|
72
|
-
space /L1/a room X1..X2-600 Y1..Y2
|
|
73
|
-
`);
|
|
74
|
-
assert.equal(m.spaces.get("/L1/a")!.rects[0]!.x2, 3000);
|
|
75
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noUncheckedIndexedAccess": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"types": ["node"]
|
|
11
|
-
},
|
|
12
|
-
"include": ["src/**/*.ts", "test/**/*.ts"]
|
|
13
|
-
}
|