Skip to content

Commit 92a182d

Browse files
committed
test: sync all snapshots and pass all tests
1 parent abc1049 commit 92a182d

207 files changed

Lines changed: 4935 additions & 4635 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bun-pver-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'lib/**'
8+
- "lib/**"
99
workflow_dispatch:
1010
jobs:
1111
publish:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ If there is crowding at the pin, we look for an available spot along the trace c
3838
## Usage
3939

4040
```tsx
41-
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver"
41+
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver";
4242

43-
type ChipId = string
44-
type PinId = string
43+
type ChipId = string;
44+
type PinId = string;
4545

4646
const solver = new SchematicTracePipelineSolver({
4747
chips: {
@@ -77,9 +77,9 @@ const solver = new SchematicTracePipelineSolver({
7777
VCC: ["y+", "y-"],
7878
GND: ["y+", "y-"],
7979
},
80-
})
80+
});
8181

82-
solver.solve()
82+
solver.solve();
8383
```
8484

8585
## Development

cosmos.decorator.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import React, { useEffect } from "react"
1+
import React, { useEffect } from "react";
22

33
export const TailwindDecorator = ({
44
children,
55
}: {
6-
children: React.ReactNode
6+
children: React.ReactNode;
77
}) => {
88
useEffect(() => {
9-
const script = document.createElement("script")
10-
script.src = "https://cdn.tailwindcss.com"
11-
document.head.appendChild(script)
9+
const script = document.createElement("script");
10+
script.src = "https://cdn.tailwindcss.com";
11+
document.head.appendChild(script);
1212

1313
return () => {
14-
document.head.removeChild(script)
15-
}
16-
}, [])
14+
document.head.removeChild(script);
15+
};
16+
}, []);
1717

18-
return <>{children}</>
19-
}
18+
return <>{children}</>;
19+
};
2020

21-
export default TailwindDecorator
21+
export default TailwindDecorator;

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Schematic Trace Solver</title>
77
<script>
8-
const script = document.createElement("script")
9-
script.src = "https://cdn.tailwindcss.com"
10-
document.head.appendChild(script)
8+
const script = document.createElement("script");
9+
script.src = "https://cdn.tailwindcss.com";
10+
document.head.appendChild(script);
1111
</script>
1212
</head>
1313
<body>
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
import type { InputChip } from "lib/types/InputProblem"
2-
import type { Bounds, Point } from "@tscircuit/math-utils"
3-
import Flatbush from "flatbush"
4-
import { getInputChipBounds } from "lib/solvers/GuidelinesSolver/getInputChipBounds"
1+
import type { InputChip } from "lib/types/InputProblem";
2+
import type { Bounds, Point } from "@tscircuit/math-utils";
3+
import Flatbush from "flatbush";
4+
import { getInputChipBounds } from "lib/solvers/GuidelinesSolver/getInputChipBounds";
55

66
export interface SpatiallyIndexedChip extends InputChip {
7-
bounds: Bounds
8-
spatialIndexId: number
7+
bounds: Bounds;
8+
spatialIndexId: number;
99
}
1010

1111
export class ChipObstacleSpatialIndex {
12-
chips: Array<SpatiallyIndexedChip>
13-
spatialIndex: Flatbush
14-
spatialIndexIdToChip: Map<number, SpatiallyIndexedChip>
12+
chips: Array<SpatiallyIndexedChip>;
13+
spatialIndex: Flatbush;
14+
spatialIndexIdToChip: Map<number, SpatiallyIndexedChip>;
1515

1616
constructor(chips: InputChip[]) {
1717
this.chips = chips.map((chip) => ({
1818
...chip,
1919
bounds: getInputChipBounds(chip),
2020
spatialIndexId: null as any,
21-
}))
21+
}));
2222

23-
this.spatialIndexIdToChip = new Map()
24-
this.spatialIndex = new Flatbush(chips.length)
23+
this.spatialIndexIdToChip = new Map();
24+
this.spatialIndex = new Flatbush(chips.length);
2525

2626
for (const chip of this.chips) {
2727
chip.spatialIndexId = this.spatialIndex.add(
2828
chip.bounds.minX,
2929
chip.bounds.minY,
3030
chip.bounds.maxX,
3131
chip.bounds.maxY,
32-
)
33-
this.spatialIndexIdToChip.set(chip.spatialIndexId, chip)
32+
);
33+
this.spatialIndexIdToChip.set(chip.spatialIndexId, chip);
3434
}
3535

36-
this.spatialIndex.finish()
36+
this.spatialIndex.finish();
3737
}
3838

3939
getChipsInBounds(bounds: Bounds): Array<InputChip & { bounds: Bounds }> {
@@ -42,29 +42,29 @@ export class ChipObstacleSpatialIndex {
4242
bounds.minY,
4343
bounds.maxX,
4444
bounds.maxY,
45-
)
45+
);
4646

