这是我具备的功能。
int square(const int value)
{
return value * value;
}
void square2(const int value, int& output)
{
output = value * value;
}
我没有问题可以测试方。但我怎么测试square2?
这是我目前正在测试。
TEST(SquareTests, Square)
{
EXPECT_EQ(0, square(0));
EXPECT_EQ(4, square(-2));
}
TEST(SquareTests, SquareParameter)
{
//EXPECT_EQ(0, square2(0));
//EXPECT_EQ(4, square2(-2));
}
TEST(SquareTests, SquareParameterRef)
{
int result = -1;
square2(0, result);
EXPECT_EQ(0, result);
square2(-2, result);
EXPECT_EQ(4, result);
}