Repository navigation
Add class tests for IdentifierMSRunMapper and ProteinModificationSummary - #9579
timosachsenberg merged 1 commit into
Conversation
Both METADATA classes were previously untested (OpenMS 3.6.0 pre-release testing plan, OpenMS#9460). IdentifierMSRunMapper_test: - construction from ProteinIdentifications and create() (incl. clearing) - empty/size, hasIdentifier, getMSRunPaths (and empty-on-unknown) - getIdentifiers ordering, getIdentifier (full path-list match + throws) - hasRunPath / tryGetIdentifier - getPrimaryMSRunPath via id_merge_index (default, valid, out-of-range, unknown identifier) - duplicate ms-run-path rejection (Exception::InvalidValue) ProteinModificationSummary_test: - Statistics::operator== over all four fields - ProteinModificationSummary::operator== across position/modification/stats - nested type aliases and map semantics Tests only; no production code changes.
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-16 05:51:50.461150455 +0000
+++ AUTHORS.new 2026-06-16 05:51:55.735812362 +0000
@@ -23,8 +23,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
📝 WalkthroughWalkthroughTwo new OpenMS unit test files are added— ChangesNew metadata class unit tests
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tests/class_tests/openms/source/ProteinModificationSummary_test.cpp`:
- Around line 115-116: The modification object ox retrieved from
ModificationsDB::getInstance()->getModification() is used without validating
that it is not null, which could lead to silent test failures. Add a
TEST_NOT_EQUAL assertion immediately after the getModification call to verify
that ox is not null before using it as a key or in any subsequent operations.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b2f87a5a-732e-4ec7-ae4e-ab3d5712ae5e
📒 Files selected for processing (3)
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/IdentifierMSRunMapper_test.cppsrc/tests/class_tests/openms/source/ProteinModificationSummary_test.cpp
| const ResidueModification* ox = ModificationsDB::getInstance()->getModification("Oxidation", "M", ResidueModification::ANYWHERE); | ||
|
|
There was a problem hiding this comment.
Add a null-check for the fetched modification in this section.
Line 115 retrieves ox and it is used as a key without asserting non-null in this section. Add a local TEST_NOT_EQUAL(ox, nullptr) before insertion to avoid a silent false-positive test path.
Suggested patch
START_SECTION([EXTRA] (nested type aliases and map semantics))
{
const ResidueModification* ox = ModificationsDB::getInstance()->getModification("Oxidation", "M", ResidueModification::ANYWHERE);
+ TEST_NOT_EQUAL(ox, nullptr)
ProteinModificationSummary s;
ProteinModificationSummary::Statistics st;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/tests/class_tests/openms/source/ProteinModificationSummary_test.cpp`
around lines 115 - 116, The modification object ox retrieved from
ModificationsDB::getInstance()->getModification() is used without validating
that it is not null, which could lead to silent test failures. Add a
TEST_NOT_EQUAL assertion immediately after the getModification call to verify
that ox is not null before using it as a key or in any subsequent operations.
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
|
Adversarial review result: I did not find a blocking issue in this pass. This is a test-only addition for |
Part of the OpenMS 3.6.0 pre-release testing plan (#9460): adds class tests for two previously untested
METADATAclasses.IdentifierMSRunMapperTwo-way mapping between protein-identification identifiers and MS-run-paths (used e.g. for USI building / resolving the source file of a peptide ID). Tests cover:
ProteinIdentifications andcreate()(including that it clears prior content)empty(),size(),hasIdentifier()getMSRunPaths()(and empty list returned for unknown identifiers)getIdentifiers()ordering,getIdentifier()(full path-list match, andException::ElementNotFoundon miss)hasRunPath()/tryGetIdentifier()getPrimaryMSRunPath()resolution viaid_merge_index(default index 0, valid index, out-of-range → empty, unknown identifier → empty)Exception::InvalidValue)ProteinModificationSummaryMaps a protein position → modification → statistics. Tests cover:
Statistics::operator==over all four fields (count, frequency, FLR, probability)ProteinModificationSummary::operator==across differing position / modification / statisticsModificationsToStatistics,AALevelSummary) and map semanticsExpected values were pinned by probing the built library before writing assertions; both tests build and pass locally with no warnings (aside from the standard dtor-only "no subtests" notice).
Tests only — no production code changes.
Summary by CodeRabbit