I’m trying out unit test with the CppUTest framework. I’m using it on an existing code module and need to make doubles for many of the functions included by the module. Making doubles for functions works well, but I’m having problems with structs included into the module alongside the functions. How do I include test doubles for structs?
Share
Generally you should use the real struct, unless you are faking a module that is built around an abstract data type. Then you define the ADT struct in the double.
If you are really asking how do you test with global structures, you can create a defining instance of the struct in the test case or a test helper file.
If neither of these ideas fit your situation, please give some more details or an example.
James