Skip to content

Fix CI tests and extract math utilities for testability - #21

Merged
MarcelRaschke merged 2 commits into
masterfrom
vibe/fix-tests-extract-math-93bd4a
Sep 18, 2026
Merged

MarcelRaschke merged 2 commits into
masterfrom
vibe/fix-tests-extract-math-93bd4a

Conversation

@MarcelRaschke

Copy link
Copy Markdown
Owner

Summary

  • Enable BUILD_TESTING=ON and ENABLE_COVERAGE=ON in the main.yml CI build job's CMake configure step, so ctest actually discovers and runs the tests (previously it always reported "No tests found").
  • Extract the pure math helpers (BlackmanWindow, LinearToDecibels, SmoothingOverTime) plus kiss_fft_cpx, AUDIO_BUFFER, and NUM_BANDS into a new standalone src/math_utils.h so they are independently testable without pulling in OpenGL/Kodi.
  • Update src/main.cpp and src/main.h to include math_utils.h and drop the now-duplicated inline definitions/declarations.
  • Update tests/test_visualization_matrix.cpp to include the real implementation from ../src/math_utils.h instead of re-declaring copied stubs, so the suite exercises the actual code.
  • Fix the SmoothingOverTime call sites in the tests to pass std::vector<float>& references (matching the extracted header and main.cpp usage) instead of float* pointers via .data(), which previously caused the test TU to fail to compile.

Verification

  • Confirmed the pre-fix test signature (out.data(), last.data(), ...) fails to compile against math_utils.h with invalid initialization of non-const reference of type 'std::vector<float>&' from an rvalue of type 'float*'.
  • Confirmed the corrected signature (out, last, ...) compiles cleanly with g++ -std=c++17.
  • Full local project configure requires Kodi (not available in this sandbox), so CI is the authoritative build/run check.

mistral-vibe and others added 2 commits September 4, 2026 18:44
- 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>
@MarcelRaschke MarcelRaschke self-assigned this Sep 18, 2026
@MarcelRaschke MarcelRaschke added the bug Something isn't working label Sep 18, 2026
@MarcelRaschke
MarcelRaschke marked this pull request as ready for review September 18, 2026 17:44

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@MarcelRaschke
MarcelRaschke merged commit fb85839 into master Sep 18, 2026
4 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants