Mocks and coverage with gtk/glib test frameworks?



Forgive me if I'm on the wrong list with these questions, but gtk-devel seems to be the place where most gtk/glib test discussion has occurred. If there's a more appropriate place to bring this up, please let me know.

I am using the gtk/glib test frameworks to do test driven development in C.

Two things that I'm wondering:

1. Is there a way to build mocks to use with the gtk or glib test frameworks?

I can code a mock_whatever.c file that implements the "interface" defined by whatever.h and link the resulting whatever.o in my test fixture... and maybe that's the easiest/best way? But I am curious if there is already a way to do mocking that I should be aware of.

2. Is there any way to measure code coverage?

I'm sure the debugger must instrument the code somehow. And I'm sure I could measure coverage with macros or a preprocessor that finds all the checkpoints to measure and puts calls to a few functions that record coverage data. But I wonder if there is already a way to do this with existing tools or methods?

Thanks!

--
Michael C. Libby
www.mikelibby.com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]