@@ -196,7 +196,39 @@ void UT_ResetState(UT_EntryKey_t FuncKey);
196196void UT_SetDeferredRetcode (UT_EntryKey_t FuncKey , int32 Count , UT_IntReturn_t Retcode );
197197
198198/**
199- * \param FuncKey The stub function to add the return code to.
199+ * Add a type-agnostic return code entry for the given stub function
200+ *
201+ * This allocates a return value entry in the UT Assert state table and associates it with the
202+ * specified stub function. The DeferCount parameter determines how many times the stub must
203+ * be invoked before the return value is used. If this is passed in as 0, the value will be used
204+ * for all stub invocations, and will be retained until the state is reset. For nonzero defer counts,
205+ * the value acts as a decrement counter, and will be used once the counter reaches 0. In these cases,
206+ * the value will be discarded/forgotten once it has been used by the stub.
207+ *
208+ * The handling of the value depends on the ValueGenre:
209+ *
210+ * #UT_ValueGenre_OPAQUE - The object will be used directly as the return value from the stub, and no
211+ * conversion of any type will be attempted.
212+ * #UT_ValueGenre_INTEGER - The object is an integer, and thus may be converted to numbers of other sizes/types
213+ * using integer value semantics.
214+ * #UT_ValueGenre_FLOAT - The object is a floating point, and thus may be converted to numbers of other
215+ * sizes/types using floating point value semantics.
216+ * #UT_ValueGenre_POINTER - The object is a pointer, no conversions will be attempted, and the size must be
217+ * equal to sizeof(void*)
218+ *
219+ * \note for OPAQUE values, the passed-in pointer value is held directly, and will be dereferenced at the
220+ * time when the called stub returns the value. Notably, the content is NOT cached in the UtAssert internal
221+ * storage structures, so the caller must ensure that the pointed-to object remains valid and does not go
222+ * out of scope for the remainder of the test case, or until UT_ResetState is called. Conversely, for INTEGER,
223+ * FLOAT, or POINTER value genres, the content will be copied into the internal storage structures, so in
224+ * these cases, the pointed-to value may be immediately reused or freed by the caller.
225+ *
226+ * \param FuncKey The stub function to add the return code to.
227+ * \param ValuePtr Pointer to the value to return
228+ * \param ValueSize Size of the object referred to by ValuePtr
229+ * \param ValueGenre Genre of the object referred to by ValuePtr
230+ * \param DeferCount Number of times the stub needs to be called until this value is used
231+ * \param TypeName Data type as an ASCII string, for possible type matching (may be set from a preprocessor macro)
200232 */
201233void UT_ConfigureGenericStubReturnValue (UT_EntryKey_t FuncKey , const void * ValuePtr , size_t ValueSize ,
202234 UT_ValueGenre_t ValueGenre , int32 DeferCount , const char * TypeName );
0 commit comments