Currently, covering SDK is by hand. There are several disadvantages:
Adding new API support needs a new member function prototype and body.
For each new API, needs to provide the method for mock.
The Google Test and the fff need to test each new API.
To overcome this, it is better to generate the API by script. Such the script will traverse the source tree of the RasPi Pico SDK, and search for the prototype. For each prototype, the script needs to generate :
Prototype of the virtual function for the ::rpp_driver::SdkWrapper.
function body.
Mock virtual function.
Stub week function for the RasPi Pico SDK.
The last one is tricky. This stub function will be overwritten when the appropriate SDK library is linked. If the appropriate SDK library is not connected, the stub will print out the error message and trigger an assertion.
The v1.0.0 ::rpp_driver::SdkWrapper covers only a few APIs from RasPi Pico SDK. It is nice to expand to cover all.
Currently, covering SDK is by hand. There are several disadvantages:
To overcome this, it is better to generate the API by script. Such the script will traverse the source tree of the RasPi Pico SDK, and search for the prototype. For each prototype, the script needs to generate :
The last one is tricky. This stub function will be overwritten when the appropriate SDK library is linked. If the appropriate SDK library is not connected, the stub will print out the error message and trigger an assertion.