Skip to content

Add unit tests for buffer processor (pa_process) code #779

@dechamps

Description

@dechamps

In #772 it was pointed out that the buffer processor code (i.e. PaUtil_InitializeBufferProcessor() and friends in pa_process.h) could benefit from a test suite. Currently this code is not directly tested anywhere, although it is indirectly covered through any tests exercising host API streaming code (in particular paloopback).

The API inpa_process.h would lend itself very well to unit tests, because it's a self-contained module with well-defined boundaries and behaviour, and no dependencies (so nothing to fake/mock). Also this module is extremely critical as it sits at the core of all host API streaming code, and its operation is quite non-trivial, so it seems like it would benefit a lot from the test coverage.

In particular, tests could ensure that the stream callback is called appropriately and with the correct parameters, that the correct amount of data is read and written from/to host API buffers at the proper offsets (this would have caught #770) including wraparound, that sample format conversions are done appropriately, that interleaved/non-interleaved conversions are done appropriately, that the latency/timing reporting is correct, etc. for a variety of modes (input only, output only, full duplex) and buffer size combinations.

Best practice dictates this should be done through lots of small, focused tests. We might want to use some kind of unit testing framework for this.

Metadata

Metadata

Assignees

Labels

P2Priority: HightestTest code in /test

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions