问题:
I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. 今年夏天,我用直接C编写了一个嵌入式系统。这是我工作的公司接管的现有项目。 I have become quite accustomed to writing unit tests in Java using JUnit but was at a loss as to the best way to write unit tests for existing code (which needed refactoring) as well as new code added to the system. 我已经习惯于使用JUnit在Java中编写单元测试,但是对于为现有代码(需要重构)编写单元测试的最佳方法以及添加到系统中的新代码感到茫然。
Are there any projects out there that make unit testing plain C code as easy as unit testing Java code with JUnit? 是否有任何项目使单元测试普通C代码与使用JUnit进行单元测试Java代码一样简单? Any insight that would apply specifically to embedded development (cross-compiling to arm-linux platform) would be greatly appreciated. 任何专门针对嵌入式开发(交叉编译到arm-linux平台)的见解都将非常感激。
解决方案:
参考一: https://stackoom.com/question/H7c/单元测试C代码-关闭参考二: https://oldbug.net/q/H7c/Unit-Testing-C-Code-closed
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4324991