There's no really need to use pointer for this particular example. Let Sqtest
members be of type int
and you're done:
#include <gtest/gtest.h>
int sq(int x)
{
return x * x;
}
class Sqtest : public ::testing::Test
{
protected:
virtual void SetUp() override
{
a = 1;
b = 2;
c = 3;
}
int a, b, c;
};
TEST_F(Sqtest, posnos)
{
EXPECT_EQ(1, sq(a));
EXPECT_EQ(4, sq(b));
EXPECT_EQ(9, sq(c));
}