diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-05 19:49:27 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-05 19:49:27 +0100 |
| commit | 64c19b368db4aea748467b5f763add99c7deb701 (patch) | |
| tree | 5c159b9a1ff19fb6078e7e08a9b9e9747c4cb3d7 /src/audio/wav_dump_backend.h | |
| parent | 4fd55777eb8b678297fb2efd207dc8cd509a6919 (diff) | |
perf: Reduce audio test durations for faster test suite
Optimized long-running audio tests to significantly improve test suite
performance while maintaining test coverage.
Changes:
- WavDumpBackend: Added set_duration() method with configurable duration
- Default remains 60s for debugging/production use
- Test now uses 2s instead of 60s (140x faster: 60s → 0.43s)
- JitteredAudioBackendTest: Reduced simulation durations
- Test 1: 2.0s → 0.5s (4x faster)
- Test 2: 10.0s → 3.0s (3.3x faster)
- Overall: 14.49s → 4.48s (3.2x faster)
- Updated assertions for shorter durations
- Progress indicators adjusted for shorter tests
Results:
- Total test suite time: 18.31s → 8.29s (55% faster)
- All 20 tests still pass
- Tests still properly validate intended behavior
handoff(Claude): Optimized audio test performance to speed up development
iteration without sacrificing test coverage. WavDumpBackend now has
configurable duration via set_duration() method.
Diffstat (limited to 'src/audio/wav_dump_backend.h')
| -rw-r--r-- | src/audio/wav_dump_backend.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/audio/wav_dump_backend.h b/src/audio/wav_dump_backend.h index b037fd1..eb6e011 100644 --- a/src/audio/wav_dump_backend.h +++ b/src/audio/wav_dump_backend.h @@ -26,8 +26,13 @@ class WavDumpBackend : public AudioBackend { // Set output filename (call before init()) void set_output_file(const char* filename); + // Set duration in seconds (default: 60s, call before start()) + void set_duration(float seconds); + // Get total samples written - size_t get_samples_written() const { return samples_written_; } + size_t get_samples_written() const { + return samples_written_; + } private: // Write WAV header with known sample count @@ -41,6 +46,7 @@ class WavDumpBackend : public AudioBackend { size_t samples_written_; const char* output_filename_; bool is_active_; + float duration_sec_; static const int kSampleRate = 32000; static const int kBufferSize = 1024; |