47-
return chipSpatialIndexIds.map((id) => this.spatialIndexIdToChip.get(id)!)
47+
return chipSpatialIndexIds.map((id) => this.spatialIndexIdToChip.get(id)!);
4848
}
4949

5050
doesOrthogonalLineIntersectChip(
5151
line: [Point, Point],
5252
opts: {
53-
excludeChipIds?: string[]
53+
excludeChipIds?: string[];
5454
} = {},
5555
): boolean {
56-
const excludeChipIds = opts.excludeChipIds ?? []
57-
const [p1, p2] = line
58-
const { x: x1, y: y1 } = p1
59-
const { x: x2, y: y2 } = p2
56+
const excludeChipIds = opts.excludeChipIds ?? [];
57+
const [p1, p2] = line;
58+
const { x: x1, y: y1 } = p1;
59+
const { x: x2, y: y2 } = p2;
6060

6161
const chips = this.getChipsInBounds({
6262
minX: Math.min(x1, x2),
6363
minY: Math.min(y1, y2),
6464
maxX: Math.max(x1, x2),
6565
maxY: Math.max(y1, y2),
66-
}).filter((chip) => !excludeChipIds.includes(chip.chipId))
66+
}).filter((chip) => !excludeChipIds.includes(chip.chipId));
6767

68-
return chips.length > 0
68+
return chips.length > 0;
6969
}
7070
}

lib/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "./solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
2-
export * from "./types/InputProblem"
3-
export { SchematicTraceSingleLineSolver2 } from "./solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2"
1+
export * from "./solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver";
2+
export * from "./types/InputProblem";
3+
export { SchematicTraceSingleLineSolver2 } from "./solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2";
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
import type { GraphicsObject } from "graphics-debug"
1+
import type { GraphicsObject } from "graphics-debug";
22

33
export class BaseSolver {
4-
MAX_ITERATIONS = 100e3
5-
solved = false
6-
failed = false
7-
iterations = 0
8-
progress = 0
9-
error: string | null = null
10-
activeSubSolver?: BaseSolver | null
11-
failedSubSolvers?: BaseSolver[]
12-
timeToSolve?: number
13-
stats: Record<string, any> = {}
4+
MAX_ITERATIONS = 100e3;
5+
solved = false;
6+
failed = false;
7+
iterations = 0;
8+
progress = 0;
9+
error: string | null = null;
10+
activeSubSolver?: BaseSolver | null;
11+
failedSubSolvers?: BaseSolver[];
12+
timeToSolve?: number;
13+
stats: Record<string, any> = {};
1414

1515
/** DO NOT OVERRIDE! Override _step() instead */
1616
step() {
17-
if (this.solved) return
18-
if (this.failed) return
19-
this.iterations++
17+
if (this.solved) return;
18+
if (this.failed) return;
19+
this.iterations++;
2020
try {
21-
this._step()
21+
this._step();
2222
} catch (e) {
23-
this.error = `${this.constructor.name} error: ${e}`
24-
this.failed = true
25-
throw e
23+
this.error = `${this.constructor.name} error: ${e}`;
24+
this.failed = true;
25+
throw e;
2626
}
2727
if (!this.solved && this.iterations > this.MAX_ITERATIONS) {
28-
this.tryFinalAcceptance()
28+
this.tryFinalAcceptance();
2929
}
3030
if (!this.solved && this.iterations > this.MAX_ITERATIONS) {
31-
this.error = `${this.constructor.name} ran out of iterations`
32-
this.failed = true
31+
this.error = `${this.constructor.name} ran out of iterations`;
32+
this.failed = true;
3333
}
3434
if ("computeProgress" in this) {
3535
// @ts-ignore
36-
this.progress = this.computeProgress() as number
36+
this.progress = this.computeProgress() as number;
3737
}
3838
}
3939

4040
_step() {}
4141

4242
getConstructorParams() {
43-
throw new Error("getConstructorParams not implemented")
43+
throw new Error("getConstructorParams not implemented");
4444
}
4545

4646
solve() {
47-
const startTime = Date.now()
47+
const startTime = Date.now();
4848
while (!this.solved && !this.failed) {
49-
this.step()
49+
this.step();
5050
}
51-
const endTime = Date.now()
52-
this.timeToSolve = endTime - startTime
51+
const endTime = Date.now();
52+
this.timeToSolve = endTime - startTime;
5353
}
5454

5555
visualize(): GraphicsObject {
@@ -58,7 +58,7 @@ export class BaseSolver {
5858
points: [],
5959
rects: [],
6060
circles: [],
61-
}
61+
};
6262
}
6363

6464
/**
@@ -78,6 +78,6 @@ export class BaseSolver {
7878
points: [],
7979
rects: [],
8080
circles: [],
81-
}
81+
};
8282
}
8383
}

0 commit comments

Comments
 (0)