Repository navigation
Fix CI tests and extract math utilities for testability - #21
Merged
Merged
Conversation
- Enable BUILD_TESTING=ON and ENABLE_COVERAGE=ON in main.yml CI build job - Extract pure functions (BlackmanWindow, LinearToDecibels, SmoothingOverTime) to new src/math_utils.h header - Update main.cpp and main.h to use math_utils.h instead of inline definitions - Update test file to use math_utils.h instead of copied function code - Add math_utils.h to CMakeLists.txt MATRIX_HEADERS This makes the test suite actually run in CI and tests the real implementation rather than copied code. Co-authored-by: MarcelRaschke <MarcelRaschke@users.noreply.github.com>
The extracted math_utils.h declares SmoothingOverTime taking std::vector<float>& references (matching main.cpp usage), but the tests still called it with float* pointers via .data(), which does not compile. Pass the vectors directly instead. Co-authored-by: MarcelRaschke <MarcelRaschke@users.noreply.github.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BUILD_TESTING=ONandENABLE_COVERAGE=ONin themain.ymlCI build job's CMake configure step, soctestactually discovers and runs the tests (previously it always reported "No tests found").BlackmanWindow,LinearToDecibels,SmoothingOverTime) pluskiss_fft_cpx,AUDIO_BUFFER, andNUM_BANDSinto a new standalonesrc/math_utils.hso they are independently testable without pulling in OpenGL/Kodi.src/main.cppandsrc/main.hto includemath_utils.hand drop the now-duplicated inline definitions/declarations.tests/test_visualization_matrix.cppto include the real implementation from../src/math_utils.hinstead of re-declaring copied stubs, so the suite exercises the actual code.SmoothingOverTimecall sites in the tests to passstd::vector<float>&references (matching the extracted header andmain.cppusage) instead offloat*pointers via.data(), which previously caused the test TU to fail to compile.Verification
out.data(), last.data(), ...) fails to compile againstmath_utils.hwithinvalid initialization of non-const reference of type 'std::vector<float>&' from an rvalue of type 'float*'.out, last, ...) compiles cleanly withg++ -std=c++17.