Repository navigation
Test that chunking the input does not change the output - #164
Conversation
Consume() now accepts a partial frame at the end of a call and carries it over to the next one, but nothing checked that the result is the same however the caller splits its input. Feed the same stereo file in sizes that are not multiples of the channel count and compare each result against a single Consume() of the whole buffer. Nothing is stored as expected output, so the test keeps working if the resampler or the test audio changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughChangesAudioProcessor validation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 `@tests/test_audio_processor.cpp`:
- Around line 125-128: Correct the comment above chunk_sizes to accurately
describe the test inputs: do not claim every call leaves a partial frame, and
acknowledge that 2 and 4096 are aligned with the stereo channel count, or remove
those aligned sizes if the test requires only non-multiples.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 044a46b6-1c37-4fe7-8a86-40be75181ec8
📒 Files selected for processing (1)
tests/test_audio_processor.cpp
|
Both points are correct, fixed in c3ecc5f.
I kept the aligned sizes rather than dropping them: they are worth having as a control, since the point of the test is that the result does not depend on the split either way. The comment now says which are which and why both are there. Tests still pass (99 total, 7 in |
Consume()now accepts a partial frame at the end of a call and carries it over to the next one (fb9460b). Nothing checked that the result is actually the same however the caller splits its input, and before that changeConsume()assertedlength % m_num_channels == 0, so this call pattern had no coverage at all.Feeds the same stereo file in sizes that are deliberately not multiples of the channel count —
1, 2, 3, 5, 7, 17, 511, 997, 4096— so every call but the last leaves a partial frame behind, and compares each result against a singleConsume()of the whole buffer.The test stores no expected output. It compares against whatever the single-call path produces, so it keeps working if the resampler, the target sample rate or the test audio ever change, and there is nothing to regenerate. It reuses
LoadAudioFile,AudioBufferandAudioProcessoras the surrounding tests do, and adds no fixtures or data files.SCOPED_TRACEnames the chunk size on failure so the loop needs no per-case assertions.Checked in both directions: it passes on master (~170 ms), and against the
audio_processor.cppfrom before fb9460b it trips that commit'slength % m_num_channels == 0assertion — so it exercises the behaviour rather than passing vacuously.Mono is not covered because with one channel there is never a partial frame, so the loop would only be re-testing the aligned path.