Skip to content

Feature/test reorganization#1

Merged
pratzl merged 15 commits intomainfrom
feature/test-reorganization
Jan 30, 2026
Merged

Feature/test reorganization#1
pratzl merged 15 commits intomainfrom
feature/test-reorganization

Conversation

@pratzl
Copy link
Collaborator

@pratzl pratzl commented Jan 30, 2026

No description provided.

pratzl added 15 commits January 26, 2026 13:42
- Create new include/graph/adj_list/ directory for adjacency list abstractions
- Move descriptor types: descriptor.hpp, descriptor_traits.hpp,
  vertex_descriptor.hpp, vertex_descriptor_view.hpp,
  edge_descriptor.hpp, edge_descriptor_view.hpp
- Move concepts/traits: adjacency_list_concepts.hpp, adjacency_list_traits.hpp
- Move CPOs: detail/graph_cpo.hpp -> adj_list/detail/graph_cpo.hpp
- Move utilities: graph_utility.hpp
- Keep graph_info.hpp in place (shared with future edge_list)
- Keep container/* in place (concrete implementations)
- Update all includes in containers, tests, examples, benchmarks
- Add edge_list_goal.md and edge_list_strategy.md for upcoming edge list work

All 3912 tests pass.
- Created tests/adj_list/ for adjacency list abstraction tests
- Created tests/container/ for container implementation tests
- Split monolithic graph3_tests into:
  * graph3_adj_list_tests (25 test files)
  * graph3_container_tests (72 test files)
- Benefits: faster incremental builds, selective test execution
- All 36,131 test assertions pass (3,912 test cases)
- Added test reorganization strategy and execution plan documents
Consolidate 8 container-specific CPO test files into 3 iterator-category files:
- test_dynamic_graph_cpo_random_access.cpp (vov, vod, dov, dod)
- test_dynamic_graph_cpo_bidirectional.cpp (vol, dol)
- test_dynamic_graph_cpo_forward.cpp (vofl, dofl)

Key differences by category:
- Random-access: Supports num_edges(g, u), insertion order
- Bidirectional: No num_edges(g, u), insertion order (push_back)
- Forward-only: No num_edges(g, u), reverse order (push_front)

Results:
- Removed ~27,000 lines of duplicate code
- Added ~1,200 lines of consolidated tests
- Net reduction: ~25,700 lines (~95%)
- All 3,764 tests pass
- Build time reduced

The consolidated files use TEMPLATE_TEST_CASE to test across
multiple trait types with a single test definition.
The consolidated CPO test files only contained a subset of the original
tests (~9 of 29 TEST_CASE blocks). Reverting to the original complete
test files until a proper consolidation can be done that includes all
CPO tests:

Missing from consolidated files:
- vertex_id(g, u)
- edges(g, u), edges(g, uid)
- target_id(g, uv), target(g, uv)
- find_vertex_edge(g, u, v), find_vertex_edge(g, uid, vid)
- contains_edge(g, u, v), contains_edge(g, uid, vid)
- vertex_value(g, u), edge_value(g, uv), graph_value(g)
- partition_id(g, u), num_partitions(g), vertices(g, pid), num_vertices(g, pid)
- source_id(g, uv), source(g, uv)
- Various integration tests

All 3,912 tests pass.
The attempted consolidation only migrated ~9 of 29 TEST_CASE categories.
Full consolidation requires significant template infrastructure to handle
the multiple type configurations per container:

- xxx_void, xxx_int_ev, xxx_int_vv, xxx_all_int, xxx_string
- xxx_sourced_void, xxx_sourced_int, xxx_sourced_all

Original 8 CPO test files remain intact with all 3,912 tests passing.
Phase 2 marked as DEFERRED pending decision on consolidation approach.
- Create tests/common/graph_test_types.hpp with tag-based type generation
  - vov_tag, vod_tag, dov_tag, dod_tag for container selection
  - graph_test_types<Tag> generates all 8 type configurations per container

- Create test_dynamic_graph_cpo_random_access.cpp with 23 TEMPLATE_TEST_CASEs
  - Consolidates 4 containers into single file using TEMPLATE_TEST_CASE
  - 92 test cases (23 categories × 4 containers)
  - 520 assertions all passing

- Original 4 CPO files retained (vov, vod, dov, dod) - to be removed after full validation

All 3,402 container tests pass (33,666 assertions)
Added missing 6 TEMPLATE_TEST_CASEs:
- num_edges(g, uid)
- find_vertex_edge(g, u, v) - descriptor overload
- contains_edge(g, u, v) - descriptor overload
- edge_value(g, uv)
- integration: values
- integration: modify vertex and edge values

Now fully matches vov original:
- 29 TEMPLATE_TEST_CASEs in random_access file
- 116 test cases (29 × 4 containers)
- 696 assertions passing

All 3,426 container tests pass (33,842 assertions)
- Expand test_dynamic_graph_cpo_random_access.cpp to 216 SECTIONs
- Add missing sections: complete small graph, all edges not found, self-loops
- Fix template type errors and find_vertex_edge return type comparisons
- Remove replaced individual CPO test files (vov, vod, dov, dod)
- Update CMakeLists.txt to reflect file removals

Consolidated file provides 6,132 assertions in 116 test cases covering
all 4 random-access container types with template-based approach.
…ol/dol tests

- Extended edge_descriptor_view to support O(1) size() for all container types
  - Added size_ member variable to cache size during construction
  - For random-access: uses container.size() - O(1)
  - For non-random-access (list, forward_list): uses std::distance() once - O(n) at construction, O(1) thereafter
  - Fixed std::forward_list compatibility (no size() method)

- Consolidated vol and dol tests into test_dynamic_graph_cpo_random_access.cpp
  - Added vol_tag and dol_tag to graph_test_types.hpp
  - Now tests 6 container types: vov, vod, dov, dod, vol, dol
  - Removed standalone test files for vol and dol
  - Updated CMakeLists.txt accordingly

Test results: 34,888 assertions in 3,314 test cases - all passing
- Create test_dynamic_graph_cpo_forward_list.cpp (vofl, dofl)
- Create test_dynamic_graph_cpo_sorted.cpp (vos, dos)
- Create test_dynamic_graph_cpo_unordered.cpp (vous, dous)
- Add tags: vofl_tag, dofl_tag, mofl_tag, vos_tag, dos_tag, mos_tag,
  uos_tag, vous_tag, dous_tag, mous_tag, uous_tag
- Remove individual files for vofl, dofl, vos, dos, vous, dous
- Keep map-based container tests separate (mofl, mos, uos, mous, uous)
  due to different vertex creation semantics (on-demand vs resize)
- Fix forward_list tests for reverse insertion order
- Fix sorted tests for set deduplication (parallel edges) and const elements

All 37891 assertions pass in 3311 test cases.
- Replaced minimal 619-line unordered test file with comprehensive 3245-line version
- Based on sorted.cpp template with unordered-specific adaptations
- Fix order-dependent assertions to use sorted comparison (hash order unspecified)
- All 58 test cases (2836 assertions) pass for unordered containers

All 40605 assertions pass in 3325 test cases.
- Add map_graph_test_data.hpp with static test data and helper functions for:
  - Basic edges (contiguous IDs 0-3)
  - Sparse edges (non-contiguous IDs 100, 500, 1000, 5000)
  - Very sparse edges (1, 2, 500000, 1000000, 2000000)
  - Self-loop edges
  - Expected results for each data set

- Add test_dynamic_graph_cpo_map_vertices.cpp consolidating tests for:
  mol, mov, mod, mofl, mos, mous (map-based vertex containers)
  - 18 TEMPLATE_TEST_CASE sections covering all CPOs
  - Tests sorted iteration order (map property)
  - Tests sparse vertex ID feature

- Add test_dynamic_graph_cpo_unordered_map_vertices.cpp consolidating tests for:
  uol, uov, uod, uofl, uos, uous (unordered_map-based vertex containers)
  - 16 TEMPLATE_TEST_CASE sections covering all CPOs
  - Tests unordered iteration with sorted comparison
  - Tests sparse vertex ID feature

- Add mo*/uo* tags to graph_test_types.hpp:
  mol_tag, mov_tag, mod_tag, uol_tag, uov_tag, uod_tag, uofl_tag

