Hello. I have an issue.
Code:
//----------------------------------------------------------------------
#include "gtest/gtest.h"
class FooTest: public ::testing::TestWithParam<std::string>
{
protected:
static void SetUpTestCase() {
shared_resource = new int;
*shared_resource = 7;
}
static void TearDownTestCase() {
delete shared_resource;
shared_resource = NULL;
}
static int* shared_resource;
};
int* FooTest::shared_resource = NULL;
TEST_P(FooTest, Test1)
{
const std::string ¶m = this->GetParam();
int x = *shared_resource;
}
INSTANTIATE_TEST_CASE_P(FooTestInstantiation, FooTest, ::testing::Values("p1", "p2", "p3"));
//----------------------------------------------------------------------
Result:
Error 1 error C2248: 'FooTest::TearDownTestCase' : cannot access protected member declared in class 'FooTest' P:\cpp-libs\VC9\x86\gtest-1.6.0-vc9-x86\include\gtest\internal\gtest-param-util.h 516 tests
Error 2 error C2248: 'FooTest::SetUpTestCase' : cannot access protected member declared in class 'FooTest' P:\cpp-libs\VC9\x86\gtest-1.6.0-vc9-x86\include\gtest\internal\gtest-param-util.h 516 tests
Expected: successfull compilation.
Version of Google Test: gtest-1.6.0-vc9-x86
OS: Windows 7 Professional SP1 x64.
What to do? Could anyone help me?