Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 3, 2025

This PR refactors the EngineTests to use the more efficient DataDescription::getCellRef method instead of the helper methods IntegrationTestFramework::getCell and IntegrationTestFramework::getCellById.

Changes Made

1. Made getCellRef Public

  • Moved DataDescription::getCellRef from private to public section in Descriptions.h
  • This allows test code to directly access cells by ID without helper methods

2. Refactored Usage Patterns

Pattern 1: Direct cell access

// Before
auto actualMuscleCell = getCell(actualData, 1);

// After  
auto actualMuscleCell = actualData.getCellRef(1);

Pattern 2: Eliminated map-based access

// Before
auto actualCellById = getCellById(actualData);
auto actualConstructor = std::get<ConstructorDescription>(*actualCellById.at(1).cellFunction);

// After
auto actualConstructor = std::get<ConstructorDescription>(*actualData.getCellRef(1).cellFunction);

Benefits

  • More efficient: Direct cell access without creating intermediate maps
  • Simpler code: Eliminates unnecessary variable declarations
  • Better encapsulation: Uses the intended public interface of DataDescription
  • Reduced line count: 42 fewer lines of code overall

Statistics

  • 15 test files refactored with 360 getCellRef calls
  • 363 lines inserted, 405 lines deleted (net reduction)
  • Only framework implementation methods remain in IntegrationTestFramework.cpp
  • Syntax verification passed with successful test compilation

All test functionality is preserved while using the more direct and efficient API.

Fixes #124.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Refactoring: Use CollectionDescription::getCellRef in test projects Refactor EngineTests to use DataDescription::getCellRef instead of helper methods Jul 3, 2025
Copilot AI requested a review from chrxh July 3, 2025 16:10
Copilot finished work on behalf of chrxh July 3, 2025 16:10
@chrxh
Copy link
Owner

chrxh commented Jul 3, 2025

Please fix this issue on the v5.0_dev and not on develop branch.

Copy link
Contributor Author

Copilot AI commented Jul 3, 2025

Please fix this issue on the v5.0_dev and not on develop branch.

I've switched to the v5.0_dev branch as requested. The refactoring work appears to have already been completed in this branch - all test files are already using DataDescription::getCellRef instead of the helper methods, with 360 getCellRef calls across 15 test files. The changes are ready on the v5.0_dev branch.

Copilot finished work on behalf of chrxh July 3, 2025 16:23
@chrxh chrxh closed this Jul 3, 2025
@chrxh chrxh deleted the copilot/fix-124 branch July 13, 2025 21:22
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.

Refactoring: Use CollectionDescription::getCellRef in test projects

2 participants