I would like to test one of my classes with google test. The initialization of this class takes a lot of time and resources, so I would like to do it only once for all of my tests cases, so I am trying to use fixture with SetUpTestSuite(). In my fixture I declare a variable:
static MyClassToBeTested my_class;
In my test cases I would like to access the my_class variable.
During compiling I get the following error:
undefined reference to `MyTest::my_class'
In my test cases I tried to access it with simply my_class and also MyTest::my_class.
class MyTest : public ::testing::Test {
protected:
static MyClassToBeTested my_class;
static void SetUpTestSuite() {
//doing some stuff here
}
};
TEST_F(MyTest, first_test) {
ASSERT_EQ(my_class.foo(), 5);
}
Aucun commentaire:
Enregistrer un commentaire