Key features tested:
- Sparse vertex IDs (100, 500, 1000, 5000) - primary map container use case
- Vertices created on-demand from edge endpoints
- Map containers iterate in sorted order
- Unordered_map containers use sorted comparison for verification

All 41,457 assertions in 3,537 test cases pass
Expanded test_dynamic_graph_cpo_map_vertices.cpp and
test_dynamic_graph_cpo_unordered_map_vertices.cpp to have
comprehensive CPO coverage matching test_dynamic_graph_cpo_random_access.cpp.

Changes:
- Both files now have 29 TEMPLATE_TEST_CASE sections (up from 19 and 16)
- Added missing CPO tests:
  - num_edges(g, u) - edge count per vertex descriptor
  - num_edges(g, uid) - edge count by vertex ID
  - edges(g, uid) - edges by vertex ID
  - find_vertex_edge(g, u, v) - find edge with vertex descriptors
  - find_vertex_edge(g, uid, vid) - find edge with IDs
  - contains_edge(g, u, v) - check edge with vertex descriptors
  - contains_edge(g, uid, vid) - check edge with IDs
  - vertices(g, pid) - partition vertex range
  - num_vertices(g, pid) - partition vertex count
  - source_id(g, uv) - source ID (Sourced=true)
  - source(g, uv) - source vertex descriptor (Sourced=true)
  - partition_id(g, u)
  - num_partitions(g)
