Я пытаюсь создать класс тестового прибора из обычного класса с объявлением конструктора (с аргументами), как показано ниже:
hello.h
class hello
{
public:
hello(const uint32_t argID, const uint8_t argCommand);
virtual ~hello();
void initialize();
};
где uint32_t: typedef unsigned int
и uint8_t: typedef unsigned char
Класс моего тестового прибора:
helloTestFixture.h
class helloTestFixture:public testing::Test
{
public:
helloTestFixture(/*How to carry out the constructor declaration in this test fixture class corresponding to the above class?*/);
virtual ~helloTestFixture();
hello m_object;
};
TEST_F(helloTestFixture, InitializeCheck) // Test to access the 'intialize' function
{
m_object.initialize();
}
После попытки реализовать приведенный выше код выдает ошибку:
Error C2512: no appropriate default constructor available
Я пытался скопировать конструктор, созданный в файле hello.h , в мой файл hellotestfixture.h . Есть ли способ сделать это?
Я пытался реализовать его во многих отношениях, но пока безуспешно. Любые предложения о том, как это реализовать?