-
Notifications
You must be signed in to change notification settings - Fork 253
Description
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.