Writing cmocka Tests
Samba started to also implement unit tests. This gives an overview about cmocka the unit testing framework we use. As a start we suggest to read the following LWN article:
cmocka its API is very well documented, you can find it here.
Normally you can take it as a rule of thumb to write one text executable for one .c file! In the test you do #include "foo.c". This way you can also write tests for functions which are declared static.
If you have a huge file or complex functions, create one test binary for a bunch of similar functions or just one.
Writing a cmocka test for Samba
What a wurst!