如何在谷歌mock for c中自动生成mock
How to generate mock automatically in google mock for c
我知道google mock中有一个名为gmock_gen.py的工具,可以用来自动生成c++类的mock。有没有类似的工具可以为c函数生成mock,给定一个c源文件,我想在其中模拟这些函数?
我问题的背景:
我有很多遗留的c代码(不是c++)需要通过谷歌测试和谷歌模拟进行单元测试。要测试一个函数,我必须模拟同一个c源文件中某些函数调用的数百个函数,即使它们不是单元测试中的函数调用的,否则,链接时会出现"未定义引用"问题。
也许你可以看看这个github repo:https://github.com/hjagodzinski/C-Mock
来自文档:
C Mock is Google Mock extension allowing for mocking functions.
This is not either a patch to nor fork of Google Mock. This is just a set of headers providing a way of using tools for mock methods with mock functions in tests.
C Mock is not intended to promote bad design. Its goal is to help people test their code.
相关文章:
- 查找自动生成键并具有线性内存消耗的小型关联数组
- Qt:更新 QString 时自动生成的代码失败
- 我可以说服自动生成的构造函数将我的 POD 类成员归零吗?
- 在 C++ 中自动生成方法
- 删除了所有自动生成的构造函数/运算符的类仍然可以从函数返回吗
- 在编译时自动生成用于稀疏数组索引的switch语句
- 如何在C++中自动生成运算符=?
- C++自动生成的具有常量和非常量引用的复制构造函数
- 如何使用 boost/operator.hpp 自动生成 == 运算符?
- Qt自动生成的.rc文件无法打开包含文件'windows.h'
- 阅读自动生成的 DOLFIN c++ 库文档
- 修改Mongodb源代码以禁用文档的自动生成"_id"字段
- 移动构造函数是自动生成的,即使成员没有移动构造函数?
- 如何为C++结构自动生成 python 数据解析器
- 通过 qt 对发送方和接收方使用自动生成的 Ui
- 如何使用C 根据当前时间自动生成新的CSV文件
- Qt:自动生成电源点报告或可编辑的pdf报告
- 如何更改日食自动生成的标题注释
- 如何自动生成结构的新实例
- 如何在谷歌mock for c中自动生成mock