- Added integration tests for traversal and value modification
- Expanded SECTIONs in existing tests for better coverage

Line counts after expansion:
- map_vertices: 1,658 lines (was 641)
- unordered_map_vertices: 1,665 lines (was 439)

All 3,661 container tests pass with 43,471 assertions.
Deleted individual CPO test files that are now covered by consolidated tests:

Map-based (covered by test_dynamic_graph_cpo_map_vertices.cpp):
- test_dynamic_graph_cpo_mol.cpp (1,649 lines)
- test_dynamic_graph_cpo_mov.cpp (1,852 lines)
- test_dynamic_graph_cpo_mod.cpp (1,857 lines)
- test_dynamic_graph_cpo_mofl.cpp (1,722 lines)
- test_dynamic_graph_cpo_mos.cpp (1,773 lines)
- test_dynamic_graph_cpo_mous.cpp (1,782 lines)

Unordered_map-based (covered by test_dynamic_graph_cpo_unordered_map_vertices.cpp):
- test_dynamic_graph_cpo_uol.cpp (1,763 lines)
- test_dynamic_graph_cpo_uov.cpp (1,763 lines)
- test_dynamic_graph_cpo_uod.cpp (1,763 lines)
- test_dynamic_graph_cpo_uofl.cpp (1,762 lines)
- test_dynamic_graph_cpo_uos.cpp (1,786 lines)
- test_dynamic_graph_cpo_uous.cpp (1,783 lines)

Total: ~21,255 lines removed

Retained edge_multiset CPO tests (moem, voem) as they are not yet consolidated.

All 3,333 container tests pass with 39,168 assertions.
- Create consolidated edge map CPO test file (1,654 lines)
- Delete test_dynamic_graph_cpo_moem.cpp (1,773 lines)
- Delete test_dynamic_graph_cpo_voem.cpp (1,274 lines)
- Fix incorrect parallel edge tests (map containers deduplicate)
- Update graph_test_types.hpp comments for voem_tag/moem_tag
- Net reduction: 1,393 lines
@pratzl pratzl merged commit 18ed348 into main Jan 30, 2026
0 of 22 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.

1 participant