Skip to content

Add C++ wrapper coverage tests (82% -> 90%)#307

Merged
toruseo merged 3 commits intotoruseo:mainfrom
toruseoagent:pr/cpp-coverage-90
Apr 3, 2026
Merged

Add C++ wrapper coverage tests (82% -> 90%)#307
toruseo merged 3 commits intotoruseo:mainfrom
toruseoagent:pr/cpp-coverage-90

Conversation

@toruseoagent
Copy link
Copy Markdown
Contributor

Summary

  • Add 10 new test functions to tests/test_cpp_mode.py covering previously untested C++ wrapper code paths
  • Wrapper coverage: 82% -> 90% (73 additional lines covered, 108 remaining)

New tests

Test What it covers Lines
test_coverage_vehicle_abort_and_all_logs Dead-end abort, all vehicle log properties, traveled_route(), AttributeError ~35
test_coverage_vehicle_route_manipulation enforce_route, set_links_prefer, set_links_avoid ~14
test_coverage_link_mid_simulation_queries speed/density/flow, arrival_count/departure_count, instant_travel_time/actual_travel_time with boundary values ~13
test_coverage_link_setters_and_eular_dx capacity_in_remain/capacity_out_remain setters, mid-sim cumulative curve access, edie_dx ~14
test_coverage_misc_world_methods get_node/get_link edge cases, NotImplementedError stubs, on_time, change_print_mode ~18
test_coverage_node_signal_and_rename Signal properties, node auto-rename, repr ~10
test_coverage_route_dunder_methods __repr__/__iter__/__len__/__getitem__ on Route ~4
test_coverage_addVehicle_taxi_and_links_avoid Taxi NotImplementedError, links_avoid parameter ~5
test_coverage_demand_methods adddemand_point2point, adddemand_area2area, adddemand_area2area2, adddemand_nodes2nodes2 ~10
test_coverage_link_auto_rename Duplicate link name with auto_rename=True/False ~5

All tests use real simulations (no mocks) with small networks.

Test plan

  • All 182 C++ mode tests pass (--reruns 5)
  • Wrapper coverage: 90% (measured with coverage.py)

Part of #297

🤖 Generated with Claude Code

toruseoagent and others added 3 commits April 2, 2026 09:12
New tests covering vehicle abort/logs, route manipulation, mid-simulation
link queries, link setters, World utility methods, node signals, Route
dunders, taxi NotImplementedError, demand methods, and link auto-rename.

Wrapper coverage: 82% -> 90% (73 additional lines covered).
All 182 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New tests directly calling C++ bindings for vehicle log methods,
batch log APIs, world query methods, and edge cases (signals,
capacity constraints, specified_route, generation_queue).

C++ coverage: 74% -> 92% (traffi.cpp: 93%, bindings.cpp: 91%)
Wrapper coverage: 90%
All 186 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 4 tests that accessed _cpp_world/_cpp_vehicle internals with
3 tests using only the public API (W.xxx, veh.xxx, link.xxx).

Coverage results (public API only):
- Python wrapper: 90%
- C++ engine: 74% (unreachable dead code accounts for the gap to 90%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@toruseo toruseo merged commit 9ca7b34 into toruseo:main Apr 3, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants