Testing stub order with a huge number of stub calls

When a huge number of stubs are called, the standard solution described in Testing stub order may not be possible due to its high memory usage. In such cases, an alternative solution involves defining the function StubCallOrderFunc as a stub, and testing the values passed to this function, in the following:

DEFINE STUB CALLORDER

#void StubCallOrderFunc(unsigned int stubID);

END DEFINE

##define STUB_CALL_ORDER(stubID)if (_os_1_CALLORDER_StubCallOrderFunc[0].min>=0) StubCallOrderFunc(stubID);

Note: macro STUB_CALL_ORDER must be defined after the stub of StubCallOrderFunc in order to avoid a reclusive call of it.

The advantage of this method is that there are no arrays or index variables to manage the stub call and no need to define a MAX call value. The solution is preferable only when the function under test makes a big number of repetitive calls to the same stub. For example, 100 call of stub1 followed by 900 calls of stub2 takes only 2x12 bytes in RAM instead of an array of 1000 call ID.

Following is the way the verification can be done:
STUB StubCallOrderFunc 1..4=>(addition_add), 
& 5..9 =>(addition_sub), 
& 10..15 =>(multiplication_multiplication),
& 16..22 =>(addition_add)

There is no recording of the successive stub call, however the verification is done during the test run by using the predefined range of calls.