【发布时间】:2022-11-23 11:36:02
【问题描述】:
虚拟代码:
void fun()
{
while (m->hasMessage())
{
std::pair<std::string, Vector> msg_pair = m->getMessage();
auto topic = msg_pair.first;
auto msg = msg_pair.second;
for (auto const& x : msg)
{
auto const type = m->MessageType(x);
if (type == "a")
{
funa(x,topic);
}
else if (type == "b")
{
funb(x,topic);
}
else if (type == "c")
{
func(x,topic);
}
}
}
}
fun a,fun b,fun c 是私有函数,fun 是同一个类的公共函数 如何使用谷歌测试来测试函数的乐趣
【问题讨论】:
-
你遇到了什么问题?为什么函数调用私有成员很重要?
-
我没有遇到任何问题,我正在寻找一种方法来测试上述功能。
标签: c++ googletest