+69
−13
Loading
This macro allows users to specify multiple values to be returned by consecutive calls to a mocked function. This can be especially useful while testing a function that calls the same mocked function multiple times, because it makes it possible to check how it behaves when each of those calls return a different value. The usage is very similar to MOCK_SET() - each call to MOCK_ENQUEUE() specifies a value that will be returned by a consecutive call to the mocked function (in a FIFO fashion). Once all such values are exhausted (or none have been specified), the mocked function will return the value assigned by MOCK_SET(). For instance, the following code: int foo(void); MOCK_SET(foo, 1); MOCK_ENQUEUE(foo, 2); MOCK_ENQUEUE(foo, 3); would cause foo() to return 2, 3, 1, 1, ... Signed-off-by:Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I67c4ccde17948a65ba48aa7dc988de680c881cb7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22811 Reviewed-by:
Jim Harris <jim.harris@samsung.com> Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by:
Ben Walker <ben@nvidia.com> Community-CI: Mellanox Build Bot