mardi 17 décembre 2019

Google test testing C code, no destructor warning

I'm currently testing my C code with google test which works fine. I fake my C code with the fff.h framework.

The problem is not the tests them self but the compiler warnings I get when I compile them, I get warnings for each test:

class 'theTest_specificTest_Test' defines a copy constructor and a copy assignment operator but does not define a destructor, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]

My test class looks like this:

DEFINE_FFF_GLOBALS;
FAKE_VALUE_FUNC(int, a_func, const char *, const char *);
...
class theTest : public testing::Test
{
public:
   // some variables here
    virtual void SetUp()
    {
        RESET_FAKE(a_func);
        FFF_RESET_HISTORY();
    }

    virtual void TearDown()
    {
    }
};

A test looks like this:

TEST_F(theTest, theThest_specificTest)
{
    a_func_fake.return_val = 1;  
    int ret = some_func();
    ASSERT_EQ(ret, 0);
}

Aucun commentaire:

Enregistrer un commentaire