gpt4 book ai didi

c++ - C++ 和 gtest 中的运算符 <<

转载 作者:太空宇宙 更新时间:2023-11-04 15:45:00 25 4
gpt4 key购买 nike

应该考虑到我是初学者,所以这个问题可能看起来很愚蠢。

我只是看别人的代码,不知道下面这行是什么意思

EXPECT_EQ(input.getErrorNum(), 0) << input.getErrorMsg();

不知道operator是什么意思<<是gtest定义的吗?

EXPECT_EQ()

是由google提供的测试结构“gtest”定义的宏。

最佳答案

EXPECT_*

The assertions come in pairs that test the same thing but have different effects on the current function. ASSERT_* versions generate fatal failures when they fail, and abort the current function. EXPECT_* versions generate nonfatal failures, which don't abort the current function. Usually EXPECT_* are preferred, as they allow more than one failures to be reported in a test.

每个EXPECT_*像流一样工作,你可以使用 <<打印出一些关于错误、异常和警告的信息。

关于c++ - C++ 和 gtest 中的运算符 <<,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17986756/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com