Repository navigation
[TEST] Add OSWData_test (OpenSWATH in-memory data structure) - #9567
Conversation
DATASTRUCTURES/OSWData - the in-memory OpenSWATH results structure (protein -> peptide precursor -> peak group -> transition hierarchy) used by the OSW reader/UI - had no test. Adds a class test covering: - the immutable value types OSWTransition / OSWPeakGroup (incl. the QVALUE_MISSING default) / OSWPeptidePrecursor / OSWProtein and their accessors; - OSWHierarchy::LevelName and OSWIndexTrace::isSet(); - the OSWData container: addTransition (both overloads), transitionCount, getTransition / getTransitions, addProtein (incl. the referential-integrity check that rejects a protein referencing an unknown transition ID with Exception::Precondition), getProteins (full hierarchy reachable), setProtein, setSqlSourceFile / setRunID, clear vs clearProteins (the latter keeps the transitions), buildNativeIDResolver (run-id mismatch -> Precondition) and fromNativeID (no resolver built -> InvalidValue). Registered in executables.cmake (datastructures_executables_list). Part of the OpenMS 3.6.0 pre-release testing plan (OpenMS#9460). Tests only; no production code changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new unit test file ChangesOSWData Unit Test Suite
🚥 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
🧹 Nitpick comments (3)
src/tests/class_tests/openms/source/OSWData_test.cpp (3)
225-225: 💤 Low valueSimplify test assertion for readability.
The assertion
TEST_EQUAL(d.getRunID() == 123456789ULL, true)tests a boolean expression. It's clearer to compare the value directly:TEST_EQUAL(d.getRunID(), 123456789ULL).♻️ Proposed refactor
- TEST_EQUAL(d.getRunID() == 123456789ULL, true) + TEST_EQUAL(d.getRunID(), 123456789ULL)🤖 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/OSWData_test.cpp` at line 225, Simplify the TEST_EQUAL assertion at the getRunID() test to improve readability. Replace the current assertion that compares a boolean expression (d.getRunID() == 123456789ULL) against true with a direct value comparison by removing the equality operator and true operand, allowing TEST_EQUAL to directly compare d.getRunID() with the expected value 123456789ULL.
26-26: 💤 Low valueConsider snake_case for helper function name.
The function
makeDatauses lowerCamelCase. While the coding guidelines specify lowerCamelCase for methods, OpenMS typically uses snake_case for free functions and variables to maintain consistency across the codebase.♻️ Proposed refactor
- OSWData makeData() + OSWData make_data()(and update all call sites: lines 143, 149, 157, 166, 183, 196, 239, 248, 257, 266)
🤖 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/OSWData_test.cpp` at line 26, Rename the free function `makeData` to `make_data` to follow OpenMS snake_case naming conventions for free functions. After renaming the function definition, update all call sites where `makeData()` is invoked to use the new `make_data()` name instead.Source: Coding guidelines
233-233: 💤 Low valueSimplify test assertion for readability.
Same pattern as line 225: prefer direct value comparison over boolean expression testing.
♻️ Proposed refactor
- TEST_EQUAL(d.getRunID() == 42, true) + TEST_EQUAL(d.getRunID(), 42)🤖 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/OSWData_test.cpp` at line 233, Simplify the TEST_EQUAL assertion in the OSWData_test.cpp file by removing the unnecessary boolean comparison. Instead of testing if d.getRunID() == 42 equals true, directly compare the return value to the expected value by changing TEST_EQUAL(d.getRunID() == 42, true) to TEST_EQUAL(d.getRunID(), 42). This makes the assertion more readable and follows the same pattern used elsewhere in the test file.
🤖 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/OSWData_test.cpp`:
- Around line 5-6: The file preamble contains empty maintainer and authors
markers that violate coding guidelines. Update the `$Maintainer: $` and
`$Authors: $` markers in the file header comments at the specified lines to
include the actual maintainer name and author names respectively, following the
project's conventions for populating these metadata fields in source files.
---
Nitpick comments:
In `@src/tests/class_tests/openms/source/OSWData_test.cpp`:
- Line 225: Simplify the TEST_EQUAL assertion at the getRunID() test to improve
readability. Replace the current assertion that compares a boolean expression
(d.getRunID() == 123456789ULL) against true with a direct value comparison by
removing the equality operator and true operand, allowing TEST_EQUAL to directly
compare d.getRunID() with the expected value 123456789ULL.
- Line 26: Rename the free function `makeData` to `make_data` to follow OpenMS
snake_case naming conventions for free functions. After renaming the function
definition, update all call sites where `makeData()` is invoked to use the new
`make_data()` name instead.
- Line 233: Simplify the TEST_EQUAL assertion in the OSWData_test.cpp file by
removing the unnecessary boolean comparison. Instead of testing if d.getRunID()
== 42 equals true, directly compare the return value to the expected value by
changing TEST_EQUAL(d.getRunID() == 42, true) to TEST_EQUAL(d.getRunID(), 42).
This makes the assertion more readable and follows the same pattern used
elsewhere in the test file.
🪄 Autofix (Beta)
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: 09b258f1-9e4d-468b-9ea7-bfcbb015ad97
📒 Files selected for processing (2)
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/OSWData_test.cpp
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-16 01:35:52.550286423 +0000
+++ AUTHORS.new 2026-06-16 01:35:57.851460195 +0000
@@ -23,8 +23,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
Adversarial review result: I did not find a blocking issue in this pass. This is a test-only addition for |
Context
Part of the OpenMS 3.6.0 pre-release testing plan (#9460), §4 (OpenSwathWorkflow).
DATASTRUCTURES/OSWData— the in-memory OpenSWATH results structure (protein → peptide precursor → peak group → transition hierarchy) used by the OSW reader/UI — had no test file.Change
Adds a class test covering:
OSWTransition/OSWPeakGroup(incl. theQVALUE_MISSINGdefault) /OSWPeptidePrecursor/OSWProteinand their accessors;OSWHierarchy::LevelNameandOSWIndexTrace::isSet();OSWDatacontainer:addTransition(both overloads),transitionCount,getTransition/getTransitions,addProtein(incl. the referential-integrity check that rejects a protein referencing an unknown transition ID withException::Precondition),getProteins(full hierarchy reachable),setProtein,setSqlSourceFile/setRunID,clearvsclearProteins(the latter keeps the transitions),buildNativeIDResolver(run-id mismatch →Precondition) andfromNativeID(no resolver built →InvalidValue).Notes
executables.cmake(datastructures_executables_list).OSWDatamethod has a section (no untested-method warnings); all assertions execute against real values (verbose-confirmed).🤖 Generated with Claude Code
Summary by CodeRabbit