🧪 [testing improvement] Add tests for FFT mode setting and getters#269
🧪 [testing improvement] Add tests for FFT mode setting and getters#269
Conversation
Added test_fft_mode.cpp to test FFT::setFFTMode, FFT::getFFTMode, and FFT::getFFTModeName. Registered the test in tests/Makefile.am and added missing <complex> header to include/core/fft.h. Co-authored-by: segin <480709+segin@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds unit coverage for FFT mode selection/state getters, and makes the FFT public header self-contained for isolated inclusion.
Changes:
- Introduces a new unit test covering
setFFTMode,getFFTMode, andgetFFTModeNameacross all enum values. - Integrates the new test binary into
make check. - Fixes missing standard library includes in
include/core/fft.h(notably for<complex>).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_fft_mode.cpp | New unit test verifying FFT mode setter + getters end-to-end |
| tests/Makefile.am | Adds test_fft_mode to check_PROGRAMS so it runs in make check |
| include/core/fft.h | Adds standard library headers to make the public header self-contained |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * PsyMP3 is free software. You may redistribute and/or modify it under | ||
| * the terms of the ISC License <https://opensource.org/licenses/ISC> | ||
| */ | ||
|
|
There was a problem hiding this comment.
This test uses std::cout/std::cerr later but doesn’t directly include <iostream>. Relying on transitive includes (e.g., via test_framework.h) can make the test brittle if headers change. Add an explicit #include <iostream> in this file to ensure it compiles standalone.
| #include <iostream> |
| // Test Original mode | ||
| fft.setFFTMode(FFTMode::Original); | ||
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::Original, "getFFTMode should return Original"); | ||
| ASSERT_TRUE(fft.getFFTModeName() == "mat-og", "getFFTModeName should return mat-og"); | ||
|
|
||
| // Test Optimized mode | ||
| fft.setFFTMode(FFTMode::Optimized); | ||
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::Optimized, "getFFTMode should return Optimized"); | ||
| ASSERT_TRUE(fft.getFFTModeName() == "vibe-1", "getFFTModeName should return vibe-1"); | ||
|
|
||
| // Test NeomatIn mode | ||
| fft.setFFTMode(FFTMode::NeomatIn); | ||
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::NeomatIn, "getFFTMode should return NeomatIn"); | ||
| ASSERT_TRUE(fft.getFFTModeName() == "neomat-in", "getFFTModeName should return neomat-in"); | ||
|
|
||
| // Test NeomatOut mode | ||
| fft.setFFTMode(FFTMode::NeomatOut); | ||
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::NeomatOut, "getFFTMode should return NeomatOut"); | ||
| ASSERT_TRUE(fft.getFFTModeName() == "neomat-out", "getFFTModeName should return neomat-out"); |
There was a problem hiding this comment.
The test repeats the same pattern four times (set mode → assert enum → assert name). Consider table-driving this with a small array of {mode, expectedName, expectedModeLabel} and looping, so adding/removing modes becomes a one-line change and reduces the chance of copy/paste mistakes.
| // Test Original mode | |
| fft.setFFTMode(FFTMode::Original); | |
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::Original, "getFFTMode should return Original"); | |
| ASSERT_TRUE(fft.getFFTModeName() == "mat-og", "getFFTModeName should return mat-og"); | |
| // Test Optimized mode | |
| fft.setFFTMode(FFTMode::Optimized); | |
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::Optimized, "getFFTMode should return Optimized"); | |
| ASSERT_TRUE(fft.getFFTModeName() == "vibe-1", "getFFTModeName should return vibe-1"); | |
| // Test NeomatIn mode | |
| fft.setFFTMode(FFTMode::NeomatIn); | |
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::NeomatIn, "getFFTMode should return NeomatIn"); | |
| ASSERT_TRUE(fft.getFFTModeName() == "neomat-in", "getFFTModeName should return neomat-in"); | |
| // Test NeomatOut mode | |
| fft.setFFTMode(FFTMode::NeomatOut); | |
| ASSERT_TRUE(fft.getFFTMode() == FFTMode::NeomatOut, "getFFTMode should return NeomatOut"); | |
| ASSERT_TRUE(fft.getFFTModeName() == "neomat-out", "getFFTModeName should return neomat-out"); | |
| struct FFTModeCase { | |
| FFTMode mode; | |
| const char* expectedName; | |
| }; | |
| const FFTModeCase cases[] = { | |
| {FFTMode::Original, "mat-og"}, | |
| {FFTMode::Optimized, "vibe-1"}, | |
| {FFTMode::NeomatIn, "neomat-in"}, | |
| {FFTMode::NeomatOut, "neomat-out"}, | |
| }; | |
| for (const auto& testCase : cases) { | |
| fft.setFFTMode(testCase.mode); | |
| ASSERT_TRUE(fft.getFFTMode() == testCase.mode, "getFFTMode should return the mode that was set"); | |
| ASSERT_TRUE(fft.getFFTModeName() == testCase.expectedName, "getFFTModeName should return the expected mode name"); | |
| } |
| test_fft_mode_SOURCES = test_fft_mode.cpp | ||
| test_fft_mode_LDADD = \ | ||
| libtest_utilities.a \ | ||
| ../src/core/libpsymp3-core.a |
There was a problem hiding this comment.
In this Makefile, other test targets appear to append $(AM_LDFLAGS) in their *_LDADD blocks (even though it’s an unusual pattern). This new target doesn’t, which can lead to inconsistent link behavior (e.g., missing rpath, sanitizer/runtime flags, or platform-specific link options expected via that variable). Update test_fft_mode_LDADD to follow the same convention used by adjacent tests in this file.
| ../src/core/libpsymp3-core.a | |
| ../src/core/libpsymp3-core.a \ | |
| $(AM_LDFLAGS) |
🎯 What: The task required adding tests for the
setFFTModelogic insrc/core/fft.cpp, specifically targetingsetFFTMode,getFFTMode, andgetFFTModeName.📊 Coverage: A new test case
tests/test_fft_mode.cppwas written covering all valid enum cases (FFTMode::Original,FFTMode::Optimized,FFTMode::NeomatIn,FFTMode::NeomatOut). The test ensures these getters properly reflect state modifications. I also caught and resolved a missing<complex>header that caused build issues when includingfft.hin isolation.✨ Result: Enhanced unit test coverage and confidence in the FFT codebase's state control logic. Tests were integrated into
make check.PR created automatically by Jules for task 2899678280063234222 started by @segin