3 ms·
For C code you can use link-time substitution and a mock generator like CMock (http://www.throwtheswitch.org/cmock http://www.throwtheswitch.org/cmock). Link-t
by okl 3y ago
For C code you can use link-time substitution and a mock generator like CMock (http://www.throwtheswitch.org/cmock http://www.throwtheswitch.org/cmock).
Link-time substitution means that you swap out certain objects with others when you build your test binaries.
For example, let's say your production software binary consists of a main function and objects A, B and C. For a unit test you could use a different main (the test), object B and a mock for object C - leaving out A.