Skip to content

DRY conversions / move convert unit tests to one spot#2

Merged
heathhenley merged 3 commits intomainfrom
dev_dry_conversions
Feb 13, 2026
Merged

DRY conversions / move convert unit tests to one spot#2
heathhenley merged 3 commits intomainfrom
dev_dry_conversions

Conversation

@heathhenley
Copy link
Copy Markdown
Contributor

No description provided.

It was easy to get started but makes more sense - moving all the
tests into a single place next - subscriber and request tests will
eventually test more of the actual functionality instead of conversion
internals.
Move all conversion tests to one place
Autoformat with clang format
Copy link
Copy Markdown
Contributor

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

This PR consolidates duplicate conversion code from subscriber.cpp and requests.cpp into a single shared implementation in conversions.cpp, following the DRY (Don't Repeat Yourself) principle. The refactoring moves all proto-to-wrapper type conversions into the farsounder::detail namespace and consolidates all conversion tests into a single test file with improved coverage.

Changes:

  • Created new conversions.cpp and conversions_internal.hpp to centralize all conversion logic previously duplicated across subscriber and requests modules
  • Consolidated two separate test files (subscriber_conversion_tests.cpp and requests_conversion_tests.cpp) into one comprehensive conversions_unit_tests.cpp with additional edge case coverage
  • Updated all call sites to use fully qualified namespace references (farsounder::detail::) where needed to avoid ambiguity

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/conversions.cpp New file containing all consolidated conversion implementations (timestamp, enums, data structures)
src/conversions_internal.hpp New header declaring all conversion functions in farsounder::detail namespace
src/subscriber.cpp Removed duplicate conversion implementations and unnecessary <ctime> include
src/subscriber_internal.hpp Simplified to just include conversions_internal.hpp
src/requests.cpp Removed duplicate conversion implementations, updated calls to use farsounder::detail:: qualification
src/requests_internal.hpp Removed conversion function declarations (now in conversions_internal.hpp)
tests/conversions_unit_tests.cpp New consolidated test file with improved coverage including edge cases for unknown enum values and missing optional fields
tests/CMakeLists.txt Updated to reference new consolidated test file
CMakeLists.txt Added conversions.cpp to library sources
examples/basic_client.cpp Minor formatting improvements to break long lines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@heathhenley heathhenley merged commit 9da9b00 into main Feb 13, 2026
0 of 2 checks passed
@heathhenley heathhenley deleted the dev_dry_conversions branch February 13, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants