Skip to content

Test/coverage modulation effects 187#204

Closed
raajpatre wants to merge 20 commits into
sudip-mondal-2002:mainfrom
raajpatre:test/coverage-modulation-effects-187
Closed

Test/coverage modulation effects 187#204
raajpatre wants to merge 20 commits into
sudip-mondal-2002:mainfrom
raajpatre:test/coverage-modulation-effects-187

Conversation

@raajpatre

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds 20 unit tests across the three LFO-modulated effects — Chorus,
Flanger, and Phaser — pushing line coverage from ~50–59% to 100% on
all three files.

The largest single gap was process_stereo(), which was completely
untested in all three effects. Six of the 20 tests target that path
directly. Beyond stereo, the new tests cover parameter edge cases
(Level/Mix = 0 and 1, negative feedback, Depth = 0), reset()
correctness for delay buffers and APF state, and behavioral
verification (e.g. 4 stages vs 12 stages produce different output,
not just finite output).

Chorus (6 tests)

  • chorus_process_stereo_produces_finite_output — exercises the entire process_stereo() path (was completely untested)
  • chorus_process_stereo_disabled_early_return — covers the if (!enabled_) guard in process_stereo
  • chorus_level_zero_passes_input_unchanged — verifies dry passthrough when Level = 0.0
  • chorus_level_one_fully_wet — verifies wet blend when Level = 1.0
  • chorus_reset_clears_delay_and_lfo_phase — confirms delay_buffer_ and lfo_phase_ are both zeroed by reset()
  • chorus_parameters_have_valid_ranges — verifies all 3 params have correct defaults and ranges

Flanger (6 tests)

  • flanger_process_stereo_produces_finite_output — exercises process_stereo() including delay_buffer_r_ and 180° LFO offset
  • flanger_process_stereo_disabled_early_return — covers the if (!enabled_) guard in process_stereo
  • flanger_negative_feedback_stays_finite — covers the negative feedback range [-0.95, 0.0) which was untested
  • flanger_negative_feedback_differs_from_positive — confirms negative feedback takes a genuinely different code path
  • flanger_mix_zero_passes_dry_signal — verifies dry passthrough when Mix = 0.0
  • flanger_reset_clears_both_buffers — confirms both delay_buffer_ and delay_buffer_r_ are zeroed by reset()

Phaser (8 tests)

  • phaser_process_stereo_produces_finite_output — exercises the right-channel APF cascade (apf_xprev_r_, apf_yprev_r_, feedback_state_r_) which was completely untested
  • phaser_process_stereo_disabled_early_return — covers the if (!enabled_) guard in process_stereo
  • phaser_depth_zero_freezes_sweep — verifies Depth=0 freezes fc at 200 Hz regardless of LFO position
  • phaser_feedback_zero_stays_finite — covers the zero-feedback path (x = dry + 0 * feedback_state_)
  • phaser_feedback_max_stays_finite — verifies 0.95 maximum resonance stays finite under heavy feedback
  • phaser_mix_zero_passes_dry_signal — verifies dry passthrough when Mix = 0.0
  • phaser_stage_count_affects_output — confirms 4 stages and 12 stages produce meaningfully different output (stronger than the existing finite-only check)
  • phaser_reset_clears_apf_state — confirms all 4 APF arrays and both feedback_state vars are zeroed by reset(), verified by comparing output against a fresh instance

Related Issue

Fixes #187

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor / code cleanup
  • 📝 Documentation
  • ✅ Tests
  • 🔧 Build / CI / Configuration

How Was This Tested?

  • Platform(s) tested on: macOS (Apple Silicon)
  • Test command run: ./amplitron-tests
  • All 195 tests pass, 0 failures
  • Coverage measured with lcov — all three target files hit 100%:
File Before After
chorus.cpp 59.5% 100%
flanger.cpp 52.9% 100%
phaser.cpp 51.8% 100%

Checklist

  • Code compiles and builds successfully on my platform
  • All existing tests pass (./amplitron-tests)
  • New tests added for new functionality (if applicable)
  • Documentation updated (README, code comments) if applicable
  • No blocking calls on the audio thread (no std::mutex::lock() on the hot path)
  • Tested on: macOS Sequoia, Apple Silicon

Screenshots / Demo

N/A — test-only change, no UI modifications.

raajpatre and others added 20 commits May 23, 2026 10:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a86f3489-5dcb-4f30-ba54-97e52064a03c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@raajpatre

Copy link
Copy Markdown
Contributor Author

@sudip-mondal-2002
Submitted PR #187 to address this issue.
Adds 20 tests across Chorus, Flanger, and Phaser —
all three files now at 100% line coverage.

@raajpatre

Copy link
Copy Markdown
Contributor Author

@sudip-mondal-2002 could you please add the appropriate
GSSoC label (level:intermediate) to this PR? Thanks!

@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

PR Preview Removed

The GitHub Pages preview for this PR has been removed because the PR was closed.

@sudip-mondal-2002 sudip-mondal-2002 changed the base branch from develop to main May 24, 2026 11:24
@sudip-mondal-2002

Copy link
Copy Markdown
Owner

@raajpatre Please check the conflicts

@sudip-mondal-2002 sudip-mondal-2002 added Audio Processing Related to DSP, effects, or signal processing level:intermediate Intermediate task · 25 GSSoC points type:testing Unit tests, integration tests, or test coverage labels May 24, 2026
@sudip-mondal-2002

Copy link
Copy Markdown
Owner

Closing as AI slop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audio Processing Related to DSP, effects, or signal processing gssoc:ai-slop level:intermediate Intermediate task · 25 GSSoC points type:testing Unit tests, integration tests, or test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Cover time-based modulation effects — chorus.cpp (59%), flanger.cpp (52%), phaser.cpp (51%)

2 participants