以下に示すように、コンストラクター宣言(引数付き)を使用して、通常のクラスからテストフィクスチャクラスを作成しようとしています。
hello.h
class hello
{
public:
hello(const uint32_t argID, const uint8_t argCommand);
virtual ~hello();
void initialize();
};
ここで、uint32_tは次のとおりです。uint8_tは次のとおりtypedef unsigned int
です。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ファイルに複製しようとしていました。それを行うための方法はありますか?私はそれを多くの方法で実装しようとしましたが、まだ成功していません。これを実装する方法について何か提案はありますか?