Skip to content

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Oct 20, 2025

tests became a bit hard to manage, so moving them into separate files. The integration tests were easy to move into tests/ dir, but the unit tests should be in a separate file because we don't want to grow public API surface

tests became a bit hard to manage, so moving them into separate files. The integration tests were easy to move into tests/ dir, but the unit tests should be in a separate file because we don't want to grow public API surface
@nyurik nyurik requested review from Copilot and tegimeki October 20, 2025 18:31
Copy link

@Copilot 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 reorganizes the test suite by moving integration tests from the main library module to separate test files. Unit tests that exercise private parser functions are moved to a new src/parser_tests.rs module file, while integration tests that use the public API are relocated to tests/parsing.rs. This refactoring improves code maintainability without expanding the public API surface.

Key changes:

  • Created tests/parsing.rs for integration tests using public API
  • Created src/parser_tests.rs for unit tests of internal parser functions
  • Made several parser functions pub(crate) to enable internal testing
  • Made ValDescription struct fields public to support integration test assertions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/parsing.rs New integration test file containing tests that use the public Dbc API
src/parser_tests.rs New unit test module containing parser function tests
src/lib.rs Removed test module, added parser_tests module import, made ValDescription fields public
src/parser.rs Removed inline test module, changed several parser functions from private to pub(crate) visibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +209 to +210
let message_id = MessageId::Extended(2 ^ 29);
assert_eq!(message_id.raw(), 2 ^ 29 | 1 << 31);
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The XOR operator ^ is being used where bitwise OR | is likely intended. 2 ^ 29 evaluates to 31, not a 29-bit shifted value. This should be 2 | (1 << 29) or 2 + (1 << 29) if setting bit 29.

Suggested change
let message_id = MessageId::Extended(2 ^ 29);
assert_eq!(message_id.raw(), 2 ^ 29 | 1 << 31);
let message_id = MessageId::Extended(2 | 1 << 29);
assert_eq!(message_id.raw(), (2 | 1 << 29) | 1 << 31);

Copilot uses AI. Check for mistakes.

Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@nyurik nyurik requested a review from amaraxmonika October 21, 2025 21:20
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