You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
UT assert passes "static" function arguments to hook functions as an array of opaque pointers, based on the order of calls to the UT_Stub_RegisterContext() API inside the stub. This is basically equivalent to argc/argv on a command line.
This requires test cases to "know" which position the argument they need to access is in, and basically hard-code that number. This could become more problematic if hook functions are used more frequently.
Describe the solution you'd like
Offer a variant of UT_Stub_RegisterContext() that also stores the argument name, and offer a "getter" that a hook function can use in order to get by that name.
Registering and retrieving values by name will provide greater stability as the APIs and test cases evolve over time.
The downside is that its slower and uses more memory to look up based on name, but that doesn't matter much for UT.
Describe alternatives you've considered
Leave as is using number/sequence based args. It works but concerned it's too easy to get out of sync.
Additional context
Could also use some macros to make both the register (stub-side) and get (hook-side) operations a little more user-friendly.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Add the capability to store parameter names in addtion
to pointers as part of the stub argument context data.
Macroize the UT_Stub_RegisterContext function utstubs.h to
also pass the parameter name in addition to the pointer.
Also add hook-side accessor functions/macros to make it
easier and more reliable to get this information from
the context data.
Is your feature request related to a problem? Please describe.
UT assert passes "static" function arguments to hook functions as an array of opaque pointers, based on the order of calls to the
UT_Stub_RegisterContext()
API inside the stub. This is basically equivalent to argc/argv on a command line.This requires test cases to "know" which position the argument they need to access is in, and basically hard-code that number. This could become more problematic if hook functions are used more frequently.
Describe the solution you'd like
Offer a variant of
UT_Stub_RegisterContext()
that also stores the argument name, and offer a "getter" that a hook function can use in order to get by that name.Registering and retrieving values by name will provide greater stability as the APIs and test cases evolve over time.
The downside is that its slower and uses more memory to look up based on name, but that doesn't matter much for UT.
Describe alternatives you've considered
Leave as is using number/sequence based args. It works but concerned it's too easy to get out of sync.
Additional context
Could also use some macros to make both the register (stub-side) and get (hook-side) operations a little more user-friendly.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: