Conversation
There was a problem hiding this comment.
Pull request overview
Adds a driver-factory abstraction so LittlebotHardwareComponent can create (or be provided) a driver via an injectable factory, enabling easier mocking in unit tests.
Changes:
- Introduces
ILittlebotDriverFactoryand a concreteLittlebotDriverFactoryimplementation. - Updates
LittlebotHardwareComponentto use the factory to create the driver duringon_configure(). - Organizes test mocks under
test/mocks/and updates test includes accordingly.
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| littlebot_base/test/test_littlebot_hardware_component.cpp | Updates mock include path (now under mocks/). |
| littlebot_base/test/test_littlebot_driver.cpp | Updates mock include paths for serial + RT buffer mocks. |
| littlebot_base/test/mocks/mock_serial_port.hpp | Adds a gmock-based ISerialPort mock. |
| littlebot_base/test/mocks/mock_rt_buffer.hpp | Adds a templated gmock-based IRTBuffer mock. |
| littlebot_base/test/mocks/mock_littlebot_driver_factory.hpp | Adds a gmock-based ILittlebotDriverFactory mock. |
| littlebot_base/test/mocks/mock_littlebot_driver.hpp | Adds a gmock-based ILittlebotDriver mock. |
| littlebot_base/src/littlebot_hardware_component.cpp | Switches driver construction to go through driver_factory_. |
| littlebot_base/src/littlebot_driver_factory.cpp | Converts the old free function into LittlebotDriverFactory::create(). |
| littlebot_base/include/littlebot_base/littlebot_hardware_component.hpp | Adds setDriverFactory() and stores driver_factory_. |
| littlebot_base/include/littlebot_base/littlebot_driver_factory.hpp | Defines LittlebotDriverFactory implementing the new interface. |
| littlebot_base/include/littlebot_base/i_littlebot_driver_factory.hpp | Adds the new factory interface for driver creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull Request
Description
Create a driver factory to support the unit test making possible injet a mocked driver
Related Issue(s)
Checklist