Skip to content

test: increase nebula_core_common unit coverage#425

Open
mojomex wants to merge 9 commits intotier4:mainfrom
mojomex:test/increase-unit-coverage
Open

test: increase nebula_core_common unit coverage#425
mojomex wants to merge 9 commits intotier4:mainfrom
mojomex:test/increase-unit-coverage

Conversation

@mojomex
Copy link
Copy Markdown
Collaborator

@mojomex mojomex commented Mar 25, 2026

PR Type

  • Improvement

Related Links

Description

This PR increases coverage of nebula_core_common and adds focused unit tests for vendor-independent helpers.

Main additions:

  • enum/string conversion coverage for ReturnType, ReturnMode, SensorModel, and Status
  • stream-operator coverage for the core configuration structs and representative point-conversion helpers
  • direct coverage for ring_buffer, bitfield, expected, rate_limiter, stopwatch, errno, and string conversion utilities
  • unsigned edge-case coverage for get_bitfield() across uint8_t, uint16_t, and uint32_t

Small code fixes discovered while adding coverage:

  • add missing Pandar128E3X handling in core sensor-model conversion helpers
  • add the missing CAN_CONNECTION_ERROR branch in status streaming
  • make bitfield explicitly require unsigned integral storage and simplify mask construction
  • initialize the errno buffer to avoid the compiler warning treated as an error

Review Procedure

  1. Review the PR commit-by-commit; the core coverage work is intentionally split into small commits.
  2. In nebula_common tests, check that round-trip/default-case coverage reflects the public conversion helpers without overfitting stream formatting.
  3. In the utility-helper tests, focus on the new unsigned-only bitfield contract and the added edge-case coverage for full-width extraction.
  4. Sanity-check the small production fixes in nebula_common.hpp, nebula_status.hpp, bitfield.hpp, and errno.hpp that were exposed by the added tests.

Remarks

Verification used while preparing this PR:

  • source /opt/ros/humble/setup.bash && colcon build --packages-select nebula_core_common --symlink-install --mixin debug compile-commands coverage-gcc
  • source /opt/ros/humble/setup.bash && colcon test --packages-select nebula_core_common --event-handlers console_direct+

The repo-wide build-test-cov.sh run succeeds through coverage generation after splitting the vendor-specific work into follow-up PRs, but there is still an unrelated existing failure in nebula_core_hw_interfaces (TestTcp.TestConnectTimeout) that is not addressed here.

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.73%. Comparing base (ac59892) to head (21b942c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #425      +/-   ##
==========================================
+ Coverage   39.72%   48.73%   +9.01%     
==========================================
  Files         128      165      +37     
  Lines       10018    13365    +3347     
  Branches     4977     6962    +1985     
==========================================
+ Hits         3980     6514    +2534     
- Misses       5443     5476      +33     
- Partials      595     1375     +780     
Flag Coverage Δ
nebula_core_common 87.46% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mojomex mojomex closed this Mar 31, 2026
@mojomex mojomex force-pushed the test/increase-unit-coverage branch from 283aa5f to cac9401 Compare March 31, 2026 15:15
@mojomex mojomex reopened this Mar 31, 2026
@mojomex mojomex marked this pull request as ready for review March 31, 2026 17:08
@mojomex mojomex changed the title test: increase unit coverage test: increase nebula_core_common unit coverage Mar 31, 2026
@mojomex mojomex requested a review from drwnz April 1, 2026 11:55
@mojomex mojomex self-assigned this Apr 1, 2026
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