Add the first unit-test suite + repair the broken smoke tests#20
Open
prat96 wants to merge 3 commits into
Open
Add the first unit-test suite + repair the broken smoke tests#20prat96 wants to merge 3 commits into
prat96 wants to merge 3 commits into
Conversation
The test was broken on all platforms for three reasons:
- 2-layer board: lateral edges exist only on inner layers, so the graph
build raised ValueError('No edges'). Use 4 copper layers.
- Pads were never attached to the board/net objects, so bounds fell back
to 100x100mm and the escape planner found no routable pads.
- precompute_all_pad_escapes was never called, so _parse_requests
silently dropped the net (no portals).
Assertions now check the live engine state (_via_edges, net_paths,
accounting.present) instead of stale attributes (via_edge_ids, owner,
e_is_via, present_cost) that no longer exist on PathFinderRouter.
Signed-off-by: Pratheek Balakrishna <pratheekb96@gmail.com>
- A board that parses to 0 nets/0 pads now exits 1 with a clear message pointing at the file parser instead of the misleading 'No copper generated' (the KiCad 10 parse failure was completely silent). - cli now calls precompute_all_pad_escapes like the GUI/headless paths; without portals _parse_requests silently drops every net, so cli could never route anything. Signed-off-by: Pratheek Balakrishna <pratheekb96@gmail.com>
CONTRIBUTING.md lists tests as the "Critical Priority" and the repo has had zero. Adds a KiCad-free suite with no new runtime dependencies: lattice invariants, EdgeAccountant via accounting, and an engine-smoke test that routes a trivial two-pad board through the mandatory call sequence. conftest.py holds the shared fixtures and make_two_pad_board. The .gitignore previously ignored test_*.py and tests/*, which blocked tracking any suite at all; re-include tests/*.py so a clean clone can collect and run it. Signed-off-by: Pratheek Balakrishna <pratheekb96@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the first unit-test suite to the repo, and repairs the two smoke-test
entry points that were broken on every platform.
Why
CONTRIBUTING.mdlists tests as the Critical Priority ("The project haszero unit tests. This is the biggest blocker to refactoring."). This starts
that suite — KiCad-free, CPU-only, no new runtime dependencies — and along
the way fixes two commands that silently did the wrong thing:
python main.py --test-viabuilt a 2-layer board, which produces anempty routing graph (no via layers), so the self-test raised before it could
test anything. Now uses a 4-layer board and the real engine call sequence.
climode printed "No copper generated" and exited 0 when a board parsedto 0 nets, and skipped the mandatory
precompute_all_pad_escapesstep (whichsilently drops every net). Now it runs the full sequence and hard-fails
(exit 1) on a 0-net parse.
It also fixes
.gitignore, which ignoredtest_*.pyandtests/*— activelypreventing any test suite from being tracked.
Tests
test_lattice— node count, H/V layer discipline, legal planar edges, legalvia pairs.
test_via_accounting—EdgeAccountantcommit/clear symmetry, usage flooredat 0, refresh-from-canonical, overuse counting at capacity.
test_engine_smoke— the mandatory engine call sequence routes a trivialtwo-pad board end to end.
conftest.py— shared fixtures +make_two_pad_boardfactory.No KiCad, no GPU, no network required.
Checklist
.gitignoreso a fresh clone can collect the suite