From aeb96e0542cf88b815ba78831b72382fed9ab842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Tue, 23 Dec 2025 12:34:15 +0530 Subject: [PATCH 01/11] WIP --- lib/RectDiffPipeline.ts | 1 - .../RectDiffSeedingSolver.ts | 20 +-- lib/utils/getColorForZLayer.ts | 15 ++ tests/fixtures/applyZLayerColors.ts | 45 ++++++ tests/fixtures/getPerLayerVisualizations.ts | 136 ++++++++++++++++++ .../solver/rectDiffGridSolverPipeline.test.ts | 25 ++++ 6 files changed, 223 insertions(+), 19 deletions(-) create mode 100644 lib/utils/getColorForZLayer.ts create mode 100644 tests/fixtures/applyZLayerColors.ts create mode 100644 tests/fixtures/getPerLayerVisualizations.ts create mode 100644 tests/solver/rectDiffGridSolverPipeline.test.ts diff --git a/lib/RectDiffPipeline.ts b/lib/RectDiffPipeline.ts index d9b3a32..4fafba1 100644 --- a/lib/RectDiffPipeline.ts +++ b/lib/RectDiffPipeline.ts @@ -60,7 +60,6 @@ export class RectDiffPipeline extends BasePipelineSolver } override initialVisualize(): GraphicsObject { - console.log("RectDiffPipeline - initialVisualize") const graphics = createBaseVisualization( this.inputProblem.simpleRouteJson, "RectDiffPipeline - Initial", diff --git a/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts b/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts index 5255876..51cc226 100644 --- a/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts +++ b/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts @@ -18,6 +18,7 @@ import { longestFreeSpanAroundZ } from "./longestFreeSpanAroundZ" import { allLayerNode } from "../../utils/buildHardPlacedByLayer" import { isFullyOccupiedAtPoint } from "../../utils/isFullyOccupiedAtPoint" import { resizeSoftOverlaps } from "../../utils/resizeSoftOverlaps" +import { getColorForZLayer } from "lib/utils/getColorForZLayer" export type RectDiffSeedingSolverInput = { simpleRouteJson: SimpleRouteJson @@ -365,23 +366,6 @@ export class RectDiffSeedingSolver extends BaseSolver { } } - /** Get color based on z layer for visualization. */ - private getColorForZLayer(zLayers: number[]): { - fill: string - stroke: string - } { - const minZ = Math.min(...zLayers) - const colors = [ - { fill: "#dbeafe", stroke: "#3b82f6" }, - { fill: "#fef3c7", stroke: "#f59e0b" }, - { fill: "#d1fae5", stroke: "#10b981" }, - { fill: "#e9d5ff", stroke: "#a855f7" }, - { fill: "#fed7aa", stroke: "#f97316" }, - { fill: "#fecaca", stroke: "#ef4444" }, - ] as const - return colors[minZ % colors.length]! - } - /** Visualization focused on the grid seeding phase. */ override visualize(): GraphicsObject { const rects: NonNullable = [] @@ -489,7 +473,7 @@ export class RectDiffSeedingSolver extends BaseSolver { // current placements (streaming) during grid fill if (this.placed?.length) { for (const placement of this.placed) { - const colors = this.getColorForZLayer(placement.zLayers) + const colors = getColorForZLayer(placement.zLayers) rects.push({ center: { x: placement.rect.x + placement.rect.width / 2, diff --git a/lib/utils/getColorForZLayer.ts b/lib/utils/getColorForZLayer.ts new file mode 100644 index 0000000..f5d6015 --- /dev/null +++ b/lib/utils/getColorForZLayer.ts @@ -0,0 +1,15 @@ +export const getColorForZLayer = (zLayers: number[]): { + fill: string + stroke: string +} => { + const minZ = Math.min(...zLayers) + const colors = [ + { fill: "#dbeafe", stroke: "#3b82f6" }, + { fill: "#fef3c7", stroke: "#f59e0b" }, + { fill: "#d1fae5", stroke: "#10b981" }, + { fill: "#e9d5ff", stroke: "#a855f7" }, + { fill: "#fed7aa", stroke: "#f97316" }, + { fill: "#fecaca", stroke: "#ef4444" }, + ] as const + return colors[minZ % colors.length]! +} diff --git a/tests/fixtures/applyZLayerColors.ts b/tests/fixtures/applyZLayerColors.ts new file mode 100644 index 0000000..705e604 --- /dev/null +++ b/tests/fixtures/applyZLayerColors.ts @@ -0,0 +1,45 @@ +import type { GraphicsObject } from "graphics-debug" +import { getColorForZLayer } from "lib/utils/getColorForZLayer" + +/** + * Apply consistent fill/stroke colors to any rects whose + * `layer` is a z-layer string (e.g. "z0" or "z0,1,3"). + * + * Intended for use in visual snapshots so that colors are + * derived only from the z-layer information. + */ +export const applyZLayerColors = (graphics: GraphicsObject): GraphicsObject => { + const rects = (graphics.rects ?? []) as NonNullable + + const getLayersFromLayerField = (layer: unknown): number[] | null => { + if (typeof layer !== "string") return null + if (!layer.startsWith("z")) return null + const rest = layer.slice(1) + if (!rest) return null + + const values = rest + .split(",") + .map((part) => Number.parseInt(part, 10)) + .filter((value) => !Number.isNaN(value)) + + return values.length ? values : null + } + + const recoloredRects = rects.map((rect) => { + const layers = getLayersFromLayerField((rect as any).layer) + if (!layers) return rect + + const { fill, stroke } = getColorForZLayer(layers) + + return { + ...rect, + fill, + stroke, + } + }) + + return { + ...graphics, + rects: recoloredRects, + } +} diff --git a/tests/fixtures/getPerLayerVisualizations.ts b/tests/fixtures/getPerLayerVisualizations.ts new file mode 100644 index 0000000..685a12f --- /dev/null +++ b/tests/fixtures/getPerLayerVisualizations.ts @@ -0,0 +1,136 @@ +import type { GraphicsObject } from "graphics-debug" + +export function getPerLayerVisualizations( + graphics: GraphicsObject, +): Map { + const rects = (graphics.rects ?? []) as NonNullable + const lines = (graphics.lines ?? []) as NonNullable + const points = (graphics.points ?? []) as NonNullable< + GraphicsObject["points"] + > + + const zValues = new Set() + + const addZValuesFromLayer = (layer: unknown) => { + if (typeof layer !== "string") return + if (!layer.startsWith("z")) return + const rest = layer.slice(1) + if (!rest) return + for (const part of rest.split(",")) { + const value = Number.parseInt(part, 10) + if (!Number.isNaN(value)) zValues.add(value) + } + } + + for (const rect of rects) addZValuesFromLayer((rect as any).layer) + for (const line of lines) addZValuesFromLayer((line as any).layer) + for (const point of points) addZValuesFromLayer((point as any).layer) + + const result = new Map() + if (!zValues.size) return result + + const sortedZ = Array.from(zValues).sort((a, b) => a - b) + + const commonRects: NonNullable = [] + const perLayerRects: { layers: number[]; rect: (typeof rects)[number] }[] = [] + + for (const rect of rects) { + const layer = (rect as any).layer + if (typeof layer === "string" && layer.startsWith("z")) { + const rest = layer.slice(1) + if (rest) { + const layers = rest + .split(",") + .map((part) => Number.parseInt(part, 10)) + .filter((value) => !Number.isNaN(value)) + if (layers.length) { + perLayerRects.push({ layers, rect }) + continue + } + } + } + commonRects.push(rect) + } + + const commonLines: NonNullable = [] + const perLayerLines: { layers: number[]; line: (typeof lines)[number] }[] = [] + + for (const line of lines) { + const layer = (line as any).layer + if (typeof layer === "string" && layer.startsWith("z")) { + const rest = layer.slice(1) + if (rest) { + const layers = rest + .split(",") + .map((part) => Number.parseInt(part, 10)) + .filter((value) => !Number.isNaN(value)) + if (layers.length) { + perLayerLines.push({ layers, line }) + continue + } + } + } + commonLines.push(line) + } + + const commonPoints: NonNullable = [] + const perLayerPoints: { layers: number[]; point: (typeof points)[number] }[] = + [] + + for (const point of points) { + const layer = (point as any).layer + if (typeof layer === "string" && layer.startsWith("z")) { + const rest = layer.slice(1) + if (rest) { + const layers = rest + .split(",") + .map((part) => Number.parseInt(part, 10)) + .filter((value) => !Number.isNaN(value)) + if (layers.length) { + perLayerPoints.push({ layers, point }) + continue + } + } + } + commonPoints.push(point) + } + + // Generate all non-empty combinations (power set) of z values + const comboCount = 1 << sortedZ.length + + for (let mask = 1; mask < comboCount; mask++) { + const combo: number[] = [] + for (let i = 0; i < sortedZ.length; i++) { + if (mask & (1 << i)) combo.push(sortedZ[i]!) + } + + const key = `z${combo.join(",")}` + + const layerRects: NonNullable = [...commonRects] + const layerLines: NonNullable = [...commonLines] + const layerPoints: NonNullable = [...commonPoints] + + const intersects = (layers: number[]) => + layers.some((layer) => combo.includes(layer)) + + for (const { layers, rect } of perLayerRects) { + if (intersects(layers)) layerRects.push(rect) + } + for (const { layers, line } of perLayerLines) { + if (intersects(layers)) layerLines.push(line) + } + for (const { layers, point } of perLayerPoints) { + if (intersects(layers)) layerPoints.push(point) + } + + result.set(key, { + title: `${graphics.title ?? ""} - z${combo.join(",")}`, + coordinateSystem: graphics.coordinateSystem, + rects: layerRects, + lines: layerLines, + points: layerPoints, + }) + } + + return result +} \ No newline at end of file diff --git a/tests/solver/rectDiffGridSolverPipeline.test.ts b/tests/solver/rectDiffGridSolverPipeline.test.ts new file mode 100644 index 0000000..4b85a79 --- /dev/null +++ b/tests/solver/rectDiffGridSolverPipeline.test.ts @@ -0,0 +1,25 @@ +import { expect, test } from "bun:test" +import srj from "test-assets/bugreport11-b2de3c.json" +import { getSvgFromGraphicsObject } from "graphics-debug" +import { RectDiffPipeline } from "lib/RectDiffPipeline" +import { getPerLayerVisualizations } from "tests/fixtures/getPerLayerVisualizations" +import { applyZLayerColors } from "tests/fixtures/applyZLayerColors" + +test("RectDiffPipeline outline snapshot", async () => { + const solver = new RectDiffPipeline({ + simpleRouteJson: srj.simple_route_json, + }) + + solver.solve() + + const viz = solver.visualize()! + + const map = getPerLayerVisualizations(viz) + + for (const key of map.keys()) { + const perLayerViz = map.get(key)! + const coloredViz = applyZLayerColors(perLayerViz) + const svg = getSvgFromGraphicsObject(coloredViz) + await expect(svg).toMatchSvgSnapshot(`${import.meta.path}-${key}`) + } +}) From f231b7a0cda0b451d4b57c14707af3145880ca88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Tue, 23 Dec 2025 15:28:17 +0530 Subject: [PATCH 02/11] WIP --- tests/fixtures/makeCapqcityNode.ts | 33 ++++++++++++++ ...DiffGridSolverPipeline.test.ts-z0.snap.svg | 44 +++++++++++++++++++ ...DiffGridSolverPipeline.test.ts-z1.snap.svg | 44 +++++++++++++++++++ ...DiffGridSolverPipeline.test.ts-z2.snap.svg | 44 +++++++++++++++++++ ...DiffGridSolverPipeline.test.ts-z3.snap.svg | 44 +++++++++++++++++++ .../solver/rectDiffGridSolverPipeline.test.ts | 43 +++++++++++++----- 6 files changed, 241 insertions(+), 11 deletions(-) create mode 100644 tests/fixtures/makeCapqcityNode.ts create mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg create mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg create mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg create mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg diff --git a/tests/fixtures/makeCapqcityNode.ts b/tests/fixtures/makeCapqcityNode.ts new file mode 100644 index 0000000..3f2f351 --- /dev/null +++ b/tests/fixtures/makeCapqcityNode.ts @@ -0,0 +1,33 @@ +import type { Rect } from "graphics-debug" +import type { RectDiffPipeline } from "lib/RectDiffPipeline" +import { getColorForZLayer } from "lib/utils/getColorForZLayer" + +type MeshNodes = ReturnType["meshNodes"] + +export const makeCapacityMeshNodeWithLayerInfo = (nodes: MeshNodes): Map => { + const map = new Map() + + for (const node of nodes) { + if (!node.availableZ.length) continue + const key = node.availableZ.join(",") + const colors = getColorForZLayer(node.availableZ) + const rect: Rect = { + center: node.center, + width: node.width, + height: node.height, + layer: `z${key}`, + stroke: colors.stroke, + fill: colors.fill, + label: "node", + } + + const existing = map.get(key) + if (existing) { + existing.push(rect) + } else { + map.set(key, [rect]) + } + } + + return map +} \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg new file mode 100644 index 0000000..eec29a9 --- /dev/null +++ b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg new file mode 100644 index 0000000..e96bf0e --- /dev/null +++ b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg new file mode 100644 index 0000000..58ce55b --- /dev/null +++ b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg new file mode 100644 index 0000000..93bc5dd --- /dev/null +++ b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/tests/solver/rectDiffGridSolverPipeline.test.ts b/tests/solver/rectDiffGridSolverPipeline.test.ts index 4b85a79..fa919e4 100644 --- a/tests/solver/rectDiffGridSolverPipeline.test.ts +++ b/tests/solver/rectDiffGridSolverPipeline.test.ts @@ -1,25 +1,46 @@ import { expect, test } from "bun:test" import srj from "test-assets/bugreport11-b2de3c.json" -import { getSvgFromGraphicsObject } from "graphics-debug" +import { + getSvgFromGraphicsObject, + type GraphicsObject, + type Rect, +} from "graphics-debug" import { RectDiffPipeline } from "lib/RectDiffPipeline" -import { getPerLayerVisualizations } from "tests/fixtures/getPerLayerVisualizations" -import { applyZLayerColors } from "tests/fixtures/applyZLayerColors" +import { makeCapacityMeshNodeWithLayerInfo } from "tests/fixtures/makeCapqcityNode" -test("RectDiffPipeline outline snapshot", async () => { +test("RectDiffPipeline mesh layer snapshots", async () => { const solver = new RectDiffPipeline({ simpleRouteJson: srj.simple_route_json, }) solver.solve() - const viz = solver.visualize()! + const { meshNodes } = solver.getOutput() + const rectsByCombo = makeCapacityMeshNodeWithLayerInfo(meshNodes) - const map = getPerLayerVisualizations(viz) + for (const z of [0, 1, 2, 3]) { + const layerRects: Rect[] = [] - for (const key of map.keys()) { - const perLayerViz = map.get(key)! - const coloredViz = applyZLayerColors(perLayerViz) - const svg = getSvgFromGraphicsObject(coloredViz) - await expect(svg).toMatchSvgSnapshot(`${import.meta.path}-${key}`) + for (const [key, rects] of rectsByCombo) { + const layers = key + .split(",") + .map((value) => Number.parseInt(value, 10)) + .filter((value) => !Number.isNaN(value)) + + if (layers.includes(z)) { + layerRects.push(...rects) + } + } + + const graphics: GraphicsObject = { + title: `RectDiffPipeline - z${z}`, + coordinateSystem: "cartesian", + rects: layerRects, + points: [], + lines: [], + } + + const svg = getSvgFromGraphicsObject(graphics) + await expect(svg).toMatchSvgSnapshot(`${import.meta.path}-z${z}`) } }) From ad5aa802da132b55fead0610ad623fc246481b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Tue, 23 Dec 2025 22:35:31 +0530 Subject: [PATCH 03/11] WIP --- lib/utils/getColorForZLayer.ts | 28 ++++++++++--------- tests/fixtures/getPerLayerVisualizations.ts | 2 +- tests/fixtures/makeCapqcityNode.ts | 8 ++++-- ...DiffGridSolverPipeline.test.ts-z0.snap.svg | 2 +- ...DiffGridSolverPipeline.test.ts-z1.snap.svg | 2 +- ...DiffGridSolverPipeline.test.ts-z2.snap.svg | 2 +- ...DiffGridSolverPipeline.test.ts-z3.snap.svg | 2 +- .../solver/rectDiffGridSolverPipeline.test.ts | 1 + 8 files changed, 26 insertions(+), 21 deletions(-) diff --git a/lib/utils/getColorForZLayer.ts b/lib/utils/getColorForZLayer.ts index f5d6015..40f580d 100644 --- a/lib/utils/getColorForZLayer.ts +++ b/lib/utils/getColorForZLayer.ts @@ -1,15 +1,17 @@ -export const getColorForZLayer = (zLayers: number[]): { - fill: string - stroke: string +export const getColorForZLayer = ( + zLayers: number[], +): { + fill: string + stroke: string } => { - const minZ = Math.min(...zLayers) - const colors = [ - { fill: "#dbeafe", stroke: "#3b82f6" }, - { fill: "#fef3c7", stroke: "#f59e0b" }, - { fill: "#d1fae5", stroke: "#10b981" }, - { fill: "#e9d5ff", stroke: "#a855f7" }, - { fill: "#fed7aa", stroke: "#f97316" }, - { fill: "#fecaca", stroke: "#ef4444" }, - ] as const - return colors[minZ % colors.length]! + const minZ = Math.min(...zLayers) + const colors = [ + { fill: "#dbeafe", stroke: "#3b82f6" }, + { fill: "#fef3c7", stroke: "#f59e0b" }, + { fill: "#d1fae5", stroke: "#10b981" }, + { fill: "#e9d5ff", stroke: "#a855f7" }, + { fill: "#fed7aa", stroke: "#f97316" }, + { fill: "#fecaca", stroke: "#ef4444" }, + ] as const + return colors[minZ % colors.length]! } diff --git a/tests/fixtures/getPerLayerVisualizations.ts b/tests/fixtures/getPerLayerVisualizations.ts index 685a12f..d244286 100644 --- a/tests/fixtures/getPerLayerVisualizations.ts +++ b/tests/fixtures/getPerLayerVisualizations.ts @@ -133,4 +133,4 @@ export function getPerLayerVisualizations( } return result -} \ No newline at end of file +} diff --git a/tests/fixtures/makeCapqcityNode.ts b/tests/fixtures/makeCapqcityNode.ts index 3f2f351..8c59e53 100644 --- a/tests/fixtures/makeCapqcityNode.ts +++ b/tests/fixtures/makeCapqcityNode.ts @@ -4,7 +4,9 @@ import { getColorForZLayer } from "lib/utils/getColorForZLayer" type MeshNodes = ReturnType["meshNodes"] -export const makeCapacityMeshNodeWithLayerInfo = (nodes: MeshNodes): Map => { +export const makeCapacityMeshNodeWithLayerInfo = ( + nodes: MeshNodes, +): Map => { const map = new Map() for (const node of nodes) { @@ -17,7 +19,7 @@ export const makeCapacityMeshNodeWithLayerInfo = (nodes: MeshNodes): Map \ No newline at end of file diff --git a/tests/solver/rectDiffGridSolverPipeline.test.ts b/tests/solver/rectDiffGridSolverPipeline.test.ts index 6503e0b..b4577b8 100644 --- a/tests/solver/rectDiffGridSolverPipeline.test.ts +++ b/tests/solver/rectDiffGridSolverPipeline.test.ts @@ -2,6 +2,7 @@ import { expect, test } from "bun:test" import srj from "test-assets/bugreport11-b2de3c.json" import { getSvgFromGraphicsObject, + stackGraphicsVertically, type GraphicsObject, type Rect, } from "graphics-debug" @@ -17,6 +18,7 @@ test("RectDiffPipeline mesh layer snapshots", async () => { const { meshNodes } = solver.getOutput() const rectsByCombo = makeCapacityMeshNodeWithLayerInfo(meshNodes) + const allGraphicsObjects: GraphicsObject[] = [] // Generate a snapshot for each z-layer for (const z of [0, 1, 2, 3]) { @@ -33,15 +35,42 @@ test("RectDiffPipeline mesh layer snapshots", async () => { } } + let labelY = 0 + + if (layerRects.length > 0) { + let maxY = -Infinity + + for (const rect of layerRects) { + const top = rect.center.y + rect.height + + if (top > maxY) maxY = top + } + + labelY = maxY + } + const graphics: GraphicsObject = { title: `RectDiffPipeline - z${z}`, + texts: [ + { + anchorSide: "top_right", + text: `Layer z=${z}`, + x: 0, + y: labelY, + fontSize: 1, + }, + ], coordinateSystem: "cartesian", rects: layerRects, points: [], lines: [], } - const svg = getSvgFromGraphicsObject(graphics) - await expect(svg).toMatchSvgSnapshot(`${import.meta.path}-z${z}`) + allGraphicsObjects.push(graphics) } + + const svg = getSvgFromGraphicsObject( + stackGraphicsVertically(allGraphicsObjects), + ) + await expect(svg).toMatchSvgSnapshot(import.meta.path) }) From 6294cf2a483bfc4e053136a67bc5e50eca37b1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Wed, 24 Dec 2025 01:38:59 +0530 Subject: [PATCH 08/11] WIO --- ...DiffGridSolverPipeline.test.ts-z0.snap.svg | 44 ------------------- ...DiffGridSolverPipeline.test.ts-z1.snap.svg | 44 ------------------- ...DiffGridSolverPipeline.test.ts-z2.snap.svg | 44 ------------------- ...DiffGridSolverPipeline.test.ts-z3.snap.svg | 44 ------------------- 4 files changed, 176 deletions(-) delete mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg delete mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg delete mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg delete mode 100644 tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg deleted file mode 100644 index 79d5651..0000000 --- a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z0.snap.svg +++ /dev/null @@ -1,44 +0,0 @@ - \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg deleted file mode 100644 index 0c64ab9..0000000 --- a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z1.snap.svg +++ /dev/null @@ -1,44 +0,0 @@ - \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg deleted file mode 100644 index be0c90b..0000000 --- a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z2.snap.svg +++ /dev/null @@ -1,44 +0,0 @@ - \ No newline at end of file diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg deleted file mode 100644 index 87d4b11..0000000 --- a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.test.ts-z3.snap.svg +++ /dev/null @@ -1,44 +0,0 @@ - \ No newline at end of file From aa84bb7c6038e36c961f9bddb49a0a73c854cc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Wed, 24 Dec 2025 16:16:40 +0530 Subject: [PATCH 09/11] WIP --- ...CapqcityNode.ts => makeCapacityMeshNodeWithLayerInfo.ts} | 6 ++---- tests/solver/rectDiffGridSolverPipeline.test.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) rename tests/fixtures/{makeCapqcityNode.ts => makeCapacityMeshNodeWithLayerInfo.ts} (83%) diff --git a/tests/fixtures/makeCapqcityNode.ts b/tests/fixtures/makeCapacityMeshNodeWithLayerInfo.ts similarity index 83% rename from tests/fixtures/makeCapqcityNode.ts rename to tests/fixtures/makeCapacityMeshNodeWithLayerInfo.ts index b3a6aab..89b9a2e 100644 --- a/tests/fixtures/makeCapqcityNode.ts +++ b/tests/fixtures/makeCapacityMeshNodeWithLayerInfo.ts @@ -1,11 +1,9 @@ import type { Rect } from "graphics-debug" -import type { RectDiffPipeline } from "lib/RectDiffPipeline" +import type { CapacityMeshNode } from "lib/types/capacity-mesh-types" import { getColorForZLayer } from "lib/utils/getColorForZLayer" -type MeshNodes = ReturnType["meshNodes"] - export const makeCapacityMeshNodeWithLayerInfo = ( - nodes: MeshNodes, + nodes: CapacityMeshNode[], ): Map => { const map = new Map() diff --git a/tests/solver/rectDiffGridSolverPipeline.test.ts b/tests/solver/rectDiffGridSolverPipeline.test.ts index b4577b8..d79d5dd 100644 --- a/tests/solver/rectDiffGridSolverPipeline.test.ts +++ b/tests/solver/rectDiffGridSolverPipeline.test.ts @@ -7,7 +7,7 @@ import { type Rect, } from "graphics-debug" import { RectDiffPipeline } from "lib/RectDiffPipeline" -import { makeCapacityMeshNodeWithLayerInfo } from "tests/fixtures/makeCapqcityNode" +import { makeCapacityMeshNodeWithLayerInfo } from "tests/fixtures/makeCapacityMeshNodeWithLayerInfo" test("RectDiffPipeline mesh layer snapshots", async () => { const solver = new RectDiffPipeline({ From 26deec0af61a9a18b1113c9cc2c627f7f0a48708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0hm=E2=98=98=EF=B8=8F?= Date: Thu, 25 Dec 2025 00:26:05 +0530 Subject: [PATCH 10/11] WIP --- tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg index 64cad10..88a14e9 100644 --- a/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg +++ b/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg @@ -1,4 +1,4 @@ -Layer z=0Layer z=1Layer z=2Layer z=3