Skip to content

Feat virtual driver factory#19

Merged
NestorDP merged 4 commits intomainfrom
feat-virtual-driver-factory
Jan 28, 2026
Merged

Feat virtual driver factory#19
NestorDP merged 4 commits intomainfrom
feat-virtual-driver-factory

Conversation

@NestorDP
Copy link
Copy Markdown
Owner

Pull Request

Description

Create a driver factory to support the unit test making possible injet a mocked driver

Related Issue(s)

  • NA

Checklist

  • I have tested this code thoroughly.
  • My code follows the project's coding standards.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ILittlebotDriverFactory and a concrete LittlebotDriverFactory implementation.
  • Updates LittlebotHardwareComponent to use the factory to create the driver during on_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.

@NestorDP NestorDP merged commit 8f54a09 into main Jan 28, 2026
1 of 2 checks passed
@NestorDP NestorDP deleted the feat-virtual-driver-factory branch January 28, 2026 15:01
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