【发布时间】:2015-12-09 04:31:53
【问题描述】:
我正在测试我的功能的正确操作
bool Core::IsMeta(void)
{
return mProc->GetCode(mPC)->Meta;
}
使用说明
EXPECT_EQ(true,CC->IsMeta()); // The instruction pointed to is meta EXPECT_EQ(false,CC1->IsMeta()); // The instruction pointed to is NOT meta
测试运行正常,但两个测试的行为不同:'true' 情况编译正常,'false' 情况出现警告
在包含的文件中 /... ./build/gtest/src/gtest/include/gtest/gtest.h:1929:0, 从 /... .cpp:1: /... .cpp: 在成员函数中'virtual void ... ::TestBody()': /... /build/gtest/src/gtest/include/gtest/internal/gtest-internal.h:133:55: 警告:将“false”转换为“char”参数 1 的指针类型 testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null] (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) ^
为什么 gtest 要将 'false' 转换为指针?为什么不“真实”? 我错过了什么吗?
【问题讨论】:
-
为什么不使用
EXPECT_TRUE和EXPECT_FALSE进行布尔测试?
标签: c++ googletest