Skip to content

Add unit tests for ShortenWaveForFFTIfRequired#2608

Merged
t-b merged 2 commits intomainfrom
copilot/sub-pr-2362
Feb 2, 2026
Merged

Add unit tests for ShortenWaveForFFTIfRequired#2608
t-b merged 2 commits intomainfrom
copilot/sub-pr-2362

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Thanks for opening a PR in MIES ✨!

  • Code can only be merged if the continous integration tests pass
  • Please ensure that the branch is named correctly. See
    here for the detailed explanation.

Description

The ShortenWaveForFFTIfRequired function lacked direct unit tests despite implementing non-trivial logic: prime-factor analysis, cached GetGoodFFTSizes lookup, and wave truncation when max prime factor exceeds 1000.

Added four test functions to UTF_Utils_Algorithm.ipf:

  • Pass-through behavior: Waves with good FFT sizes (only 2 and 3 as prime factors) return unchanged

    • Tests power of 2, power of 3, and mixed factor cases (1024, 729, 72, 3072)
  • Truncation logic: Waves with prime factors >1000 are truncated to nearest good FFT size

    • Verifies size reduction, content preservation, and wave property maintenance
    • Tests with primes 1009, 2017, and 5003
  • Cache mechanism: Validates GetGoodFFTSizes caching

    • First call populates cache, subsequent calls reuse cached data
    • Verifies consistent truncation results across calls
  • Result validation: Truncated waves have max prime factor ≤1000

    • Tests with multiple sizes (1009, 3001, 10007) to ensure good FFT properties

All tests follow existing patterns in the test suite using standard CHECK macros.

Merge Conflict Resolution

Resolved merge conflicts with the base branch bugfix/2362-psx-support-multiple-selections:

  • UTF_Utils_Algorithm.ipf: Preserved test additions (no actual conflict, base branch simply didn't have the tests yet)
  • MIES_WaveDataFolderGetters.ipf: Fixed documentation comment order for fastTau/slowTau to match the actual implementation (columns 10 and 11)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI assigned Copilot and t-b Jan 27, 2026
Copilot AI mentioned this pull request Jan 27, 2026
40 tasks
@t-b t-b force-pushed the bugfix/2362-psx-support-multiple-selections branch from 5cc8636 to 8d71c75 Compare January 27, 2026 16:52
Copilot AI changed the title [WIP] Fix various PSX issues based on review comments Add unit tests for ShortenWaveForFFTIfRequired Jan 27, 2026
Copilot AI requested a review from t-b January 27, 2026 17:00
@t-b
Copy link
Collaborator

t-b commented Jan 28, 2026

@copilot Please resolve conflicts.

Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot Please resolve conflicts.

Resolved merge conflicts in commit a6c47d4. The conflicts were:

  • UTF_Utils_Algorithm.ipf: Kept test additions (simple addition, no actual conflict)
  • MIES_WaveDataFolderGetters.ipf: Kept correct comment order for fastTau/slowTau columns matching the implementation

Base automatically changed from bugfix/2362-psx-support-multiple-selections to main February 2, 2026 17:57
Copilot AI and others added 2 commits February 2, 2026 19:00
@t-b t-b force-pushed the copilot/sub-pr-2362 branch from a6c47d4 to 83dc390 Compare February 2, 2026 18:08
@t-b t-b marked this pull request as ready for review February 2, 2026 18:12
Copilot AI review requested due to automatic review settings February 2, 2026 18:12
@t-b t-b unassigned Copilot Feb 2, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds direct unit tests for ShortenWaveForFFTIfRequired, covering pass-through vs truncation behavior and related FFT-size expectations.

Changes:

  • Adds pass-through tests for “already acceptable” sizes.
  • Adds truncation tests for sizes with max prime factor > 1000, including content preservation checks.
  • Adds tests intended to cover cache behavior and “good FFT size” results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@t-b t-b merged commit ced0fd4 into main Feb 2, 2026
24 checks passed
@t-b t-b deleted the copilot/sub-pr-2362 branch February 2, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments