Model Based (MBSD) vs. C Software Development

Model Based Software Design can speed complex system development

Recently my team was given the opportunity to completely redo a particularly messy and troublesome piece of legacy C code, and as a team we decided to give MBSD a try. We had tried a few simple models before, all of which turned out to be more complicated than had we written the C code ourselves. But this time we were determined to do it right: we allocated plenty of time, received one-on-one training from the local MBSD guru, and reviewed the original requirements to ensure they met the needs of the system. Finally after exhausting all of the time, continually pestering the guru with questions and modifying the requirements several times, we succeeded in having a model based software design that actually worked the first time we tested it on the vehicle. It was a valuable experience overall and helped illustrate the drawbacks and benefits of MBSD over the typical C development.

Using Google Test to Unit Test C Code

While the Google Test framework is designed for C++ it can be used to create a framework for C unit testing. Reference the Google Test documentation for more details on the capabilities of Google Test.

The Framework

These framework files are included in any C unit test project.
•A header file to define macros to interface from C++ to C – gtest_c.h
•A header file to provide C interfaces to the Google Test comparison functions – Gtest_helper.h.
•A helper file to interface Google Test comparison function to C – Gtest_helper.cc